feat: [3/6]: add basic piefed event UI

This commit is contained in:
Xylight committed 2025-11-14 15:03:29 -08:00
1 parent 90d7ac17ff
commit 6f7501ffc5
5 files changed
+114 -18

No files matched your search

+4 -5
View File
@@ -40,11 +40,10 @@
distinct: 'material-distinct',
transparent: 'material-transparent',
uniform: 'material-uniform',
none: '',
}
const interactiveClass = {
interactive: 'material-int',
info: 'material-info',
warning: 'material-warning',
success: 'material-success',
error: 'material-error',
none: '',
}
+5 -2
View File
@@ -7,6 +7,7 @@
options: Intl.RelativeTimeFormatOptions,
locale?: string,
relativeTo?: Date,
absolute?: boolean,
) {
try {
const now = relativeTo?.getTime() ?? Date.now()
@@ -29,7 +30,7 @@
let language = locale ?? 'en'
if (settings.absoluteDates) {
if (absolute) {
const rtf = new Intl.DateTimeFormat(language, {
...options,
timeStyle: 'short',
@@ -62,6 +63,7 @@
date: Date
relativeTo?: Date | undefined
options?: Intl.RelativeTimeFormatOptions
absolute?: boolean
style?: string
class?: string
}
@@ -73,6 +75,7 @@
numeric: 'always',
style: 'narrow',
},
absolute = settings.absoluteDates,
style = '',
class: clazz = '',
}: Props = $props()
@@ -81,5 +84,5 @@
</script>
<time datetime={dateTime} title={dateTime} class={clazz} {style}>
{formatRelativeDate(date, options, $locale, relativeTo)}
{formatRelativeDate(date, options, $locale, relativeTo, absolute)}
</time>