2022-03-21 20:34:34 +00:00
|
|
|
<template>
|
2022-05-13 06:20:15 +00:00
|
|
|
<v-card style="display: flex" class="rounded-0 pa-3 topNav background">
|
2022-05-23 20:03:03 +00:00
|
|
|
<!-- opacity with vue 😉 -->
|
|
|
|
<!-- :style="{ background: $vuetify.theme.currentTheme.primary + '55' }" -->
|
2022-05-14 04:36:56 +00:00
|
|
|
<h3
|
|
|
|
v-show="!search"
|
|
|
|
class="my-auto ml-4"
|
|
|
|
v-text="
|
|
|
|
$route.path.includes('channel') ? $store.state.channel.title : page
|
|
|
|
"
|
|
|
|
/>
|
2022-03-21 20:34:34 +00:00
|
|
|
|
2022-03-21 23:47:11 +00:00
|
|
|
<v-btn
|
|
|
|
v-if="search"
|
|
|
|
icon
|
|
|
|
class="mr-3 my-auto"
|
|
|
|
@click="$emit('close-search')"
|
|
|
|
>
|
2022-03-21 20:34:34 +00:00
|
|
|
<v-icon>mdi-close</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
|
|
|
|
<v-text-field
|
2022-03-21 23:47:11 +00:00
|
|
|
v-if="search"
|
|
|
|
v-model="text"
|
2022-03-21 20:34:34 +00:00
|
|
|
solo
|
|
|
|
dense
|
|
|
|
flat
|
2022-05-21 02:01:39 +00:00
|
|
|
autofocus
|
2022-03-21 20:34:34 +00:00
|
|
|
label="Search"
|
2022-05-13 19:54:14 +00:00
|
|
|
style="margin-top: 7px"
|
2022-03-31 06:01:29 +00:00
|
|
|
:background-color="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
2022-03-21 23:47:11 +00:00
|
|
|
@input="$emit('text-changed', text)"
|
|
|
|
@keyup.enter="$emit('search-btn', text)"
|
2022-03-21 20:34:34 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<v-spacer v-if="!search" />
|
|
|
|
|
2022-03-24 04:55:38 +00:00
|
|
|
<v-btn
|
2022-05-05 23:09:28 +00:00
|
|
|
v-if="!search && $route.path.includes('/home')"
|
2022-03-24 04:55:38 +00:00
|
|
|
v-show="page == 'Home'"
|
|
|
|
icon
|
|
|
|
tile
|
|
|
|
class="ml-3 mr-1 my-auto fill-height"
|
|
|
|
style="border-radius: 0.25rem !important"
|
|
|
|
@click="refreshRecommendations"
|
|
|
|
>
|
2022-04-04 15:42:42 +00:00
|
|
|
<v-icon>mdi-refresh</v-icon>
|
|
|
|
</v-btn>
|
2022-03-21 20:34:34 +00:00
|
|
|
<v-btn
|
2022-05-13 22:25:47 +00:00
|
|
|
v-if="$route.name !== 'settings' && !$route.path.includes('/mods')"
|
2022-03-21 20:34:34 +00:00
|
|
|
icon
|
|
|
|
tile
|
2022-07-20 19:18:29 +00:00
|
|
|
:loading="$store.state.search.loading"
|
2022-03-21 21:01:37 +00:00
|
|
|
class="ml-3 my-auto fill-height"
|
2022-03-21 20:34:34 +00:00
|
|
|
style="border-radius: 0.25rem !important"
|
|
|
|
@click="$emit('search-btn', text)"
|
|
|
|
>
|
2022-04-04 15:42:42 +00:00
|
|
|
<v-icon>mdi-magnify</v-icon>
|
|
|
|
</v-btn>
|
2022-03-21 20:34:34 +00:00
|
|
|
<v-btn
|
2022-03-21 23:47:11 +00:00
|
|
|
v-show="!search"
|
2022-03-21 20:34:34 +00:00
|
|
|
icon
|
|
|
|
tile
|
2022-07-29 06:52:25 +00:00
|
|
|
class="ml-4 mr-2 my-auto fill-height rounded-xl"
|
2022-12-12 08:39:45 +00:00
|
|
|
:style="$route.name == 'settings' ? 'transform: rotate(180deg)' : ''"
|
2022-07-29 06:52:25 +00:00
|
|
|
@click="
|
2022-12-12 08:39:45 +00:00
|
|
|
$route.name == 'settings' ? closeSettings() : $router.push('/settings')
|
2022-07-29 06:52:25 +00:00
|
|
|
"
|
2022-03-21 20:34:34 +00:00
|
|
|
>
|
2022-07-29 06:52:25 +00:00
|
|
|
<v-icon>{{
|
2022-12-12 08:39:45 +00:00
|
|
|
$route.name == "settings"
|
|
|
|
? "mdi-close"
|
|
|
|
: $route.name.includes("mods")
|
|
|
|
? "mdi-arrow-left"
|
|
|
|
: "mdi-cog-outline"
|
2022-07-29 06:52:25 +00:00
|
|
|
}}</v-icon>
|
2022-04-04 15:42:42 +00:00
|
|
|
</v-btn>
|
2022-03-21 20:34:34 +00:00
|
|
|
</v-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-03-21 23:47:11 +00:00
|
|
|
props: {
|
|
|
|
search: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
page: {
|
|
|
|
type: String,
|
|
|
|
default: "Home",
|
|
|
|
},
|
|
|
|
},
|
2022-05-14 21:20:44 +00:00
|
|
|
events: ["searchBtn", "textChanged", "closeSearch", "scrollToTop"],
|
2022-03-21 20:34:34 +00:00
|
|
|
data: () => ({
|
|
|
|
text: "",
|
2022-12-12 08:39:45 +00:00
|
|
|
presettings: false,
|
2022-03-21 20:34:34 +00:00
|
|
|
}),
|
2022-12-12 08:39:45 +00:00
|
|
|
watch: {
|
|
|
|
$route(next, prev) {
|
|
|
|
if (this.$route.path == "/settings" && !prev.name.includes("mods")) {
|
|
|
|
this.presettings = prev.path;
|
|
|
|
}
|
|
|
|
if (this.$route.path == "/search") {
|
|
|
|
this.text = this.$route.query.q;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2022-03-24 04:55:38 +00:00
|
|
|
methods: {
|
2022-12-12 08:39:45 +00:00
|
|
|
closeSettings() {
|
|
|
|
this.presettings
|
|
|
|
? this.$router.push(this.presettings)
|
|
|
|
: this.$router.go(-1);
|
|
|
|
this.presettings = false;
|
|
|
|
},
|
2022-03-24 04:55:38 +00:00
|
|
|
refreshRecommendations() {
|
|
|
|
this.$emit("scroll-to-top");
|
2022-04-04 16:07:10 +00:00
|
|
|
|
2022-04-01 01:02:08 +00:00
|
|
|
const continuations =
|
|
|
|
this.$store.state.recommendedVideos[
|
|
|
|
this.$store.state.recommendedVideos.length - 1
|
|
|
|
].continuations;
|
2022-03-24 04:55:38 +00:00
|
|
|
this.$store.commit("updateRecommendedVideos", []);
|
|
|
|
this.$youtube
|
2022-04-01 01:02:08 +00:00
|
|
|
.recommendContinuation(
|
|
|
|
continuations.find((element) => element.reloadContinuationData)
|
|
|
|
.reloadContinuationData.continuation,
|
2022-03-31 02:22:22 +00:00
|
|
|
"browse"
|
|
|
|
)
|
2022-03-24 04:55:38 +00:00
|
|
|
.then((result) => {
|
2022-04-01 01:02:08 +00:00
|
|
|
console.log(result);
|
|
|
|
if (result) this.$store.commit("updateRecommendedVideos", [result]);
|
2022-03-24 04:55:38 +00:00
|
|
|
})
|
2022-12-12 08:39:45 +00:00
|
|
|
.catch((error) => {
|
|
|
|
console.log(error);
|
|
|
|
});
|
2022-03-24 04:55:38 +00:00
|
|
|
},
|
|
|
|
},
|
2022-03-21 20:34:34 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.topNav {
|
2022-05-23 20:03:03 +00:00
|
|
|
/* opacity with hex, wow 😉 */
|
|
|
|
/* background: linear-gradient(var(--v-background-base) -1000%, #00000000 1000%); */
|
|
|
|
/* box-shadow: inset 0 0 5rem var(--v-background-base) !important; */
|
2022-05-13 06:20:15 +00:00
|
|
|
height: calc(4rem + env(safe-area-inset-top)) !important;
|
|
|
|
padding-top: env(safe-area-inset-top) !important;
|
2022-05-05 04:28:51 +00:00
|
|
|
box-shadow: none !important;
|
2022-03-21 20:34:34 +00:00
|
|
|
position: fixed;
|
|
|
|
width: 100%;
|
2022-05-13 06:20:15 +00:00
|
|
|
top: 0;
|
2022-03-21 20:34:34 +00:00
|
|
|
}
|
2022-04-04 15:42:42 +00:00
|
|
|
|
2022-03-21 20:34:34 +00:00
|
|
|
.topNavSearch {
|
|
|
|
margin-bottom: -10em;
|
|
|
|
margin-left: 2em;
|
|
|
|
}
|
|
|
|
</style>
|