Show notification dot when toolbar is collapsed

master
David Benqué 3 years ago
parent 11296370ba
commit 9f943508e6

@ -1045,10 +1045,24 @@
is very small, which makes it unlikely that you'll see the title unless is very small, which makes it unlikely that you'll see the title unless
you hover perfectly. The same is true of the drive's grid/list view toggle. you hover perfectly. The same is true of the drive's grid/list view toggle.
*/ */
position: relative;
.fa { .fa {
margin-right: 0px; margin-right: 0px;
} }
.cp-collapsed-notif {
display: inline-block;
width: 12px;
height: 12px;
background-color: @cryptpad_color_red;
position: absolute;
bottom: -3px;
right: -3px;
border: 2px solid @cp_toolbar-bg;
border-radius: 50%;
}
&:not(.cp-toolbar-button-active) .cp-collapsed-notif {
display: none;
}
} }
&.cp-toolbar-small { &.cp-toolbar-small {

@ -463,15 +463,18 @@ MessengerUI, Messages, Pages) {
createCollapse = function (toolbar) { createCollapse = function (toolbar) {
var up = h('i.fa.fa-chevron-up', {title: Messages.toolbar_collapse}); var up = h('i.fa.fa-chevron-up', {title: Messages.toolbar_collapse});
var down = h('i.fa.fa-chevron-down', {title: Messages.toolbar_expand}); var down = h('i.fa.fa-chevron-down', {title: Messages.toolbar_expand});
var notif = h('span.cp-collapsed-notif');
var $button = $(h('button.cp-toolbar-collapse',[ var $button = $(h('button.cp-toolbar-collapse',[
up, up,
down down,
notif
])); ]));
var $up = $(up); var $up = $(up);
var $down = $(down); var $down = $(down);
toolbar.$bottomR.prepend($button); toolbar.$bottomR.prepend($button);
$down.hide(); $down.hide();
$(notif).hide();
$button.click(function () { $button.click(function () {
toolbar.$top.toggleClass('toolbar-hidden'); toolbar.$top.toggleClass('toolbar-hidden');
var hidden = toolbar.$top.hasClass('toolbar-hidden'); var hidden = toolbar.$top.hasClass('toolbar-hidden');
@ -482,6 +485,7 @@ MessengerUI, Messages, Pages) {
} else { } else {
$up.show(); $up.show();
$down.hide(); $down.hide();
$(notif).hide();
} }
}); });
}; };
@ -1173,6 +1177,9 @@ MessengerUI, Messages, Pages) {
Common.mailbox.subscribe(['notifications', 'team', 'broadcast', 'reminders'], { Common.mailbox.subscribe(['notifications', 'team', 'broadcast', 'reminders'], {
onMessage: function (data, el) { onMessage: function (data, el) {
if (toolbar.$top.hasClass('toolbar-hidden')) {
$('.cp-collapsed-notif').css('display', '');
}
if (el) { if (el) {
$(div).prepend(el); $(div).prepend(el);
} }

Loading…
Cancel
Save