mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-02-08 23:05:51 +01:00
fix: add type annotations for improved type safety in Activity.vue
This commit is contained in:
@@ -21,7 +21,7 @@ const codingActivity = computed(() => {
|
|||||||
: activities[0]
|
: activities[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentLocale = computed(() => locales.value.find(l => l.code === locale.value))
|
const currentLocale = computed(() => locales.value.find((l: { code: string }) => l.code === locale.value))
|
||||||
|
|
||||||
const isActive = computed(() => {
|
const isActive = computed(() => {
|
||||||
if (!codingActivity.value)
|
if (!codingActivity.value)
|
||||||
@@ -52,7 +52,7 @@ const getActivity = computed(() => {
|
|||||||
|
|
||||||
const stateWord = state && state.split(' ').length >= 2 ? state.split(' ')[1] : t('secret')
|
const stateWord = state && state.split(' ').length >= 2 ? state.split(' ')[1] : t('secret')
|
||||||
const ago = useTimeAgo(timestamps.start, {
|
const ago = useTimeAgo(timestamps.start, {
|
||||||
messages: activityMessages[locale.value] as UseTimeAgoMessages,
|
messages: activityMessages[locale.value as keyof typeof activityMessages] as UseTimeAgoMessages,
|
||||||
}).value
|
}).value
|
||||||
const formatDate = (date: number, format: string) => useDateFormat(date, format, { locales: currentLocale.value?.code ?? 'en' }).value
|
const formatDate = (date: number, format: string) => useDateFormat(date, format, { locales: currentLocale.value?.code ?? 'en' }).value
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ const getActivity = computed(() => {
|
|||||||
tag="div"
|
tag="div"
|
||||||
>
|
>
|
||||||
<template #state>
|
<template #state>
|
||||||
<strong>{{ getActivity.state!.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ') }}</strong>
|
<strong>{{ getActivity.state!.split(' ').map((word: string) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ') }}</strong>
|
||||||
</template>
|
</template>
|
||||||
<template #project>
|
<template #project>
|
||||||
<i>{{ getActivity.project.replaceAll('Editing', '') }}</i>
|
<i>{{ getActivity.project.replaceAll('Editing', '') }}</i>
|
||||||
|
|||||||
Reference in New Issue
Block a user