feat: add posts to dock as well

This commit is contained in:
Xylight committed 2024-04-13 19:43:19 -07:00
1 parent eb00921060
commit a5b1591d74
7 files changed
+96 -29

No files matched your search

+3 -7
View File
@@ -21,6 +21,7 @@
} from 'svelte-hero-icons'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { profile } from '$lib/auth'
import { addResumable } from '$lib/lemmy/item.js'
export let data
@@ -36,18 +37,13 @@
afterNavigate(() => {
if ($profile) {
let favs = $profile?.favorites ?? []
if (favs.map((fav) => fav.url.toString()).includes($page.url.toString()))
return
if (favs.length >= 3) favs.pop()
favs.unshift({
addResumable({
avatar: data.community.community_view.community.icon,
id: data.community.community_view.community.id,
url: $page.url,
name: data.community.community_view.community.title,
type: 'community',
})
$profile.favorites = favs
}
})