2 import type { Topic } from '$lib/data/types';
4 export let topic: Topic;
6 import { _ } from 'svelte-i18n';
7 import Post from '$lib/components/post/post.svelte';
8 import { readableTime } from '$lib/utils/readable_time';
10 $: remainingTime = topic.updated_at + topic.ttl - Date.now();
11 $: remaining = readableTime(remainingTime);
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')}>
18 <span class="topic-location">
19 {$_('topic.category_location')}
20 <a href="/f/{topic.forum.id}" class="p-category">
22 {$_(topic.forum.label)}
26 <span class="topic-ttl">
27 <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
28 ({$_('topic.remaining_time', {
29 values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
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}
38 <a href="/g/{tag.id}" class="p-category">
39 {tag.id}<span class="tag-weight">({tag.weight})</span>
44 {#each topic.posts as post, index}
45 <Post {post} {index} count={topic.posts.length} />