mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2025-11-04 06:31:55 +00:00 
			
		
		
		
	Merge pull request #2645 from Bnyro/master
Use a router link for opening the home page
This commit is contained in:
		@@ -1,8 +1,14 @@
 | 
			
		||||
<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">
 | 
			
		||||
            <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
 | 
			
		||||
            <router-link class="flex font-bold text-3xl items-center font-sans" :to="homePagePath"
 | 
			
		||||
                ><img
 | 
			
		||||
                    alt="logo"
 | 
			
		||||
                    src="/img/icons/logo.svg"
 | 
			
		||||
                    height="32"
 | 
			
		||||
                    width="32"
 | 
			
		||||
                    class="w-10 mr-[-0.6rem]"
 | 
			
		||||
                />iped</router-link
 | 
			
		||||
            >
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="lt-md:hidden search-container">
 | 
			
		||||
@@ -122,12 +128,14 @@ export default {
 | 
			
		||||
            searchText: "",
 | 
			
		||||
            suggestionsVisible: false,
 | 
			
		||||
            showTopNav: false,
 | 
			
		||||
            homePagePath: "/",
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        const query = new URLSearchParams(window.location.search).get("search_query");
 | 
			
		||||
        if (query) this.onSearchTextChange(query);
 | 
			
		||||
        this.focusOnSearchBar();
 | 
			
		||||
        this.homePagePath = this.getHomePage(this);
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
        shouldShowLogin(_this) {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,10 @@ export default {
 | 
			
		||||
    activated() {
 | 
			
		||||
        document.title = this.$t("titles.trending") + " - Piped";
 | 
			
		||||
        if (this.videos.length > 0) this.updateWatched(this.videos);
 | 
			
		||||
        if (this.$route.path == "/") this.openHomePage(this);
 | 
			
		||||
        if (this.$route.path == "/") {
 | 
			
		||||
            let homepage = this.getHomePage(this);
 | 
			
		||||
            if (homepage !== undefined) this.$router.push(homepage);
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        async fetchTrending(region) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								src/main.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.js
									
									
									
									
									
								
							@@ -532,19 +532,15 @@ const mixin = {
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        openHomePage(_this) {
 | 
			
		||||
            let route;
 | 
			
		||||
        getHomePage(_this) {
 | 
			
		||||
            switch (_this.getPreferenceString("homepage", "trending")) {
 | 
			
		||||
                case "trending":
 | 
			
		||||
                    route = "/trending";
 | 
			
		||||
                    break;
 | 
			
		||||
                    return "/trending";
 | 
			
		||||
                case "feed":
 | 
			
		||||
                    route = "/feed";
 | 
			
		||||
                    break;
 | 
			
		||||
                    return "/feed";
 | 
			
		||||
                default:
 | 
			
		||||
                    break;
 | 
			
		||||
                    return undefined;
 | 
			
		||||
            }
 | 
			
		||||
            if (route !== undefined) _this.$router.push(route);
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user