cleanup: remove editable list

This commit is contained in:
James Xylight committed 2025-02-05 19:38:58 -08:00
1 parent 53cb0e4f20
commit 95e2dec139
4 files changed
+81 -79

No files matched your search

+1 -1
View File
@@ -9,6 +9,6 @@
let { small = false, class: clazz = '', children, ...rest }: Props = $props() let { small = false, class: clazz = '', children, ...rest }: Props = $props()
</script> </script>
<span {...rest} class="{!small ? 'text-lg' : 'text-xs'} font-semibold {clazz}"> <span {...rest} class="{!small ? 'text-lg' : 'text-xs'} font-medium {clazz}">
{@render children?.()} {@render children?.()}
</span> </span>
+1 -1
View File
@@ -118,7 +118,7 @@
saving = false saving = false
} }
let csv: FileList | null = $state() let csv = $state<FileList | null>()
async function parseCsv(files: FileList) { async function parseCsv(files: FileList) {
if (!(files.length > 0)) return if (!(files.length > 0)) return
@@ -1,15 +0,0 @@
<script>
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props} */
let { children } = $props()
</script>
<div
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 [&>*]:py-3 first:p-0 last:py-0"
>
{@render children?.()}
</div>
@@ -20,6 +20,8 @@
import Switch from '$lib/components/input/Switch.svelte' import Switch from '$lib/components/input/Switch.svelte'
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte' import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import Material from 'mono-svelte/materials/Material.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
interface Props { interface Props {
// sveltekit doesn't feel like making types work right now // sveltekit doesn't feel like making types work right now
@@ -85,25 +87,91 @@
} }
</script> </script>
<Header pageHeader>
{$t('routes.profile.blocks.title')}
</Header>
{#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0} {#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0}
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0} {#if data.community_blocks?.length > 0}
<div> <div class="space-y-1">
<SectionTitle>{$t('content.instances')}</SectionTitle> <SectionTitle>{$t('content.communities')}</SectionTitle>
<ul> <Material
{#each data.my_user?.instance_blocks as block (block.instance.id)} color="uniform"
<div class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
class="flex flex-row gap-2 items-center py-4" rounding="xl"
animate:flip={{ duration: 250 }}
out:slide|local={{ axis: 'y' }}
> >
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
{#each data.community_blocks as block (block.community.id)}
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
<Button <Button
title="Unblock" title="Unblock"
size="square-md" size="square-md"
rounding="pill" rounding="pill"
color="danger"
onclick={() => unblockCommunity(block)}
>
{#snippet prefix()}
<Icon src={XMark} micro size="16" />
{/snippet}
</Button>
<CommunityLink community={block.community} avatar />
</div>
{/each}
</ul>
</Material>
</div>
{/if}
{#if data.person_blocks?.length > 0}
<div class="space-y-1">
<SectionTitle>{$t('content.users')}</SectionTitle>
<Material
color="uniform"
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
rounding="xl"
>
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
{#each data.person_blocks as block (block.target.id)}
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
<Button
title="Unblock"
size="square-md"
rounding="pill"
color="danger"
onclick={() => unblockUser(block)}
>
{#snippet prefix()}
<Icon src={XMark} micro size="16" />
{/snippet}
</Button>
<UserLink user={block.target} avatar badges />
</div>
{/each}
</ul>
</Material>
</div>
{/if}
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
<div class="space-y-1">
<SectionTitle class="text-lg">
{$t('content.instances')}
</SectionTitle>
<Material
color="uniform"
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
rounding="xl"
>
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
{#each data.my_user?.instance_blocks as block (block.instance.id)}
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
<Button
title="Unblock"
size="square-md"
rounding="pill"
color="danger"
onclick={() => unblockInstances(block)} onclick={() => unblockInstances(block)}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={XMark} mini size="16" /> <Icon src={XMark} micro size="16" />
{/snippet} {/snippet}
</Button> </Button>
<Entity <Entity
@@ -114,58 +182,7 @@
</div> </div>
{/each} {/each}
</ul> </ul>
</div> </Material>
{/if}
{#if data.community_blocks?.length > 0}
<div>
<SectionTitle>{$t('content.communities')}</SectionTitle>
<ul>
{#each data.community_blocks as block (block.community.id)}
<div
class="flex flex-row gap-2 items-center py-2"
animate:flip={{ duration: 250 }}
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
>
<Button
title="Unblock"
size="square-md"
rounding="pill"
onclick={() => unblockCommunity(block)}
>
{#snippet prefix()}
<Icon src={XMark} mini size="16" />
{/snippet}
</Button>
<CommunityLink community={block.community} avatar />
</div>
{/each}
</ul>
</div>
{/if}
{#if data.person_blocks?.length > 0}
<div>
<SectionTitle>{$t('content.users')}</SectionTitle>
<ul>
{#each data.person_blocks as block (block.target.id)}
<div
class="flex flex-row gap-2 items-center py-2"
animate:flip={{ duration: 250 }}
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
>
<Button
title="Unblock"
size="square-md"
rounding="pill"
onclick={() => unblockUser(block)}
>
{#snippet prefix()}
<Icon src={XMark} mini size="16" />
{/snippet}
</Button>
<UserLink user={block.target} avatar badges />
</div>
{/each}
</ul>
</div> </div>
{/if} {/if}
{:else} {:else}