fix: make notification timestamp gray and use <time> tag (#3223)

This commit is contained in:
TAKAHASHI Shuuji 2025-03-21 02:44:25 +09:00 committed by GitHub
parent 2d4a1cfef1
commit e20815b84c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 11 deletions

View file

@ -51,7 +51,10 @@ const timeAgo = useTimeAgo(() => notification.createdAt, timeAgoOptions)
<div i-ri-user-3-line text-xl me-3 color-blue /> <div i-ri-user-3-line text-xl me-3 color-blue />
<AccountDisplayName :account="notification.account" text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all /> <AccountDisplayName :account="notification.account" text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all />
<span ws-nowrap> <span ws-nowrap>
{{ $t('notification.followed_you') }}{{ timeAgo }} {{ $t('notification.followed_you') }}
<time text-secondary :datetime="notification.createdAt">
{{ timeAgo }}
</time>
</span> </span>
</div> </div>
<AccountBigCard <AccountBigCard
@ -68,7 +71,11 @@ const timeAgo = useTimeAgo(() => notification.createdAt, timeAgoOptions)
:account="notification.account" :account="notification.account"
text-purple me-1 font-bold line-clamp-1 ws-pre-wrap break-all text-purple me-1 font-bold line-clamp-1 ws-pre-wrap break-all
/> />
<span>{{ $t("notification.signed_up") }}{{ timeAgo }}</span> <span>{{ $t("notification.signed_up") }}
<time text-secondary :datetime="notification.createdAt">
{{ timeAgo }}
</time>
</span>
</div> </div>
</NuxtLink> </NuxtLink>
</template> </template>
@ -97,7 +104,10 @@ const timeAgo = useTimeAgo(() => notification.createdAt, timeAgoOptions)
text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all
/> />
<span me-1 ws-nowrap> <span me-1 ws-nowrap>
{{ $t('notification.request_to_follow') }}{{ timeAgo }} {{ $t('notification.request_to_follow') }}
<time text-secondary :datetime="notification.createdAt">
{{ timeAgo }}
</time>
</span> </span>
</div> </div>
<AccountCard p="s-2 e-4 b-2" hover-card :account="notification.account"> <AccountCard p="s-2 e-4 b-2" hover-card :account="notification.account">
@ -111,7 +121,10 @@ const timeAgo = useTimeAgo(() => notification.createdAt, timeAgoOptions)
<div i-ri:edit-2-fill text-xl me-1 text-secondary /> <div i-ri:edit-2-fill text-xl me-1 text-secondary />
<AccountInlineInfo :account="notification.account" me1 /> <AccountInlineInfo :account="notification.account" me1 />
<span ws-nowrap> <span ws-nowrap>
{{ $t('notification.update_status') }}{{ timeAgo }} {{ $t('notification.update_status') }}
<time text-secondary :datetime="notification.createdAt">
{{ timeAgo }}
</time>
</span> </span>
</div> </div>
</template> </template>

View file

@ -16,7 +16,8 @@ const lang = computed(() => {
}) })
const timeAgoOptions = useTimeAgoOptions(true) const timeAgoOptions = useTimeAgoOptions(true)
const timeAgo = useTimeAgo(() => follows.value[0].createdAt, timeAgoOptions) const timeAgoCreatedAt = computed(() => follows.value[0].createdAt)
const timeAgo = useTimeAgo(() => timeAgoCreatedAt.value, timeAgoOptions)
</script> </script>
<template> <template>
@ -40,7 +41,10 @@ const timeAgo = useTimeAgo(() => follows.value[0].createdAt, timeAgoOptions)
:count="count - 1" :count="count - 1"
text-primary font-bold line-clamp-1 ws-pre-wrap break-all text-primary font-bold line-clamp-1 ws-pre-wrap break-all
/> />
&nbsp;{{ $t('notification.followed_you') }}{{ timeAgo }} &nbsp;{{ $t('notification.followed_you') }}
<time text-secondary :datetime="timeAgoCreatedAt">
{{ timeAgo }}
</time>
</template> </template>
<template v-else-if="count === 1"> <template v-else-if="count === 1">
<NuxtLink :to="getAccountRoute(follows[0].account)"> <NuxtLink :to="getAccountRoute(follows[0].account)">
@ -50,7 +54,10 @@ const timeAgo = useTimeAgo(() => follows.value[0].createdAt, timeAgoOptions)
/> />
</NuxtLink> </NuxtLink>
<span me-1 ws-nowrap> <span me-1 ws-nowrap>
{{ $t('notification.followed_you') }}{{ timeAgo }} {{ $t('notification.followed_you') }}
<time text-secondary :datetime="timeAgoCreatedAt">
{{ timeAgo }}
</time>
</span> </span>
</template> </template>
</div> </div>

View file

@ -10,8 +10,10 @@ const reblogs = computed(() => group.likes.filter(i => i.reblog))
const likes = computed(() => group.likes.filter(i => i.favourite && !i.reblog)) const likes = computed(() => group.likes.filter(i => i.favourite && !i.reblog))
const timeAgoOptions = useTimeAgoOptions(true) const timeAgoOptions = useTimeAgoOptions(true)
const reblogsTimeAgo = useTimeAgo(() => reblogs.value[0].reblog?.createdAt ?? '', timeAgoOptions) const reblogsTimeAgoCreatedAt = computed(() => reblogs.value[0].reblog?.createdAt)
const likesTimeAgo = useTimeAgo(() => likes.value[0].favourite?.createdAt ?? '', timeAgoOptions) const reblogsTimeAgo = useTimeAgo(() => reblogsTimeAgoCreatedAt.value ?? '', timeAgoOptions)
const likesTimeAgoCreatedAt = computed(() => likes.value[0].favourite?.createdAt)
const likesTimeAgo = useTimeAgo(() => likesTimeAgoCreatedAt.value ?? '', timeAgoOptions)
</script> </script>
<template> <template>
@ -28,7 +30,10 @@ const likesTimeAgo = useTimeAgo(() => likes.value[0].favourite?.createdAt ?? '',
</AccountHoverWrapper> </AccountHoverWrapper>
</template> </template>
<div ml1> <div ml1>
{{ $t('notification.reblogged_post') }}{{ reblogsTimeAgo }} {{ $t('notification.reblogged_post') }}
<time text-secondary :datetime="reblogsTimeAgoCreatedAt">
{{ reblogsTimeAgo }}
</time>
</div> </div>
</div> </div>
<div v-if="likes.length" flex="~ gap-1 wrap"> <div v-if="likes.length" flex="~ gap-1 wrap">
@ -41,7 +46,10 @@ const likesTimeAgo = useTimeAgo(() => likes.value[0].favourite?.createdAt ?? '',
</AccountHoverWrapper> </AccountHoverWrapper>
</template> </template>
<div ms-4> <div ms-4>
{{ $t('notification.favourited_post') }} {{ likesTimeAgo }} {{ $t('notification.favourited_post') }}
<time text-secondary :datetime="likesTimeAgoCreatedAt">
{{ likesTimeAgo }}
</time>
</div> </div>
</div> </div>
</div> </div>