0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-06 11:35:07 +00:00
VueTube/NUXT/pages/index.vue

150 lines
3.8 KiB
Vue
Raw Normal View History

2022-01-24 22:56:57 +00:00
<template>
2022-03-31 21:26:53 +00:00
<center class="container">
2022-03-31 04:22:24 +00:00
<v-img
src="/icon.svg"
2022-03-31 04:22:24 +00:00
width="10rem"
height="10rem"
class="intro"
:class="$vuetify.theme.dark ? '' : 'invert'"
/>
2022-03-31 04:22:24 +00:00
<div style="height: 5rem" />
<v-progress-linear rounded height="8" indeterminate color="primary" />
<div class="pt-2">{{ progressMsg }}...</div>
</center>
2022-01-24 22:56:57 +00:00
</template>
2022-03-16 00:31:03 +00:00
<script>
export default {
layout: "empty",
2022-03-28 19:59:08 +00:00
data: () => ({
progressMsg: "...",
2022-03-28 19:59:08 +00:00
}),
async mounted() {
2022-06-20 13:53:06 +00:00
//--- Init Stuff ---//
this.progressMsg = this.$lang("index").connecting;
this.$store.commit("initTelemetryPreference");
2022-03-31 21:26:53 +00:00
this.$store.commit("tweaks/initTweaks");
2022-07-28 20:20:18 +00:00
this.$store.commit("player/initPlayer");
2022-06-15 00:08:45 +00:00
//--- Load Theming ---//
await this.theming();
//--- Update Screen ---//
if (
localStorage.getItem("lastRunVersion") != null &&
localStorage.getItem("lastRunVersion") != process.env.version
)
return this.$router.replace("/activities/update");
//--- Start Innertube Connection ---//
2022-06-15 00:08:45 +00:00
await this.$youtube.getAPI();
await this.$vuetube.launchBackHandling();
this.progressMsg = this.$lang("index").launching;
if (localStorage.getItem("firstTimeSetupComplete")) {
this.$router.replace("/" + (localStorage.getItem("startPage") || "home")); // Normal Load
} else {
this.$router.replace("/activities/install"); // Load Into Setup
}
2022-06-15 00:08:45 +00:00
},
methods: {
theming() {
return new Promise((resolve) =>
// Set timeout is required for $vuetify.theme... dont ask me why -Front
setTimeout(() => {
this.$vuetify.theme.dark =
JSON.parse(localStorage.getItem("darkTheme")) === true;
if (localStorage.getItem("primaryDark") != null)
this.$vuetify.theme.themes.dark.primary =
localStorage.getItem("primaryDark");
if (localStorage.getItem("primaryLight") != null)
this.$vuetify.theme.themes.light.primary =
localStorage.getItem("primaryLight");
if (localStorage.getItem("backgroundDark") != null)
this.$vuetify.theme.themes.dark.background =
localStorage.getItem("backgroundDark");
if (localStorage.getItem("backgroundLight") != null)
this.$vuetify.theme.themes.light.background =
localStorage.getItem("backgroundLight");
2022-05-04 23:09:17 +00:00
this.$vuetube.navigationBar.setTheme(
this.$vuetify.theme.currentTheme.background,
!this.$vuetify.theme.dark
);
this.$vuetube.statusBar.setTheme(
this.$vuetify.theme.currentTheme.background,
this.$vuetify.theme.dark
);
// this.$vuetube.navigationBar.setTransparent();
// this.$vuetube.statusBar.setTransparent();
resolve();
}, 0)
);
},
},
};
</script>
2022-04-15 03:14:52 +00:00
<style>
.intro {
2022-03-31 04:22:24 +00:00
opacity: 0;
transform: scale(0.5);
transition-property: opacity, transform;
animation: bounce 0.66s 0.5s ease 1 forwards;
2022-03-31 04:22:24 +00:00
}
/* triangles aren't very good at spinning :c */
@keyframes bounce {
2022-03-31 04:22:24 +00:00
0% {
opacity: 0;
transform: scale(0.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
/* reduced-motion animations */
@media (prefers-reduced-motion) {
.intro {
opacity: 0;
transform: scale(1);
transition-property: opacity, transform;
animation: fadein 0.5s ease 1 forwards;
}
}
2022-04-15 03:14:52 +00:00
/* page transition */
.slide-up-enter-active,
.slide-up-leave-active,
.slide-down-enter-active,
.slide-down-leave-active {
transition-duration: 0.1s;
transition-property: opacity, transform;
/* overflow: hidden; */
}
.slide-up-enter,
.slide-down-leave-active {
opacity: 0;
transform: translateY(3rem);
}
.slide-up-leave-active,
.slide-down-enter {
opacity: 0;
transform: translateY(-1rem);
}
</style>