Merge pull request #2629 from Bnyro/default-homepage-fix

Open default homepage directly on navbar icon click
This commit is contained in:
Bnyro 2023-07-06 22:58:19 +02:00 committed by GitHub
commit b18e964dc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 19 deletions

View file

@ -1,14 +1,8 @@
<template>
<nav class="flex flex-wrap items-center justify-center px-2 sm:px-4 pb-2.5 w-full relative">
<div class="flex-1 flex justify-start">
<router-link class="flex font-bold text-3xl items-center font-sans" to="/"
><img
alt="logo"
src="/img/icons/logo.svg"
height="32"
width="32"
class="w-10 mr-[-0.6rem]"
/>iped</router-link
<span class="flex font-bold text-3xl items-center font-sans cursor-pointer" @click="openHomePage(this)"
><img alt="logo" src="/img/icons/logo.svg" height="32" width="32" class="w-10 mr-[-0.6rem]" />iped</span
>
</div>
<div class="lt-md:hidden search-container">

View file

@ -34,17 +34,7 @@ export default {
activated() {
document.title = this.$t("titles.trending") + " - Piped";
if (this.videos.length > 0) this.updateWatched(this.videos);
if (this.$route.path == "/") {
switch (this.getPreferenceString("homepage", "trending")) {
case "trending":
break;
case "feed":
this.$router.push("/feed");
return;
default:
break;
}
}
if (this.$route.path == "/") this.openHomePage(this);
},
methods: {
async fetchTrending(region) {

View file

@ -532,6 +532,20 @@ const mixin = {
},
});
},
openHomePage(_this) {
let route;
switch (_this.getPreferenceString("homepage", "trending")) {
case "trending":
route = "/trending";
break;
case "feed":
route = "/feed";
break;
default:
break;
}
if (route !== undefined) _this.$router.push(route);
},
},
computed: {
authenticated(_this) {