Skip to content

Commit

Permalink
HAR-146: Переписал алгоритм
Browse files Browse the repository at this point in the history
  • Loading branch information
glebkos committed May 27, 2024
1 parent 61945fb commit 7687229
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/widgets/navbar/ui/navbar.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<img src="/static/notification.svg" alt="" class="navbar-notification-button__icon">
</div>
<div class="navbar-notification-list navbar-popup-menu_closed" id="navbar-notification-list">
<span class="text-center description">Уведомлений нет</span>
<span class="text-center description" id="notifications-none">Уведомлений нет</span>
</div>
</div>
<div class="navbar-icon button secondary-button" id="navbar__chat-button">
Expand Down
17 changes: 7 additions & 10 deletions source/widgets/navbar/ui/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,20 @@ export class NavbarView extends View {
notificationList.classList.toggle('navbar-popup-menu_closed');
});

Clt
WebSocketService.register("NOTIFICATION_SUBSCRIPTION", (payload) => {
payload.type = 'subscription';
console.log(listBlock, listBlock?.root?.firstChild?.tagName, listBlock?.root?.firstChild);
if (listBlock.root.firstChild.tagName === 'span'){
listBlock.render([payload], NotificationView);
return;
}
const notificationNone = listBlock.root.querySelector('#notifications-none');
notificationNone.classList.add('notification-title-disable');

listBlock.addRender(payload, NotificationView);
});

WebSocketService.register("NOTIFICATION_NEW_PIN", (payload) => {
payload.type = 'new_pin';
console.log(listBlock, listBlock?.root?.firstChild?.tagName, listBlock?.root?.firstChild);
if (listBlock.root.firstChild.tagName === 'span'){
listBlock.render([payload], NotificationView);
return;
}
const notificationNone = listBlock.root.querySelector('#notifications-none');
notificationNone.classList.add('notification-title-disable');

listBlock.addRender(payload, NotificationView);
});

Expand Down
6 changes: 6 additions & 0 deletions source/widgets/navbar/ui/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@
transition: all .3s;
}

.notification-title-disable{
position: absolute;
opacity: 0;
pointer-events: none;
}

@media screen and (max-width: 540px) {
.navbar_right-block{
position: fixed;
Expand Down

0 comments on commit 7687229

Please sign in to comment.