From e9fd06462491be7d487e468020e806ed830cd40c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Jul 2022 16:52:12 +0900 Subject: [PATCH] chore(client): tweak user-info routing --- packages/client/src/pages/user/home.vue | 2 +- packages/client/src/pages/user/index.vue | 5 ----- packages/client/src/scripts/get-user-menu.ts | 7 ++++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/client/src/pages/user/home.vue b/packages/client/src/pages/user/home.vue index f7c25f077..c28079bb3 100644 --- a/packages/client/src/pages/user/home.vue +++ b/packages/client/src/pages/user/home.vue @@ -155,7 +155,7 @@ const age = $computed(() => { }); function menu(ev) { - os.popupMenu(getUserMenu(props.user), ev.currentTarget ?? ev.target); + os.popupMenu(getUserMenu(props.user, router), ev.currentTarget ?? ev.target); } function parallaxLoop() { diff --git a/packages/client/src/pages/user/index.vue b/packages/client/src/pages/user/index.vue index 99c341388..4b07beeb8 100644 --- a/packages/client/src/pages/user/index.vue +++ b/packages/client/src/pages/user/index.vue @@ -23,7 +23,6 @@ import calcAge from 's-age'; import * as Acct from 'misskey-js/built/acct'; import * as misskey from 'misskey-js'; import { getScrollPosition } from '@/scripts/scroll'; -import { getUserMenu } from '@/scripts/get-user-menu'; import number from '@/filters/number'; import { userPage, acct as getAcct } from '@/filters/user'; import * as os from '@/os'; @@ -65,10 +64,6 @@ watch(() => props.acct, fetchUser, { immediate: true, }); -function menu(ev) { - os.popupMenu(getUserMenu(user), ev.currentTarget ?? ev.target); -} - const headerActions = $computed(() => []); const headerTabs = $computed(() => user ? [{ diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index 25bcd90e9..c609fddd5 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -7,8 +7,9 @@ import * as os from '@/os'; import { userActions } from '@/store'; import { $i, iAmModerator } from '@/account'; import { mainRouter } from '@/router'; +import { Router } from '@/nirax'; -export function getUserMenu(user) { +export function getUserMenu(user, router: Router = mainRouter) { const meId = $i ? $i.id : null; async function pushList() { @@ -161,7 +162,7 @@ export function getUserMenu(user) { icon: 'fas fa-info-circle', text: i18n.ts.info, action: () => { - os.pageWindow(`/user-info/${user.id}`); + router.push(`/user-info/${user.id}`); }, }, { icon: 'fas fa-envelope', @@ -227,7 +228,7 @@ export function getUserMenu(user) { icon: 'fas fa-pencil-alt', text: i18n.ts.editProfile, action: () => { - mainRouter.push('/settings/profile'); + router.push('/settings/profile'); }, }]); }