From 258b1d68c6273a7ddbd6902e0cbfb1be07e19e4e Mon Sep 17 00:00:00 2001 From: okayurisotto <47853651+okayurisotto@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:49:36 +0900 Subject: [PATCH] =?UTF-8?q?frontend:=20=E3=83=AA=E3=83=A2=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=82=AF=E3=83=AA=E3=83=83=E3=83=97=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=81=AE=E9=80=A3=E5=90=88=E3=81=97=E3=81=AA=E3=81=84=E3=82=82?= =?UTF-8?q?=E3=81=AE=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84=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/user/index.vue | 67 +++++++--------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/packages/frontend/src/pages/user/index.vue b/packages/frontend/src/pages/user/index.vue index d862387401..50577e736e 100644 --- a/packages/frontend/src/pages/user/index.vue +++ b/packages/frontend/src/pages/user/index.vue @@ -94,51 +94,28 @@ watch(() => props.acct, fetchUser, { const headerActions = computed(() => []); -const headerTabs = computed(() => user.value ? [{ - key: 'home', - title: i18n.ts.overview, - icon: 'ti ti-home', -}, { - key: 'notes', - title: i18n.ts.notes, - icon: 'ti ti-pencil', -}, { - key: 'activity', - title: i18n.ts.activity, - icon: 'ti ti-chart-line', -}, ...(user.value.host == null ? [{ - key: 'achievements', - title: i18n.ts.achievements, - icon: 'ti ti-medal', -}] : []), ...($i && ($i.id === user.value.id || $i.isAdmin || $i.isModerator)) || user.value.publicReactions ? [{ - key: 'reactions', - title: i18n.ts.reaction, - icon: 'ti ti-mood-happy', -}] : [], { - key: 'clips', - title: i18n.ts.clips, - icon: 'ti ti-paperclip', -}, { - key: 'lists', - title: i18n.ts.lists, - icon: 'ti ti-list', -}, { - key: 'pages', - title: i18n.ts.pages, - icon: 'ti ti-news', -}, { - key: 'flashs', - title: 'Play', - icon: 'ti ti-player-play', -}, { - key: 'gallery', - title: i18n.ts.gallery, - icon: 'ti ti-icons', -}, { - key: 'raw', - title: 'Raw', - icon: 'ti ti-code', -}] : []); +const headerTabs = computed(() => { + if (user.value == null) return []; + + const isReactionsVisible = user.value.publicReactions || ($i && ($i.id === user.value.id || $i.isAdmin || $i.isModerator)); + const isLocalUser = user.value.host === null; + + return [ + { key: 'home', title: i18n.ts.overview, icon: 'ti ti-home' }, + { key: 'notes', title: i18n.ts.notes, icon: 'ti ti-pencil' }, + { key: 'activity', title: i18n.ts.activity, icon: 'ti ti-chart-line', }, + ...(isLocalUser ? [{ key: 'achievements', title: i18n.ts.achievements, icon: 'ti ti-medal' }] : []), + ...(isReactionsVisible ? [{ key: 'reactions', title: i18n.ts.reaction, icon: 'ti ti-mood-happy' }] : []), + ...(isLocalUser ? [ + { key: 'clips', title: i18n.ts.clips, icon: 'ti ti-paperclip' }, + { key: 'lists', title: i18n.ts.lists, icon: 'ti ti-list' }, + { key: 'pages', title: i18n.ts.pages, icon: 'ti ti-news' }, + { key: 'flashs', title: 'Play', icon: 'ti ti-player-play' }, + { key: 'gallery', title: i18n.ts.gallery, icon: 'ti ti-icons' }, + ] : []), + { key: 'raw', title: 'Raw', icon: 'ti ti-code' }, + ]; +}); definePageMetadata(() => ({ title: i18n.ts.user,