From 3d3f57bfc3068255b36ac8e7d1d7575bcb7a9217 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 20 Feb 2025 16:27:13 +0800 Subject: [PATCH] feat: notifications drawer Squashed commit of the following: commit e0d503ef38c5b8d4b19f81368b53b656e6935ff7 Author: Hakadao Date: Thu Feb 20 16:24:53 2025 +0800 feat(locales): add translation for notifications page drawer option commit 5c4e5aab811c3bf73d2cfc983e646edca66dff55 Author: Hakadao Date: Thu Feb 20 16:24:32 2025 +0800 chore: udpate commit dd7ff6dfeadd514746e1a10773702387cea3c550 Author: Hakadao Date: Thu Feb 20 16:13:54 2025 +0800 fix(a-link): disable click event when using modifier key click commit f4801a040b26d6b084168859f2a1e5b9b32ae178 Author: Hakadao Date: Thu Feb 20 16:06:13 2025 +0800 feat: enhance notifications drawer functionality with custom URL and click handling commit 7e63cd4417572a5455c8dbccc447f8fe37d92c02 Author: Hakadao Date: Thu Feb 20 15:36:53 2025 +0800 chore: update commit 077c416e1ead6cd9ed249375c6c0c4625b2339ec Author: Hakadao Date: Thu Feb 20 14:32:28 2025 +0800 fix: add Teleport to NotificationsDrawer for better app integration commit 5e17ed34f68677bfc8423ad3e24ea3cc3afa038e Author: Hakadao Date: Thu Feb 20 14:26:36 2025 +0800 chore: tweak styles commit 4536347b12ef9e3d0c2ce06c1395ba89fe44fc51 Author: Hakadao Date: Thu Feb 20 13:52:29 2025 +0800 feat: improve notifications drawer styles commit 022ea89eed4ae5c6953445118dec97acb15cf38e Merge: 17f882e7 7a513921 Author: Hakadao Date: Thu Feb 20 12:30:04 2025 +0800 Merge branch 'main' into feat/notications-drawer commit 17f882e7cda0b4d74b916592d526f4b1ad5f921d Merge: 4d615462 6dd838a8 Author: Hakadao Date: Thu Feb 20 12:18:44 2025 +0800 feat: update notifications drawer style commit 4d6154625af76917aca55970f8c29d0dcd40a416 Author: Hakadao Date: Wed Feb 19 18:58:24 2025 +0800 feat: notifications drawer --- src/_locales/cmn-CN.yml | 2 + src/_locales/cmn-TW.yml | 2 + src/_locales/en.yml | 2 + src/_locales/jyut.yml | 2 + src/components/ALink.vue | 6 +- .../DesktopAndDock/DesktopAndDock.vue | 3 + src/components/TopBar/TopBar.vue | 36 ++- .../TopBar/components/NotificationsDrawer.vue | 226 ++++++++++++++++++ .../TopBar/components/NotificationsPop.vue | 15 +- src/contentScripts/index.ts | 27 +-- src/contentScripts/views/App.vue | 8 +- src/logic/storage.ts | 4 + src/styles/adaptedStyles/index.ts | 7 +- .../pages/notificationsPage.scss | 33 +++ src/utils/main.ts | 18 +- 15 files changed, 361 insertions(+), 30 deletions(-) create mode 100644 src/components/TopBar/components/NotificationsDrawer.vue diff --git a/src/_locales/cmn-CN.yml b/src/_locales/cmn-CN.yml index ff9f639d..8a72640b 100644 --- a/src/_locales/cmn-CN.yml +++ b/src/_locales/cmn-CN.yml @@ -156,6 +156,8 @@ settings: number: 数字 dot: 圆点 none: 不显示 + open_notifications_page_as_drawer: 将通知页面作为抽屉打开 + always_use_dock: 总是使用 Dock 栏 always_use_dock_desc: 启用后,Dock 栏将始终显示,侧边栏将隐藏。我们推荐你同时启用自动隐藏 Dock 栏。 auto_hide_dock: 自动隐藏 Dock 栏 diff --git a/src/_locales/cmn-TW.yml b/src/_locales/cmn-TW.yml index 90273e88..2de5a726 100644 --- a/src/_locales/cmn-TW.yml +++ b/src/_locales/cmn-TW.yml @@ -156,6 +156,8 @@ settings: number: 數字 dot: 圓點 none: 不顯示 + open_notifications_page_as_drawer: 將通知頁面作為抽屜開啟 + always_use_dock: 總是使用 Dock always_use_dock_desc: 啟用後,Dock 將始終顯示,側邊欄將隱藏。我們推薦你同時啟用自動隱藏 Dock。 auto_hide_dock: 自動隱藏 Dock diff --git a/src/_locales/en.yml b/src/_locales/en.yml index 3bf18d12..09dff0dc 100644 --- a/src/_locales/en.yml +++ b/src/_locales/en.yml @@ -158,6 +158,8 @@ settings: number: Number dot: Dot none: Do not show + open_notifications_page_as_drawer: Open the notifications page as a drawer + always_use_dock: Always use the dock always_use_dock_desc: The dock will always be visible and the sidebar will be hidden. We also recommend enabling auto-hide for the dock. auto_hide_dock: Automatically hide the dock diff --git a/src/_locales/jyut.yml b/src/_locales/jyut.yml index 724309dc..0c532f24 100644 --- a/src/_locales/jyut.yml +++ b/src/_locales/jyut.yml @@ -154,6 +154,8 @@ settings: number: 數字 dot: 圓點 none: 唔顯示 + open_notifications_page_as_drawer: 用櫃桶打開通知頁面 + always_use_dock: 點都要用 Dock always_use_dock_desc: 啓用後,Dock 點都要用佢而唔係用側邊欄。我哋推介你同時啓用自動收埋 Dock 去。 auto_hide_dock: 自動收埋 Dock diff --git a/src/components/ALink.vue b/src/components/ALink.vue index 835dc1a9..5fd6f2ba 100644 --- a/src/components/ALink.vue +++ b/src/components/ALink.vue @@ -41,12 +41,16 @@ const target = computed(() => { }) function handleClick(event: MouseEvent) { + if (event.ctrlKey || event.metaKey || event.altKey) + return + if (props.customClickEvent) { + event.preventDefault() emit('click', event) return } - if (openMode.value === 'drawer' && !event.ctrlKey && !event.metaKey) { + if (openMode.value === 'drawer') { event.preventDefault() openIframeDrawer(props.href) } diff --git a/src/components/Settings/DesktopAndDock/DesktopAndDock.vue b/src/components/Settings/DesktopAndDock/DesktopAndDock.vue index 5b0576a2..80eab9bd 100644 --- a/src/components/Settings/DesktopAndDock/DesktopAndDock.vue +++ b/src/components/Settings/DesktopAndDock/DesktopAndDock.vue @@ -107,6 +107,9 @@ function handleToggleDockItem(dockItem: any) {