From f944f2153b015690bc691282775cfd3830fc1208 Mon Sep 17 00:00:00 2001 From: glebkostin Date: Mon, 27 May 2024 21:50:24 +0300 Subject: [PATCH 01/14] =?UTF-8?q?HAR-146:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B2=D0=B8=D0=B4=D0=B8=D0=BC=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=81=D0=BA=D1=80=D0=BE=D0=BB=D0=BB=D0=B1=D0=B0=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.js | 2 +- source/widgets/modalWindow/ui/modalWindow.scss | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/index.js b/source/index.js index bda67389..c6caf884 100644 --- a/source/index.js +++ b/source/index.js @@ -1,7 +1,7 @@ import {App} from './app/App.js'; if (navigator.serviceWorker) { - await navigator.serviceWorker.register('/serviceWorker.js', {scope: '/'}); + // await navigator.serviceWorker.register('/serviceWorker.js', {scope: '/'}); } const app = new App(); diff --git a/source/widgets/modalWindow/ui/modalWindow.scss b/source/widgets/modalWindow/ui/modalWindow.scss index 3a2f27c9..2cd37bc9 100644 --- a/source/widgets/modalWindow/ui/modalWindow.scss +++ b/source/widgets/modalWindow/ui/modalWindow.scss @@ -31,3 +31,14 @@ max-height: 50dvh; overflow-y: scroll; } + +.modal-list::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; +} + +.modal-list::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0, 0, 0, .5); + -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5); +} From fec574790e402c5f936655c89dad06b315992c08 Mon Sep 17 00:00:00 2001 From: glebkostin Date: Wed, 29 May 2024 11:34:47 +0300 Subject: [PATCH 02/14] =?UTF-8?q?HAR-146:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=87=D1=82=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/pages/chat/ui/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/pages/chat/ui/chat.js b/source/pages/chat/ui/chat.js index fb3a0d75..e80c30ce 100644 --- a/source/pages/chat/ui/chat.js +++ b/source/pages/chat/ui/chat.js @@ -49,7 +49,7 @@ export class ChatView extends View { const chatWindow = new ChatWindow('chat-window'); chatWindow.render({user}); }; - modalWindow.render(ListBlockView, response.body, UserListItemView, eventFunc); + modalWindow.render(ListBlockView, response.body.users, UserListItemView, eventFunc); }); } } From 002efb41a17edc17577f051151e91e16efaabe69 Mon Sep 17 00:00:00 2001 From: glebkostin Date: Wed, 29 May 2024 11:36:25 +0300 Subject: [PATCH 03/14] =?UTF-8?q?HAR-146:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=87=D1=82=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?+=20=D0=B7=D0=B0=D0=BF=D0=BE=D0=BC=D0=B8=D0=BD=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B2=20=D0=BD=D0=B0=D0=B2=D0=B1?= =?UTF-8?q?=D0=B0=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/entity/notification/ui/notification.js | 6 +++++- source/pages/feed/ui/FeedView.js | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/entity/notification/ui/notification.js b/source/entity/notification/ui/notification.js index c47de199..a2cf8ac6 100644 --- a/source/entity/notification/ui/notification.js +++ b/source/entity/notification/ui/notification.js @@ -1,6 +1,7 @@ import notificationTemplate from './notification.handlebars'; import './notification.scss'; import {View} from '../../../app/View.js'; +import {API} from '../../../shared/api/API.js'; export class NotificationView extends View { constructor(root, ...args) { @@ -32,8 +33,11 @@ export class NotificationView extends View { this.root.insertAdjacentElement('afterbegin', element); - this.root.addEventListener('click', (event) => { + this.root.addEventListener('click', async (event) => { event.preventDefault(); + const api = new API('/notifications/read/' + notification.notification_id); + await api.post({}); + switch (notification?.type) { case 'subscription': history.pushState(null, null, '/profile/' + diff --git a/source/pages/feed/ui/FeedView.js b/source/pages/feed/ui/FeedView.js index fedb918e..f0076700 100644 --- a/source/pages/feed/ui/FeedView.js +++ b/source/pages/feed/ui/FeedView.js @@ -10,6 +10,7 @@ export class FeedView extends View { constructor(...args) { super(...args); this.root = document.querySelector('#root'); + this.user = localStorageGetValue('user'); } async renderHomeFeed() { @@ -31,8 +32,11 @@ export class FeedView extends View { } async render() { - const navbar = new NavbarView(); - navbar.render(); + if (localStorageGetValue('user') !== this.user) { + const navbar = new NavbarView(); + navbar.render(); + this.user = localStorageGetValue('user'); + } const user = localStorageGetValue('user'); this.root.innerHTML = feedViewTemplate({user}); From 4c8695a81ecfcf4bbc066edad6c55327778ddbde Mon Sep 17 00:00:00 2001 From: glebkostin Date: Wed, 29 May 2024 12:08:06 +0300 Subject: [PATCH 04/14] =?UTF-8?q?HAR-146:=20=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=B2=D0=B8=D0=B4=20=D1=83=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/entity/notification/ui/notification.js | 7 +++- source/features/listBlock/ui/listBlock.js | 12 ------- source/shared/styles/App.scss | 1 + source/widgets/navbar/ui/navbar.handlebars | 11 +++++-- source/widgets/navbar/ui/navbar.js | 15 +++++++-- source/widgets/navbar/ui/navbar.scss | 33 +++++++++++++++++-- 6 files changed, 60 insertions(+), 19 deletions(-) diff --git a/source/entity/notification/ui/notification.js b/source/entity/notification/ui/notification.js index a2cf8ac6..4224bf14 100644 --- a/source/entity/notification/ui/notification.js +++ b/source/entity/notification/ui/notification.js @@ -31,7 +31,9 @@ export class NotificationView extends View { element.innerHTML = notificationTemplate({content, time: time.toLocaleString('ru', options)}); - this.root.insertAdjacentElement('afterbegin', element); + if (!notification?.delete) { + this.root.insertAdjacentElement('afterbegin', element); + } this.root.addEventListener('click', async (event) => { event.preventDefault(); @@ -50,6 +52,9 @@ export class NotificationView extends View { history.pushState(null, null, '/pin/' + notification?.pin?.pin_id); break; } + + this.root.remove(); + notification.delete = true; }); } } diff --git a/source/features/listBlock/ui/listBlock.js b/source/features/listBlock/ui/listBlock.js index bc26fd10..9b39cefb 100644 --- a/source/features/listBlock/ui/listBlock.js +++ b/source/features/listBlock/ui/listBlock.js @@ -9,18 +9,6 @@ export class ListBlockView extends View { this.id = 0; } - addRender(objects, RenderEntity, ...args) { - this.root.innerHTML += listBlockTemplate({objects, index: this.id}); - const prefix = '#list-item-'; - for (let i = this.id; i < this.id + objects.length; ++i) { - const root = document.querySelector(prefix + i); - console.log(root); - - const entity = new RenderEntity(root); - entity.render(objects[i], ...args); - } - this.id = this.id + objects.length; - } render(objects, RenderEntity, ...args) { this.root.innerHTML = listBlockTemplate({objects}); const prefix = '#list-item-'; diff --git a/source/shared/styles/App.scss b/source/shared/styles/App.scss index 629ca70d..9fdc9535 100644 --- a/source/shared/styles/App.scss +++ b/source/shared/styles/App.scss @@ -75,6 +75,7 @@ body.modal-open{ .link-text:hover{ cursor: pointer; color: variables.$font-link-selected-color; + text-decoration: underline; } .text-center{ diff --git a/source/widgets/navbar/ui/navbar.handlebars b/source/widgets/navbar/ui/navbar.handlebars index 5b113a06..f0bae857 100644 --- a/source/widgets/navbar/ui/navbar.handlebars +++ b/source/widgets/navbar/ui/navbar.handlebars @@ -18,8 +18,15 @@ -