]>
Commit | Line | Data |
---|---|---|
a7cf03c1 | 1 | <script lang="ts"> |
be1ce532 RBR |
2 | import type { Topic } from '$lib/data/types'; |
3 | ||
4 | export let topic: Topic; | |
74b03c33 | 5 | |
58f7d521 | 6 | import { _ } from 'svelte-i18n'; |
a7cf03c1 RBR |
7 | import Post from '$lib/components/post/post.svelte'; |
8 | import { readableTime } from '$lib/utils/readable_time'; | |
bd8e98d7 | 9 | |
8ae7249a | 10 | $: remainingTime = topic.updated_at + topic.ttl - Date.now(); |
58f7d521 | 11 | $: remaining = readableTime(remainingTime); |
74b03c33 | 12 | </script> |
66dc4cae | 13 | |
58f7d521 RBR |
14 | <div class="h-entry" title={$_('topic.title')}> |
15 | <h1 class="p-name">{topic.title}</h1> | |
16 | <aside class="topic-meta" title={$_('topic.metadata_title')}> | |
17 | {#if topic.forum} | |
47b0bfe4 | 18 | <span class="topic-location"> |
cac85db0 | 19 | {$_('topic.category_location')} |
47b0bfe4 | 20 | <a href="/f/{topic.forum.id}" class="p-category"> |
cac85db0 RBR |
21 | {topic.forum.glyph} |
22 | {$_(topic.forum.label)} | |
23 | </a>. | |
24 | </span> | |
58f7d521 | 25 | {/if} |
47b0bfe4 | 26 | <span class="topic-ttl"> |
cac85db0 RBR |
27 | <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}"> |
28 | ({$_('topic.remaining_time', { | |
58f7d521 | 29 | values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) } |
cac85db0 RBR |
30 | })}) |
31 | </a>. | |
32 | </span> | |
58f7d521 RBR |
33 | </aside> |
34 | {#if topic.tags.length > 0} | |
35 | <aside class="topic-tags" title={$_('topic.tags_title')}> | |
36 | {$_('topic.tags_location')} | |
37 | {#each topic.tags as tag} | |
47b0bfe4 | 38 | <a href="/g/{tag.id}" class="p-category"> |
cac85db0 RBR |
39 | {tag.id}<span class="tag-weight">({tag.weight})</span> |
40 | </a>{' '} | |
58f7d521 RBR |
41 | {/each} |
42 | </aside> | |
43 | {/if} | |
44 | {#each topic.posts as post, index} | |
45 | <Post {post} {index} count={topic.posts.length} /> | |
46 | {/each} | |
47 | </div> |