feat: add blocks page
This commit is contained in:
1 parent
661d9b1003
commit
38775168cc
2 files changed
+73
-28
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "0.6.4",
|
"version": "0.6.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -7,8 +7,11 @@
|
|||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import { Icon, Trash } from 'svelte-hero-icons'
|
import { Check, Icon, Trash } from 'svelte-hero-icons'
|
||||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||||
|
import { flip } from 'svelte/animate'
|
||||||
|
import { slide } from 'svelte/transition'
|
||||||
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
|
|
||||||
// sveltekit doesn't feel like making types work right now
|
// sveltekit doesn't feel like making types work right now
|
||||||
export let data: PageData & {
|
export let data: PageData & {
|
||||||
@@ -54,30 +57,72 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
{#if data.community_blocks.length > 0 || data.person_blocks.length > 0}
|
||||||
<SectionTitle>Users</SectionTitle>
|
{#if data.person_blocks.length > 0}
|
||||||
<EditableList let:action on:action={(i) => unblockUser(i.detail)}>
|
<div>
|
||||||
{#each data.person_blocks as block}
|
<SectionTitle>Users</SectionTitle>
|
||||||
<div class="flex flex-row gap-4 items-center py-4 justify-between">
|
<EditableList let:action on:action={(i) => unblockUser(i.detail)}>
|
||||||
<UserLink user={block.target} avatar badges />
|
{#each data.person_blocks as block (block.target.id)}
|
||||||
<Button size="square-md" on:click={() => action(block.target)}>
|
<div
|
||||||
<Icon src={Trash} mini size="16" slot="icon" />
|
class="flex flex-row gap-4 items-center py-4 justify-between"
|
||||||
</Button>
|
animate:flip={{ duration: 250 }}
|
||||||
</div>
|
out:slide={{ axis: 'y' }}
|
||||||
{/each}
|
>
|
||||||
</EditableList>
|
<UserLink user={block.target} avatar badges />
|
||||||
</div>
|
<Button size="square-md" on:click={() => action(block)}>
|
||||||
|
<Icon src={Trash} mini size="16" slot="icon" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</EditableList>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<Placeholder>
|
||||||
|
<Icon src={Check} size="48" slot="icon" />
|
||||||
|
<span slot="title">No user blocks</span>
|
||||||
|
<p slot="description">
|
||||||
|
Go to a user's profile and click "block" to stop seeing posts and
|
||||||
|
comments from them.
|
||||||
|
</p>
|
||||||
|
</Placeholder>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div>
|
{#if data.community_blocks.length > 0}
|
||||||
<SectionTitle>Communities</SectionTitle>
|
<div>
|
||||||
<EditableList let:action on:action={(i) => unblockCommunity(i.detail)}>
|
<SectionTitle>Communities</SectionTitle>
|
||||||
{#each data.community_blocks as block}
|
<EditableList let:action on:action={(i) => unblockCommunity(i.detail)}>
|
||||||
<div class="flex flex-row gap-4 items-center py-4 justify-between">
|
{#each data.community_blocks as block (block.community.id)}
|
||||||
<CommunityLink community={block.community} avatar />
|
<div
|
||||||
<Button size="square-md" on:click={() => action(block.community)}>
|
class="flex flex-row gap-4 items-center py-4 justify-between"
|
||||||
<Icon src={Trash} mini size="16" slot="icon" />
|
animate:flip={{ duration: 250 }}
|
||||||
</Button>
|
out:slide={{ axis: 'y' }}
|
||||||
</div>
|
>
|
||||||
{/each}
|
<CommunityLink community={block.community} avatar />
|
||||||
</EditableList>
|
<Button size="square-md" on:click={() => action(block)}>
|
||||||
</div>
|
<Icon src={Trash} mini size="16" slot="icon" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</EditableList>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<Placeholder>
|
||||||
|
<Icon src={Check} size="48" slot="icon" />
|
||||||
|
<span slot="title">No community blocks</span>
|
||||||
|
<p slot="description">
|
||||||
|
Go to a community's page and click "block" to stop seeing submissions
|
||||||
|
from it.
|
||||||
|
</p>
|
||||||
|
</Placeholder>
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<div class="my-auto">
|
||||||
|
<Placeholder>
|
||||||
|
<Icon src={Check} size="48" slot="icon" />
|
||||||
|
<span slot="title">No blocks</span>
|
||||||
|
<p slot="description">
|
||||||
|
Go to a community or user's page to stop seeing submissions from it.
|
||||||
|
</p>
|
||||||
|
</Placeholder>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
Reference in new issue
Block a user