Attempt to use tiptap for view, failing due to https://github.com/ueberdosis/tiptap/issues/5176

This commit is contained in:
Jon Staab
2024-09-24 10:56:42 -07:00
parent d7dba6c61a
commit 256a70d6fb
7 changed files with 41 additions and 34 deletions
+27
View File
@@ -0,0 +1,27 @@
<script lang="ts">
import {fromPairs} from "@welshman/lib"
import {getAddress} from "@welshman/util"
import {secondsToDate, getLocale, formatTimestamp, formatTimestampAsDate} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
export let event
const timeFmt = new Intl.DateTimeFormat(getLocale(), {timeStyle: "short"})
$: meta = fromPairs(event.tags) as Record<string, string>
$: end = parseInt(meta.end)
$: start = parseInt(meta.start)
$: startDate = secondsToDate(start)
$: endDate = secondsToDate(end)
$: startDateDisplay = formatTimestampAsDate(start)
$: endDateDisplay = formatTimestampAsDate(end)
$: isSingleDay = startDateDisplay === endDateDisplay
</script>
<div class="card2 flex items-center justify-between gap-2">
<span>{meta.title || meta.name}</span>
<div class="flex items-center gap-2 text-sm">
<Icon icon="clock-circle" size={4} />
{timeFmt.format(startDate)}{isSingleDay ? timeFmt.format(endDate) : formatTimestamp(end)}
</div>
</div>