From f674f28921e93eaac1b52e080d482c047f7d4170 Mon Sep 17 00:00:00 2001 From: adb-sh Date: Wed, 2 Nov 2022 00:58:04 +0100 Subject: [PATCH] Debug frontend --- nginx.conf | 10 ++-- src/Api.ts | 4 +- src/components/DarkmodeToggle.vue | 5 +- src/components/PromiseResolver.vue | 33 ++++++++--- src/components/TrackProgressBar.vue | 8 ++- src/main.scss | 13 ++++ src/router/index.ts | 2 +- src/views/MePage.vue | 92 ++++++++++++++++++++++------- 8 files changed, 125 insertions(+), 42 deletions(-) diff --git a/nginx.conf b/nginx.conf index fe447e2..6b014d5 100644 --- a/nginx.conf +++ b/nginx.conf @@ -79,11 +79,11 @@ http { location / { - index index.html; - root /var/www/html; - try_files $uri $uri/ /index.html; - #proxy_set_header "Host" "127.0.0.1:8080"; - #proxy_pass http://frontend:8080; + #index index.html; + #root /var/www/html; + #try_files $uri $uri/ /index.html; + proxy_set_header "Host" "127.0.0.1:8080"; + proxy_pass http://frontend:8080; } location /api/public { diff --git a/src/Api.ts b/src/Api.ts index 1c38917..217e52c 100644 --- a/src/Api.ts +++ b/src/Api.ts @@ -57,10 +57,10 @@ export class Api { return (await this.axios.get(`/test`))?.data; } async getRole() { - return (await this.axios.get(`/user/role`))?.data; + return (await this.axios.get(`/me/role`))?.data; } async getCurrentlyPlaying() { - return (await this.axios.get(`/user/currentlyPlaying`))?.data; + return (await this.axios.get(`/me/currentlyPlaying`))?.data; } async getUserInfo(userId: string) { diff --git a/src/components/DarkmodeToggle.vue b/src/components/DarkmodeToggle.vue index c2b4af4..773bda3 100644 --- a/src/components/DarkmodeToggle.vue +++ b/src/components/DarkmodeToggle.vue @@ -11,7 +11,10 @@ import { ref, watch } from 'vue'; import { themeConfig } from '@/main'; -const sliderState = ref(themeConfig.getTheme() === 'dark'); +let currentTheme; +currentTheme = themeConfig.getTheme() === 'dark' + +const sliderState = ref(currentTheme); watch(sliderState, (state) => { themeConfig.setTheme(state ? 'dark' : 'light'); diff --git a/src/components/PromiseResolver.vue b/src/components/PromiseResolver.vue index a3e942c..9381d55 100644 --- a/src/components/PromiseResolver.vue +++ b/src/components/PromiseResolver.vue @@ -8,18 +8,26 @@ :data="getter(data)" :update="update" /> - +
{{ error.message || 'Oops! Something went wrong :/' }}
- -
-
- + + +
+
+
+ +
-
-
+ +
@@ -57,6 +65,7 @@ const update = async (promise: Promise | unknown) => { data.value = await (promise.isPromiseList ? Promise.all(promise.promises) : promise); + error.value = null; } catch (e) { error.value = e; } finally { @@ -83,8 +92,6 @@ watch(() => props.promise, (to) => { width: 100%; height: 100%; min-height: 5rem; - background-color: #fffd; - z-index: 9000; .wrapper { position: sticky; display: flex; @@ -93,6 +100,14 @@ watch(() => props.promise, (to) => { top: 0; height: 100%; max-height: 100vh; + .background { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + opacity: 0.9; + } } } } diff --git a/src/components/TrackProgressBar.vue b/src/components/TrackProgressBar.vue index d7483df..994c7c9 100644 --- a/src/components/TrackProgressBar.vue +++ b/src/components/TrackProgressBar.vue @@ -30,13 +30,17 @@ onBeforeUnmount(() => { class="progress-bar" role="progressbar" :style="{ - width: `${ estimatedProgress / duration * 100 }%` + width: `${ Math.min(estimatedProgress / duration, 1) * 100 }%` }" />
- +
diff --git a/src/main.scss b/src/main.scss index 2abf11c..c52ec80 100644 --- a/src/main.scss +++ b/src/main.scss @@ -11,3 +11,16 @@ html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + +.fade-enter-active, .fade-leave-active { + transition-property: opacity; + transition-duration: .25s; +} + +.fade-enter-active { + transition-delay: .25s; +} + +.fade-enter, .fade-leave-active { + opacity: 0 +} diff --git a/src/router/index.ts b/src/router/index.ts index 67e308d..de63893 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -23,7 +23,7 @@ const routes: Array = [ component: () => import(/* webpackChunkName: "me" */ "../views/MePage.vue"), meta: { - requireAuth: false, + requireAuth: true, }, }, { diff --git a/src/views/MePage.vue b/src/views/MePage.vue index 26480f3..d7db516 100644 --- a/src/views/MePage.vue +++ b/src/views/MePage.vue @@ -1,37 +1,85 @@ - +