From e9b539face45001b12be848453388e5561882a94 Mon Sep 17 00:00:00 2001 From: Jason Henriquez Date: Sun, 27 Oct 2024 21:53:47 -0500 Subject: [PATCH] Only enable page bookmarking on certain routes --- src/renderer/components/top-nav/top-nav.js | 10 ++++++++++ src/renderer/components/top-nav/top-nav.scss | 3 ++- src/renderer/components/top-nav/top-nav.vue | 4 ++-- static/locales/en-US.yaml | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index 3ac9d22b0..1393295c1 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -34,11 +34,20 @@ export default defineComponent({ } return { + isRouteBookmarkable: false, showSearchContainer: true, isArrowBackwardDisabled, isArrowForwardDisabled, currentRouteFullPath: '', searchSuggestionsDataList: [], + allowedPageBookmarkRouteMetaTitles: [ + 'Search Results', + 'Playlist', + 'Channel', + 'Watch', + 'Hashtag', + 'Settings' // for linkable settings sections + ], lastSuggestionQuery: '' } }, @@ -129,6 +138,7 @@ export default defineComponent({ } this.currentRouteFullPath = to.fullPath + this.isRouteBookmarkable = this.allowedPageBookmarkRouteMetaTitles.includes(to.meta.title) } }, mounted: function () { diff --git a/src/renderer/components/top-nav/top-nav.scss b/src/renderer/components/top-nav/top-nav.scss index 25489d5fd..f7d63bdc0 100644 --- a/src/renderer/components/top-nav/top-nav.scss +++ b/src/renderer/components/top-nav/top-nav.scss @@ -60,7 +60,8 @@ } &.arrowBackwardDisabled, - &.arrowForwardDisabled { + &.arrowForwardDisabled, + &.disabled { color: #808080; opacity: 0.5; pointer-events: none; diff --git a/src/renderer/components/top-nav/top-nav.vue b/src/renderer/components/top-nav/top-nav.vue index 312846c01..5aae1d1d2 100644 --- a/src/renderer/components/top-nav/top-nav.vue +++ b/src/renderer/components/top-nav/top-nav.vue @@ -107,8 +107,8 @@ :icon="['fas', 'star']" :title="pageBookmarkIconTitle" :active="isPageBookmarked" - :class="{ [pageBookmarkIconTheme]: true }" - :disabled="!pageBookmarksAvailable" + :class="{ [pageBookmarkIconTheme]: true, disabled: !pageBookmarksAvailable || !isRouteBookmarkable }" + :aria-disabled="!pageBookmarksAvailable || !isRouteBookmarkable" role="button" tabindex="0" @click="showPageBookmarkPrompt" diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index cacfc918d..782efaf63 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -1123,6 +1123,7 @@ Page Bookmark: Updated page bookmark: Updated page bookmark "{name}" Removed page bookmark: Removed page bookmark "{name}" There is {count} other bookmark with the same name.: There is {count} other page bookmark with the same name. | There are {count} other page bookmarks with the same name. + This page cannot be bookmarked.: This page cannot be bookmarked. Role Descriptions: bookmark: bookmark Moments Ago: moments ago