feat: add posts to dock as well
This commit is contained in:
1 parent
eb00921060
commit
a5b1591d74
7 files changed
+96
-29
No files matched your search
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -46,9 +46,14 @@
|
||||
import { feature } from '$lib/version.js'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
import {
|
||||
bestImageURL,
|
||||
mediaType,
|
||||
optimizeImageURL,
|
||||
} from '$lib/components/lemmy/post/helpers.js'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { addResumable } from '$lib/lemmy/item.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -80,6 +85,21 @@
|
||||
duration: 9999 * 1000,
|
||||
})
|
||||
}
|
||||
if ($profile) {
|
||||
addResumable({
|
||||
avatar: post.post_view.post.thumbnail_url
|
||||
? optimizeImageURL(post.post_view.post.thumbnail_url, 64)
|
||||
: undefined,
|
||||
id: post.post_view.post.id,
|
||||
url: $page.url,
|
||||
name: post.post_view.post.name,
|
||||
type: 'post',
|
||||
subdivision: {
|
||||
name: post.post_view.community.name,
|
||||
avatar: post.post_view.community.icon,
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const fetchOnHome = async (jwt: string) => {
|
||||
|
||||
Reference in new issue
Block a user