feat: resolve status paths with router (#258)
This commit is contained in:
parent
24bbe9135b
commit
4ed1816806
22 changed files with 106 additions and 50 deletions
|
@ -30,13 +30,13 @@ function onclick(evt: MouseEvent | KeyboardEvent) {
|
|||
}
|
||||
|
||||
function go(evt: MouseEvent | KeyboardEvent) {
|
||||
const path = getStatusPath(status)
|
||||
const route = getStatusRoute(status)
|
||||
if (evt.metaKey || evt.ctrlKey) {
|
||||
window.open(path)
|
||||
window.open(route.href)
|
||||
}
|
||||
else {
|
||||
cacheStatus(status)
|
||||
router.push(path)
|
||||
router.push(route)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ const timeago = useTimeAgo(() => status.createdAt, timeAgoOptions)
|
|||
<div flex gap-4>
|
||||
<div>
|
||||
<AccountHoverWrapper :account="status.account">
|
||||
<NuxtLink :to="getAccountPath(status.account)" rounded-full>
|
||||
<NuxtLink :to="getAccountRoute(status.account)" rounded-full>
|
||||
<AccountAvatar w-12 h-12 :account="status.account" />
|
||||
</NuxtLink>
|
||||
</AccountHoverWrapper>
|
||||
|
@ -70,7 +70,7 @@ const timeago = useTimeAgo(() => status.createdAt, timeAgoOptions)
|
|||
<div flex-auto />
|
||||
<div text-sm text-secondary flex="~ row nowrap" hover:underline>
|
||||
<CommonTooltip :content="createdAt">
|
||||
<a :title="status.createdAt" :href="getStatusPath(status)" @click.prevent="go($event)">
|
||||
<a :title="status.createdAt" :href="getStatusRoute(status).href" @click.prevent="go($event)">
|
||||
<time text-sm hover:underline :datetime="status.createdAt">
|
||||
{{ timeago }}
|
||||
</time>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue