You've already forked AstralRinth
forked from didirus/AstralRinth
b005c1f522
* New project card * no shadow on icons * Remove updated label * reduce tag count to 5 * improve envs * fix: project card bottom row not growing * move actions in grid mode * focus changes + new project list component * Allow more tags in grid mode, deprioritize non-loader tags * fix prod deploy robots.txt * remove unused id * App cards * prepr * publish date + fix router links * fix author hover underline in firefox * perf: preload on search item hover * remove unused filter * remove option for old grid view --------- Co-authored-by: tdgao <mr.trumgao@gmail.com> Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
48 lines
1.2 KiB
Vue
48 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { CalendarIcon, HistoryIcon } from '@modrinth/assets'
|
|
import { capitalizeString } from '@modrinth/utils'
|
|
import dayjs from 'dayjs'
|
|
import { computed } from 'vue'
|
|
|
|
import { useRelativeTime, useVIntl } from '../../../composables'
|
|
|
|
const { formatMessage } = useVIntl()
|
|
|
|
const formatRelativeTime = useRelativeTime()
|
|
|
|
const props = defineProps<{
|
|
date: Date
|
|
type: 'updated' | 'published'
|
|
}>()
|
|
|
|
const formattedDate = computed(() => dayjs(props.date).format('MMMM D, YYYY [at] h:mm A'))
|
|
|
|
const types = {
|
|
updated: {
|
|
icon: HistoryIcon,
|
|
tooltip: {
|
|
id: 'project-card.date.updated.tooltip',
|
|
defaultMessage: 'Updated {date}',
|
|
},
|
|
},
|
|
published: {
|
|
icon: CalendarIcon,
|
|
tooltip: {
|
|
id: 'project-card.date.published.tooltip',
|
|
defaultMessage: 'Published {date}',
|
|
},
|
|
},
|
|
}
|
|
|
|
const tooltip = computed(() =>
|
|
capitalizeString(formatMessage(types[props.type].tooltip, { date: formattedDate.value })),
|
|
)
|
|
</script>
|
|
|
|
<template>
|
|
<div v-tooltip="tooltip" class="flex items-center gap-2 smart-clickable:allow-pointer-events">
|
|
<component :is="types[props.type].icon" class="size-5 shrink-0" />
|
|
{{ capitalizeString(formatRelativeTime(date)) }}
|
|
</div>
|
|
</template>
|