Skip to content

Commit

Permalink
Merge pull request #2629 from Bnyro/default-homepage-fix
Browse files Browse the repository at this point in the history
Open default homepage directly on navbar icon click
  • Loading branch information
Bnyro authored Jul 6, 2023
2 parents 692e0cf + 39d1106 commit b18e964
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
12 changes: 1 addition & 11 deletions src/components/TrendingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b18e964

Please sign in to comment.