diff --git a/src/renderer/App.js b/src/renderer/App.js index 81185f9347f6c..ea50ffe27bc2b 100644 --- a/src/renderer/App.js +++ b/src/renderer/App.js @@ -108,6 +108,10 @@ export default defineComponent({ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' }, + landingPage: function() { + return '/' + this.$store.getters.getLandingPage + }, + externalLinkOpeningPromptNames: function () { return [ this.$t('Yes'), @@ -133,7 +137,7 @@ export default defineComponent({ $route () { // react to route changes... // Hide top nav filter panel on page change - this.$refs.topNav.hideFilters() + this.$refs.topNav?.hideFilters() } }, created () { @@ -175,7 +179,13 @@ export default defineComponent({ }) this.$router.afterEach((to, from) => { - this.$refs.topNav.navigateHistory() + this.$refs.topNav?.navigateHistory() + }) + + this.$router.onReady(() => { + if (this.$router.currentRoute.path !== this.landingPage && this.landingPage !== '/subscriptions') { + this.$router.push({ path: this.landingPage }) + } }) }) }, diff --git a/src/renderer/components/general-settings/general-settings.js b/src/renderer/components/general-settings/general-settings.js index 589ebb53ee5c0..d682bbba5d551 100644 --- a/src/renderer/components/general-settings/general-settings.js +++ b/src/renderer/components/general-settings/general-settings.js @@ -27,20 +27,6 @@ export default defineComponent({ 'invidious', 'local' ], - defaultPageNames: [ - 'Subscriptions', - 'Trending', - 'Most Popular', - 'Playlists', - 'History' - ], - defaultPageValues: [ - 'subscriptions', - 'trending', - 'mostPopular', - 'playlists', - 'history' - ], viewTypeValues: [ 'grid', 'list' @@ -57,6 +43,15 @@ export default defineComponent({ '', 'openLinkAfterPrompt', 'doNothing' + ], + includedDefaultPageNames: [ + 'subscriptions', + 'subscribedChannels', + 'trending', + 'popular', + 'userPlaylists', + 'history', + 'settings' ] } }, @@ -79,10 +74,38 @@ export default defineComponent({ checkForBlogPosts: function () { return this.$store.getters.getCheckForBlogPosts }, + hidePlaylists: function () { + return this.$store.getters.getHidePlaylists + }, + hidePopularVideos: function () { + return this.$store.getters.getHidePopularVideos + }, + hideTrendingVideos: function () { + return this.$store.getters.getHideTrendingVideos + }, + defaultPages: function () { + let includedPageNames = this.includedDefaultPageNames + if (this.hideTrendingVideos) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'trending') + if (this.hidePlaylists) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'userPlaylists') + if (!(!this.hidePopularVideos && (this.backendFallback || this.backendPreference === 'invidious'))) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'popular') + return this.$router.getRoutes().filter((route) => includedPageNames.includes(route.name)) + }, + defaultPageNames: function () { + return this.defaultPages.map((route) => this.$t(route.meta.title)) + }, + defaultPageValues: function () { + // avoid Vue parsing issues by excluding '/' from path values + return this.defaultPages.map((route) => route.path.substring(1)) + }, backendPreference: function () { return this.$store.getters.getBackendPreference }, landingPage: function () { + const landingPage = this.$store.getters.getLandingPage + // invalidate landing page selection & restore to default value if no longer valid + if (!this.defaultPageValues.includes(landingPage)) { + this.updateLandingPage('subscriptions') + } return this.$store.getters.getLandingPage }, region: function () { diff --git a/src/renderer/components/general-settings/general-settings.vue b/src/renderer/components/general-settings/general-settings.vue index 0279708b82aa2..0aad1a08b929f 100644 --- a/src/renderer/components/general-settings/general-settings.vue +++ b/src/renderer/components/general-settings/general-settings.vue @@ -43,7 +43,6 @@ @change="handlePreferredApiBackend" /> route.path === '/' + this.landingPage) + .meta.title + ) + }) + }, + enableSearchSuggestions: function () { return this.$store.getters.getEnableSearchSuggestions }, diff --git a/src/renderer/components/top-nav/top-nav.vue b/src/renderer/components/top-nav/top-nav.vue index 03cd544ce1ac6..69a54ab70355b 100644 --- a/src/renderer/components/top-nav/top-nav.vue +++ b/src/renderer/components/top-nav/top-nav.vue @@ -59,10 +59,10 @@ dir="ltr" role="link" tabindex="0" - :title="$t('Subscriptions.Subscriptions')" - @click="navigate('subscriptions')" - @keydown.space.prevent="navigate('subscriptions')" - @keydown.enter.prevent="navigate('subscriptions')" + :title="headerLogoTitle" + @click="navigate(landingPage)" + @keydown.space.prevent="navigate(landingPage)" + @keydown.enter.prevent="navigate(landingPage)" >