1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 04:15:55 +02:00

enhance(frontend): typed nirax (#16309)

* enhance(frontend): typed nirax

* migrate router.replace

* fix
This commit is contained in:
かっこかり
2025-07-30 12:30:35 +09:00
committed by GitHub
parent b660769288
commit 4f653f2fbc
29 changed files with 308 additions and 52 deletions

View File

@@ -158,7 +158,11 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router
icon: 'ti ti-user-exclamation',
text: i18n.ts.moderation,
action: () => {
router.push(`/admin/user/${user.id}`);
router.push('/admin/user/:userId', {
params: {
userId: user.id,
},
});
},
}, { type: 'divider' });
}
@@ -216,7 +220,12 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router
icon: 'ti ti-search',
text: i18n.ts.searchThisUsersNotes,
action: () => {
router.push(`/search?username=${encodeURIComponent(user.username)}${user.host != null ? '&host=' + encodeURIComponent(user.host) : ''}`);
router.push('/search', {
query: {
username: user.username,
host: user.host ?? undefined,
},
});
},
});
}

View File

@@ -19,12 +19,16 @@ export async function lookup(router?: Router) {
if (canceled || query.length <= 1) return;
if (query.startsWith('@') && !query.includes(' ')) {
_router.push(`/${query}`);
_router.pushByPath(`/${query}`);
return;
}
if (query.startsWith('#')) {
_router.push(`/tags/${encodeURIComponent(query.substring(1))}`);
_router.push('/tags/:tag', {
params: {
tag: query.substring(1),
}
});
return;
}
@@ -32,9 +36,17 @@ export async function lookup(router?: Router) {
const res = await apLookup(query);
if (res.type === 'User') {
_router.push(`/@${res.object.username}@${res.object.host}`);
_router.push('/@:acct/:page?', {
params: {
acct: `${res.object.username}@${res.object.host}`,
},
});
} else if (res.type === 'Note') {
_router.push(`/notes/${res.object.id}`);
_router.push('/notes/:noteId/:initialTab?', {
params: {
noteId: res.object.id,
},
});
}
return;