feat [3/3]: add topic viewing

This commit is contained in:
James Xylight authored and xylight committed 2025-09-17 00:27:11 +00:00
1 parent a82d8c296d
commit fda8e5fb37
9 files changed
+71 -43

No files matched your search

+1 -1
View File
@@ -131,7 +131,7 @@
animate={false}
>
{#snippet item(p, index)}
<label class="relative">
<label class="relative block">
<input
type="radio"
id={p.id.toString()}
@@ -10,6 +10,7 @@
postLink,
PostMedia,
PostMeta,
type Tag,
} from '$lib/components/lemmy/post'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
@@ -71,6 +72,23 @@
loading = false
data.thread.singleThread = false
}
let tags = $derived.by<{ title?: string; tags: Tag[] }>(() => {
const parsed = parseTags(data.post.post.name)
return {
title: parsed.title,
tags: [
...parsed.tags,
...(data.post.flair_list?.map((i) => ({
content: i.flair_title,
color: i.background_color,
icon: null,
textColor: i.text_color,
})) ?? []),
],
}
})
</script>
<svelte:head>
@@ -129,14 +147,11 @@
edited={data.post.post.updated}
title={data.post.post.name}
style="width: max-content;"
tags={parseTags(data.post.post.name).tags}
tags={tags.tags}
/>
</div>
<h1 class="font-medium text-xl leading-5">
<Markdown
source={parseTags(data.post.post.name).title ?? data.post.post.name}
inline
/>
<Markdown source={tags.title ?? data.post.post.name} inline />
</h1>
</header>
<PostMedia
+1 -1
View File
@@ -11,7 +11,7 @@
let { data = $bindable() } = $props()
let title = $state('Loading...')
data.topic.then((i) => (title = i?.title ?? ''))
data.topic.then((i) => (title = i?.name ?? ''))
</script>
<svelte:head>