misc: use bindings to show updated data easily
This commit is contained in:
1 parent
4646a59ddf
commit
dca0edf0b1
8 files changed
+63
-58
No files matched your search
@@ -101,7 +101,7 @@
|
||||
class:opacity-100={loaded}
|
||||
width={512}
|
||||
height={300}
|
||||
class:blur-3xl={post.post.nsfw}
|
||||
class:blur-3xl={post.post.nsfw && $userSettings.nsfwBlur}
|
||||
on:load={() => (loaded = true)}
|
||||
/>
|
||||
</picture>
|
||||
@@ -129,11 +129,8 @@
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions
|
||||
{post}
|
||||
bind:post
|
||||
on:edit={(e) => {
|
||||
post.post.name = e.detail.post.name
|
||||
post.post.body = e.detail.post.body
|
||||
post.post.url = e.detail.post.url
|
||||
toast({
|
||||
content: 'The post was edited successfully.',
|
||||
type: 'success',
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
async function save(post: PostView) {
|
||||
if (!$profile?.jwt) return
|
||||
if (!$profile?.jwt) return false
|
||||
|
||||
const saved = post.saved
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
return post.saved
|
||||
}
|
||||
|
||||
const dispatcher = createEventDispatcher<{ edit: PostView }>()
|
||||
@@ -119,7 +121,7 @@
|
||||
</Button>
|
||||
<div class="ml-auto" />
|
||||
{#if $profile?.user && (amMod($profile.user, post.community) || isAdmin($profile.user))}
|
||||
<ModerationMenu item={post} community={post.community} />
|
||||
<ModerationMenu bind:item={post} community={post.community} />
|
||||
{/if}
|
||||
<Menu alignment="bottom-right" class="overflow-auto" let:toggleOpen>
|
||||
<Button
|
||||
@@ -166,7 +168,7 @@
|
||||
Copy Link
|
||||
</MenuButton>
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton on:click={() => save(post)}>
|
||||
<MenuButton on:click={async () => (post.saved = await save(post))}>
|
||||
<Icon src={post.saved ? BookmarkSlash : Bookmark} width={16} mini />
|
||||
{post.saved ? 'Unsave' : 'Save'}
|
||||
</MenuButton>
|
||||
|
||||
Reference in new issue
Block a user