feat: notifications drawer

Squashed commit of the following:

commit e0d503ef38c5b8d4b19f81368b53b656e6935ff7
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 16:24:53 2025 +0800

    feat(locales): add translation for notifications page drawer option

commit 5c4e5aab811c3bf73d2cfc983e646edca66dff55
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 16:24:32 2025 +0800

    chore: udpate

commit dd7ff6dfeadd514746e1a10773702387cea3c550
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 16:13:54 2025 +0800

    fix(a-link): disable click event when using modifier key click

commit f4801a040b26d6b084168859f2a1e5b9b32ae178
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 16:06:13 2025 +0800

    feat: enhance notifications drawer functionality with custom URL and click handling

commit 7e63cd4417572a5455c8dbccc447f8fe37d92c02
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 15:36:53 2025 +0800

    chore: update

commit 077c416e1ead6cd9ed249375c6c0c4625b2339ec
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 14:32:28 2025 +0800

    fix: add Teleport to NotificationsDrawer for better app integration

commit 5e17ed34f68677bfc8423ad3e24ea3cc3afa038e
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 14:26:36 2025 +0800

    chore: tweak styles

commit 4536347b12ef9e3d0c2ce06c1395ba89fe44fc51
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 13:52:29 2025 +0800

    feat: improve notifications drawer styles

commit 022ea89eed4ae5c6953445118dec97acb15cf38e
Merge: 17f882e7 7a513921
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 12:30:04 2025 +0800

    Merge branch 'main' into feat/notications-drawer

commit 17f882e7cda0b4d74b916592d526f4b1ad5f921d
Merge: 4d615462 6dd838a8
Author: Hakadao <a578457889743@gmail.com>
Date:   Thu Feb 20 12:18:44 2025 +0800

    feat: update notifications drawer style

commit 4d6154625a
Author: Hakadao <a578457889743@gmail.com>
Date:   Wed Feb 19 18:58:24 2025 +0800

    feat: notifications drawer
This commit is contained in:
Hakadao
2025-02-20 16:27:13 +08:00
parent 7a51392198
commit 3d3f57bfc3
15 changed files with 361 additions and 30 deletions

View File

@@ -9,7 +9,7 @@ import { settings } from '~/logic'
import { setupApp } from '~/logic/common-setup'
import RESET_BEWLY_CSS from '~/styles/reset.css?raw'
import { runWhenIdle } from '~/utils/lazyLoad'
import { compareVersions, injectCSS, isHomePage, isInIframe } from '~/utils/main'
import { compareVersions, injectCSS, isHomePage, isInIframe, isNotificationPage, isVideoOrBangumiPage } from '~/utils/main'
import { SVG_ICONS } from '~/utils/svgIcons'
import { version } from '../../package.json'
@@ -36,18 +36,10 @@ function isSupportedPages(): boolean {
if (
// homepage
isHomePage()
// video or bangumi page
|| isVideoOrBangumiPage()
// popular page https://www.bilibili.com/v/popular/all
|| /https?:\/\/(?:www\.)?bilibili\.com\/v\/popular\/all.*/.test(currentUrl)
// video page
|| /https?:\/\/(?:www\.)?bilibili\.com\/(?:video|list)\/.*/.test(currentUrl)
// anime playback & movie page
|| /https?:\/\/(?:www\.)?bilibili\.com\/bangumi\/play\/.*/.test(currentUrl)
// watch later playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/watchlater.*/.test(currentUrl)
|| /https?:\/\/(?:www\.)?bilibili\.com\/watchlater\/list.*/.test(currentUrl)
// favorite playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/ml.*/.test(currentUrl)
// search page
|| /https?:\/\/search\.bilibili\.com\.*/.test(currentUrl)
// moments page
@@ -98,6 +90,8 @@ export function isSupportedIframePages(): boolean {
&& (
// supports Bilibili page URLs recorded in the dock
isHomePage()
// Since `Open in drawer` will open the video page within an iframe, so we need to support the following pages
|| isVideoOrBangumiPage()
|| /https?:\/\/search\.bilibili\.com\/all.*/.test(currentUrl)
|| /https?:\/\/www\.bilibili\.com\/anime.*/.test(currentUrl)
|| /https?:\/\/space\.bilibili\.com\/\d+\/favlist.*/.test(currentUrl)
@@ -108,15 +102,8 @@ export function isSupportedIframePages(): boolean {
// https://github.com/BewlyBewly/BewlyBewly/issues/1256
// https://github.com/BewlyBewly/BewlyBewly/issues/1266
|| /https?:\/\/t\.bilibili\.com(?!\/vote|\/share).*/.test(currentUrl)
// Since `Open in drawer` will open the video page within an iframe, so we need to support the following pages
// video page
|| /https?:\/\/(?:www\.)?bilibili\.com\/(?:video|list)\/.*/.test(currentUrl)
// anime playback & movie page
|| /https?:\/\/(?:www\.)?bilibili\.com\/bangumi\/play\/.*/.test(currentUrl)
// watch later playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/watchlater.*/.test(currentUrl)
// favorite playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/ml.*/.test(currentUrl)
// notifications page, for `Open the notifications page as a drawer`
|| isNotificationPage()
)
) {
return true

View File

@@ -4,12 +4,12 @@ import type { Ref } from 'vue'
import type { BewlyAppProvider } from '~/composables/useAppProvider'
import { useDark } from '~/composables/useDark'
import { BEWLY_MOUNTED, DRAWER_VIDEO_ENTER_PAGE_FULL, DRAWER_VIDEO_EXIT_PAGE_FULL, IFRAME_PAGE_SWITCH_BEWLY, IFRAME_PAGE_SWITCH_BILI, OVERLAY_SCROLL_BAR_SCROLL } from '~/constants/globalEvents'
import { BEWLY_MOUNTED, DRAWER_VIDEO_ENTER_PAGE_FULL, DRAWER_VIDEO_EXIT_PAGE_FULL, IFRAME_PAGE_ESC_KEY_DOWN, IFRAME_PAGE_SWITCH_BEWLY, IFRAME_PAGE_SWITCH_BILI, OVERLAY_SCROLL_BAR_SCROLL } from '~/constants/globalEvents'
import { AppPage } from '~/enums/appEnums'
import { settings } from '~/logic'
import { type DockItem, useMainStore } from '~/stores/mainStore'
import { useSettingsStore } from '~/stores/settingsStore'
import { isHomePage, isInIframe, isVideoOrBangumiPage, openLinkToNewTab, queryDomUntilFound, scrollToTop } from '~/utils/main'
import { isHomePage, isInIframe, isNotificationPage, isVideoOrBangumiPage, openLinkToNewTab, queryDomUntilFound, scrollToTop } from '~/utils/main'
import emitter from '~/utils/mitt'
import { setupNecessarySettingsWatchers } from './necessarySettingsWatchers'
@@ -98,6 +98,10 @@ const showTopBar = computed((): boolean => {
if (isVideoOrBangumiPage() && isInIframe())
return false
// when user open the notifications page as a drawer, don't show the top bar
if (isNotificationPage() && settings.value.openNotificationsPageAsDrawer && isInIframe())
return false
// When the user switches to the original Bilibili page, BewlyBewly will only show the top bar inside the iframe.
// This helps prevent the outside top bar from covering the contents.
// reference: https://github.com/BewlyBewly/BewlyBewly/issues/1235