]> git.r.bdr.sh - rbdr/forum/blob - src/lib/components/topic_summary/topic_summary.svelte
8c4df4d7502be2827f0ed4a5cb8e1d26173e9e2d
[rbdr/forum] / src / lib / components / topic_summary / topic_summary.svelte
1 <script lang="ts">
2 import type { Topic } from '$lib/data/types';
3
4 export let topic: Topic;
5
6 import { _ } from 'svelte-i18n';
7 import { readableTime } from '$lib/utils/readable_time';
8
9 $: remainingTime = new Date(topic.updated_at).getTime() + topic.ttl - Date.now();
10 $: remaining = readableTime(remainingTime);
11 </script>
12
13 <li class="h-entry" title={$_('topic.title')}>
14 <span class="p-name">
15 <a
16 class="u-url u-uid underline text-blue-600 visited:text-purple-500"
17 title={$_('topic.permalink_title')}
18 href="/t/{topic.id}"
19 >
20 {topic.title}
21 </a></span
22 >
23 <span class="topic-ttl"
24 >({$_('topic.remaining_time', {
25 values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
26 })})
27 </span>
28 </li>