0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-23 03:35:15 +00:00
VueTube/NUXT/components/topNavigation.vue

129 lines
3 KiB
Vue
Raw Normal View History

<template>
<v-card
2022-05-04 23:09:17 +00:00
scroll-off-screen
style="height: 4rem !important; display: flex"
class="rounded-0 pa-3 topNav background"
2022-05-05 23:09:28 +00:00
>
<!-- :style="
2022-05-04 23:09:17 +00:00
$vuetify.theme.dark
? 'border-bottom: 1px solid var(--v-background-lighten1) !important;'
: 'border-bottom: 1px solid var(--v-background-darken1) !important;'
2022-05-05 23:09:28 +00:00
" -->
2022-03-21 23:47:11 +00:00
<h3 v-show="!search" class="my-auto ml-4" v-text="page" />
2022-03-21 23:47:11 +00:00
<v-btn
v-if="search"
icon
class="mr-3 my-auto"
@click="$emit('close-search')"
>
<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"
solo
dense
flat
label="Search"
2022-03-25 19:21:00 +00:00
style="margin-top: 1px"
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)"
/>
<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>
<v-btn
icon
tile
2022-03-21 21:01:37 +00:00
class="ml-3 my-auto fill-height"
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>
<v-btn
2022-03-21 23:47:11 +00:00
v-show="!search"
icon
tile
class="ml-4 mr-2 my-auto fill-height"
style="border-radius: 0.25rem !important"
to="/settings"
>
2022-04-04 15:42:42 +00:00
<v-icon>mdi-cog-outline</v-icon>
</v-btn>
</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",
},
},
events: ["searchBtn", "textChanged", "closeSearch"],
data: () => ({
text: "",
}),
2022-03-24 04:55:38 +00:00
methods: {
refreshRecommendations() {
this.$emit("scroll-to-top");
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
.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) => {
console.log(result);
if (result) this.$store.commit("updateRecommendedVideos", [result]);
2022-03-24 04:55:38 +00:00
})
.catch((error) => this.$logger("Home Page (Nav Refresh)", error, true));
},
},
};
</script>
<style scoped>
.topNav {
2022-05-04 23:09:17 +00:00
/* box-shadow: inset 0 1rem 10rem var(--v-background-base) !important; */
2022-05-05 04:28:51 +00:00
box-shadow: none !important;
/* ios notch */
top: env(safe-area-inset-top) !important;
position: fixed;
width: 100%;
}
2022-04-04 15:42:42 +00:00
.topNavSearch {
margin-bottom: -10em;
margin-left: 2em;
}
</style>