misc: improve sidebar
This commit is contained in:
1 parent
bfb36a93f8
commit
783ecbcb5f
2 files changed
+17
-3
No files matched your search
@@ -36,14 +36,17 @@
|
|||||||
async function deletePost() {
|
async function deletePost() {
|
||||||
if (!$authData) return
|
if (!$authData) return
|
||||||
|
|
||||||
|
const deleted = post.post.deleted
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await getClient().deletePost({
|
await getClient().deletePost({
|
||||||
auth: $authData.token,
|
auth: $authData.token,
|
||||||
deleted: true,
|
deleted: !deleted,
|
||||||
post_id: post.post.id,
|
post_id: post.post.id,
|
||||||
})
|
})
|
||||||
|
post.post.deleted = !deleted
|
||||||
toast({
|
toast({
|
||||||
content: 'That post was deleted.',
|
content: `That post was ${deleted ? 'restored' : 'deleted'}.`,
|
||||||
type: ToastType.success,
|
type: ToastType.success,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -166,7 +169,7 @@
|
|||||||
{#if $user && isMutable(post, $user.local_user_view)}
|
{#if $user && isMutable(post, $user.local_user_view)}
|
||||||
<MenuButton on:click={deletePost} color="dangerSecondary">
|
<MenuButton on:click={deletePost} color="dangerSecondary">
|
||||||
<Icon src={Trash} width={16} mini />
|
<Icon src={Trash} width={16} mini />
|
||||||
Delete
|
{post.post.deleted ? 'Restore' : 'Delete'}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $user?.local_user_view.person.id != post.creator.id}
|
{#if $user?.local_user_view.person.id != post.creator.id}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import {
|
import {
|
||||||
ArrowLeftOnRectangle,
|
ArrowLeftOnRectangle,
|
||||||
ChevronDoubleLeft,
|
ChevronDoubleLeft,
|
||||||
|
Cog6Tooth,
|
||||||
Home,
|
Home,
|
||||||
Icon,
|
Icon,
|
||||||
Plus,
|
Plus,
|
||||||
@@ -39,6 +40,16 @@
|
|||||||
<Icon src={Home} solid size="20" />
|
<Icon src={Home} solid size="20" />
|
||||||
<span class:hidden={!expanded}>Frontpage</span>
|
<span class:hidden={!expanded}>Frontpage</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
|
||||||
|
href="/settings"
|
||||||
|
color="tertiary"
|
||||||
|
alignment="left"
|
||||||
|
>
|
||||||
|
<Icon src={Cog6Tooth} solid size="20" />
|
||||||
|
<span class:hidden={!expanded}>Settings</span>
|
||||||
|
</Button>
|
||||||
|
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
|
||||||
{#if $user}
|
{#if $user}
|
||||||
{#each $user.follows
|
{#each $user.follows
|
||||||
.map((f) => f.community)
|
.map((f) => f.community)
|
||||||
|
|||||||
Reference in new issue
Block a user