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