]> git.r.bdr.sh - rbdr/forum/blob - src/lib/components/topic_summary/topic_summary.svelte
337a064e3a9f8f1aed9dc66d4394bd55297c5769
[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 = topic.updated_at + 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 class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
16 {topic.title}
17 </a></span
18 >
19 <span class="topic-ttl"
20 >({$_('topic.remaining_time', {
21 values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
22 })})
23 </span>
24 </li>
25
26 <style>
27 </style>