From 3bf775c9a8c9aadf8e8c5e7e8a1cbae5e168f2d9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 21 Jan 2023 16:57:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E5=AE=9F=E7=B8=BE=E4=B8=80=E8=A6=A7=E3=82=92=E8=A6=8B=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/pages/achievements.vue | 14 +++-- .../frontend/src/pages/user/achievements.vue | 52 +++++++++++++++++++ packages/frontend/src/pages/user/index.vue | 8 ++- 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 packages/frontend/src/pages/user/achievements.vue diff --git a/packages/frontend/src/pages/achievements.vue b/packages/frontend/src/pages/achievements.vue index 3cec8f630..14b852069 100644 --- a/packages/frontend/src/pages/achievements.vue +++ b/packages/frontend/src/pages/achievements.vue @@ -15,7 +15,7 @@ import { definePageMetadata } from '@/scripts/page-metadata'; import { $i } from '@/account'; import { claimAchievement } from '@/scripts/achievements'; -let timer; +let timer: number | null; function viewAchievements3min() { claimAchievement('viewAchievements3min'); @@ -26,8 +26,10 @@ onMounted(() => { }); onUnmounted(() => { - window.clearTimeout(timer); - timer = null; + if (timer != null) { + window.clearTimeout(timer); + timer = null; + } }); onActivated(() => { @@ -35,8 +37,10 @@ onActivated(() => { }); onDeactivated(() => { - window.clearTimeout(timer); - timer = null; + if (timer != null) { + window.clearTimeout(timer); + timer = null; + } }); definePageMetadata({ diff --git a/packages/frontend/src/pages/user/achievements.vue b/packages/frontend/src/pages/user/achievements.vue new file mode 100644 index 000000000..eaea26db4 --- /dev/null +++ b/packages/frontend/src/pages/user/achievements.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/packages/frontend/src/pages/user/index.vue b/packages/frontend/src/pages/user/index.vue index 7abae1ea3..d63aa3a3a 100644 --- a/packages/frontend/src/pages/user/index.vue +++ b/packages/frontend/src/pages/user/index.vue @@ -6,6 +6,7 @@
+ @@ -34,6 +35,7 @@ import { $i } from '@/account'; const XHome = defineAsyncComponent(() => import('./home.vue')); const XActivity = defineAsyncComponent(() => import('./activity.vue')); +const XAchievements = defineAsyncComponent(() => import('./achievements.vue')); const XReactions = defineAsyncComponent(() => import('./reactions.vue')); const XClips = defineAsyncComponent(() => import('./clips.vue')); const XPages = defineAsyncComponent(() => import('./pages.vue')); @@ -76,7 +78,11 @@ const headerTabs = $computed(() => user ? [{ key: 'activity', title: i18n.ts.activity, icon: 'ti ti-chart-line', -}, ...($i && ($i.id === user.id)) || user.publicReactions ? [{ +}, ...(user.host == null ? [{ + key: 'achievements', + title: i18n.ts.achievements, + icon: 'ti ti-military-award', +}] : []), ...($i && ($i.id === user.id)) || user.publicReactions ? [{ key: 'reactions', title: i18n.ts.reaction, icon: 'ti ti-mood-happy',