chore(client): tweak user-info routing

This commit is contained in:
syuilo 2022-07-16 16:52:12 +09:00
parent 274bfc965f
commit e9fd064624
3 changed files with 5 additions and 9 deletions

View file

@ -155,7 +155,7 @@ const age = $computed(() => {
}); });
function menu(ev) { function menu(ev) {
os.popupMenu(getUserMenu(props.user), ev.currentTarget ?? ev.target); os.popupMenu(getUserMenu(props.user, router), ev.currentTarget ?? ev.target);
} }
function parallaxLoop() { function parallaxLoop() {

View file

@ -23,7 +23,6 @@ import calcAge from 's-age';
import * as Acct from 'misskey-js/built/acct'; import * as Acct from 'misskey-js/built/acct';
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
import { getScrollPosition } from '@/scripts/scroll'; import { getScrollPosition } from '@/scripts/scroll';
import { getUserMenu } from '@/scripts/get-user-menu';
import number from '@/filters/number'; import number from '@/filters/number';
import { userPage, acct as getAcct } from '@/filters/user'; import { userPage, acct as getAcct } from '@/filters/user';
import * as os from '@/os'; import * as os from '@/os';
@ -65,10 +64,6 @@ watch(() => props.acct, fetchUser, {
immediate: true, immediate: true,
}); });
function menu(ev) {
os.popupMenu(getUserMenu(user), ev.currentTarget ?? ev.target);
}
const headerActions = $computed(() => []); const headerActions = $computed(() => []);
const headerTabs = $computed(() => user ? [{ const headerTabs = $computed(() => user ? [{

View file

@ -7,8 +7,9 @@ import * as os from '@/os';
import { userActions } from '@/store'; import { userActions } from '@/store';
import { $i, iAmModerator } from '@/account'; import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router'; 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; const meId = $i ? $i.id : null;
async function pushList() { async function pushList() {
@ -161,7 +162,7 @@ export function getUserMenu(user) {
icon: 'fas fa-info-circle', icon: 'fas fa-info-circle',
text: i18n.ts.info, text: i18n.ts.info,
action: () => { action: () => {
os.pageWindow(`/user-info/${user.id}`); router.push(`/user-info/${user.id}`);
}, },
}, { }, {
icon: 'fas fa-envelope', icon: 'fas fa-envelope',
@ -227,7 +228,7 @@ export function getUserMenu(user) {
icon: 'fas fa-pencil-alt', icon: 'fas fa-pencil-alt',
text: i18n.ts.editProfile, text: i18n.ts.editProfile,
action: () => { action: () => {
mainRouter.push('/settings/profile'); router.push('/settings/profile');
}, },
}]); }]);
} }