design: use commonlist for settings and moderation
This commit is contained in:
7 files changed
+119
-114
No files matched your search
@@ -62,11 +62,11 @@
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
srcset="{optimizedURLs[0]} 1x, {optimizedURLs[1]} 2x, {optimizedURLs[2]} 4x, {optimizedURLs[3]} 6x"
|
srcset="{optimizedURLs[0]} 1x, {optimizedURLs[1]} 2x, {optimizedURLs[2]} 4x, {optimizedURLs[3]} 6x"
|
||||||
src={optimizedURLs[0]}
|
src={optimizedURLs[0]}
|
||||||
{alt}
|
alt=""
|
||||||
{width}
|
{width}
|
||||||
{title}
|
{title}
|
||||||
class={[
|
class={[
|
||||||
'aspect-square object-cover overflow-hidden shrink-0',
|
'aspect-square object-cover overflow-hidden shrink-0 bg-slate-100 dark:bg-zinc-900',
|
||||||
circle ? 'rounded-full' : 'rounded-lg',
|
circle ? 'rounded-full' : 'rounded-lg',
|
||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
@@ -114,10 +114,3 @@
|
|||||||
}).toString()}
|
}).toString()}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
|
||||||
img,
|
|
||||||
div {
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><line x1="30" y1="30" x2="70" y2="70" stroke="#aa0000" stroke-width="4" stroke-linecap="round"/><line x1="70" y1="30" x2="30" y2="70" stroke="#aa0000" stroke-width="4" stroke-linecap="round"/></svg>');
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -2,23 +2,59 @@
|
|||||||
import type { Snippet } from 'svelte'
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items: T[]
|
items?: T[]
|
||||||
item: Snippet<[T, number]>
|
item?: Snippet<[T, number]>
|
||||||
|
children?: Snippet
|
||||||
}
|
}
|
||||||
|
|
||||||
let { items, item: itemSnippet }: Props = $props()
|
let { items, item: itemSnippet, children }: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul class="divide-y-3 divide-slate-25 dark:divide-zinc-925">
|
<ul class="divide-y-3 divide-slate-25 dark:divide-zinc-925">
|
||||||
{#each items as item, index (item)}
|
{#if items}
|
||||||
<li
|
{#each items as item, index (item)}
|
||||||
class={[
|
<li class="@container group/li">
|
||||||
'py-2 px-3 sm:py-3 sm:px-4',
|
{@render itemSnippet?.(item, index)}
|
||||||
'hover:bg-slate-100 dark:hover:bg-zinc-900/25 transition-colors @container',
|
</li>
|
||||||
'bg-slate-50 dark:bg-zinc-950 first:rounded-t-2xl last:rounded-b-2xl group/li',
|
{/each}
|
||||||
]}
|
{/if}
|
||||||
>
|
{@render children?.()}
|
||||||
{@render itemSnippet(item, index)}
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul > :global(li) {
|
||||||
|
padding-block: calc(var(--spacing) * 2);
|
||||||
|
padding-inline: calc(var(--spacing) * 3);
|
||||||
|
transition: background-color 0.1s;
|
||||||
|
background-color: var(--color-slate-50);
|
||||||
|
container-type: inline-size;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top-left-radius: var(--radius-2xl);
|
||||||
|
border-top-right-radius: var(--radius-2xl);
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
border-bottom-left-radius: var(--radius-2xl);
|
||||||
|
border-bottom-right-radius: var(--radius-2xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--color-zinc-50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 40rem) {
|
||||||
|
ul > :global(li) {
|
||||||
|
padding-block: calc(var(--spacing) * 2);
|
||||||
|
padding-inline: calc(var(--spacing) * 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark) ul > :global(li) {
|
||||||
|
background-color: var(--color-zinc-950);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--color-zinc-900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { profile } from '$lib/auth.svelte'
|
import { profile } from '$lib/auth.svelte'
|
||||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||||
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { Button, Material, Spinner } from 'mono-svelte'
|
import { Button, Spinner } from 'mono-svelte'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header pageHeader>
|
<Header pageHeader>
|
||||||
@@ -15,59 +16,51 @@
|
|||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<Material
|
<CommonList items={profile.current.user.moderates}>
|
||||||
color="uniform"
|
{#snippet item(moderate)}
|
||||||
rounding="2xl"
|
|
||||||
class="flex flex-col dark:bg-zinc-950 max-h-[32rem] overflow-auto"
|
|
||||||
>
|
|
||||||
{#each profile.current.user.moderates as moderate}
|
|
||||||
{@const community = moderate.community}
|
{@const community = moderate.community}
|
||||||
<div
|
<CommunityItem
|
||||||
class="-mx-4 px-4 hover:bg-slate-100 hover:dark:bg-zinc-900 transition-colors duration-75"
|
community={{
|
||||||
|
banned_from_community: false,
|
||||||
|
blocked: false,
|
||||||
|
community: community,
|
||||||
|
counts: {
|
||||||
|
comments: 0,
|
||||||
|
community_id: 0,
|
||||||
|
posts: 0,
|
||||||
|
published: '2023-10-05',
|
||||||
|
subscribers: 0,
|
||||||
|
subscribers_local: 0,
|
||||||
|
users_active_day: 0,
|
||||||
|
users_active_half_year: 0,
|
||||||
|
users_active_month: 0,
|
||||||
|
users_active_week: 0,
|
||||||
|
},
|
||||||
|
subscribed: 'NotSubscribed',
|
||||||
|
}}
|
||||||
|
class="py-1 -mx-4 px-4"
|
||||||
>
|
>
|
||||||
<CommunityItem
|
<Button
|
||||||
community={{
|
href="/moderation?community={community.id}"
|
||||||
banned_from_community: false,
|
color="secondary"
|
||||||
blocked: false,
|
rounding="pill"
|
||||||
community: community,
|
size="sm"
|
||||||
counts: {
|
class="h-max self-center"
|
||||||
comments: 0,
|
|
||||||
community_id: 0,
|
|
||||||
posts: 0,
|
|
||||||
published: '2023-10-05',
|
|
||||||
subscribers: 0,
|
|
||||||
subscribers_local: 0,
|
|
||||||
users_active_day: 0,
|
|
||||||
users_active_half_year: 0,
|
|
||||||
users_active_month: 0,
|
|
||||||
users_active_week: 0,
|
|
||||||
},
|
|
||||||
subscribed: 'NotSubscribed',
|
|
||||||
}}
|
|
||||||
class="py-1 -mx-4 px-4"
|
|
||||||
>
|
>
|
||||||
<Button
|
{$t('routes.moderation.feed')}
|
||||||
href="/moderation?community={community.id}"
|
</Button>
|
||||||
color="secondary"
|
<div class="w-2"></div>
|
||||||
rounding="pill"
|
<Button
|
||||||
size="sm"
|
href="/moderation/c/{community.id}"
|
||||||
class="h-max self-center"
|
color="primary"
|
||||||
>
|
rounding="pill"
|
||||||
{$t('routes.moderation.feed')}
|
size="sm"
|
||||||
</Button>
|
class="h-max self-center"
|
||||||
<div class="w-2"></div>
|
>
|
||||||
<Button
|
{$t('routes.moderation.manage.title')}
|
||||||
href="/moderation/c/{community.id}"
|
</Button>
|
||||||
color="primary"
|
</CommunityItem>
|
||||||
rounding="pill"
|
{/snippet}
|
||||||
size="sm"
|
</CommonList>
|
||||||
class="h-max self-center"
|
|
||||||
>
|
|
||||||
{$t('routes.moderation.manage.title')}
|
|
||||||
</Button>
|
|
||||||
</CommunityItem>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</Material>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -252,7 +252,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Setting>
|
</Setting>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex flex-col gap-2">
|
<li class="flex flex-col gap-2">
|
||||||
<Setting icon={Language}>
|
<Setting icon={Language}>
|
||||||
{#snippet title()}
|
{#snippet title()}
|
||||||
{$t('settings.app.lang.title')}
|
{$t('settings.app.lang.title')}
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
title={$t('settings.app.lang.useRtl.title')}
|
title={$t('settings.app.lang.useRtl.title')}
|
||||||
></ToggleSetting>
|
></ToggleSetting>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</li>
|
||||||
<Setting icon={ViewColumns}>
|
<Setting icon={ViewColumns}>
|
||||||
{#snippet title()}
|
{#snippet title()}
|
||||||
<span>{$t('settings.app.view.title')}</span>
|
<span>{$t('settings.app.view.title')}</span>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Icon, Minus, Plus } from 'svelte-hero-icons'
|
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||||
import { expoOut } from 'svelte/easing'
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import { slide } from 'svelte/transition'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string
|
title: string
|
||||||
@@ -10,37 +9,21 @@
|
|||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
}
|
}
|
||||||
|
|
||||||
let { title, id, open = $bindable(true), children }: Props = $props()
|
let {
|
||||||
|
title: passedTitle,
|
||||||
|
id,
|
||||||
|
open = $bindable(true),
|
||||||
|
children,
|
||||||
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col max-w-full w-full">
|
<Expandable bind:open>
|
||||||
<button
|
{#snippet title()}
|
||||||
class="text-left hover:text-primary-900 dark:hover:text-primary-100
|
|
||||||
flex items-center justify-between z-0 relative group transition-colors"
|
|
||||||
onclick={() => (open = !open)}
|
|
||||||
>
|
|
||||||
<h2 class="text-xl font-semibold text-inherit" {id}>
|
<h2 class="text-xl font-semibold text-inherit" {id}>
|
||||||
<span>{title}</span>
|
<span>{passedTitle}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<Icon
|
{/snippet}
|
||||||
src={open ? Minus : Plus}
|
<CommonList>
|
||||||
size="16"
|
{@render children?.()}
|
||||||
micro
|
</CommonList>
|
||||||
class="{open
|
</Expandable>
|
||||||
? ''
|
|
||||||
: 'rotate-90'} transition-transform duration-500 ease-out"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="absolute inset-x-0 inset-y-1 opacity-0 rounded-full bg-slate-50 dark:bg-zinc-900
|
|
||||||
group-hover:-inset-x-3 group-hover:-inset-y-1 group-hover:opacity-100 transition-all -z-10"
|
|
||||||
></div>
|
|
||||||
</button>
|
|
||||||
{#if open}
|
|
||||||
<div
|
|
||||||
transition:slide={{ axis: 'y', duration: 500, easing: expoOut }}
|
|
||||||
class="w-full flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 *:py-3"
|
|
||||||
>
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<li
|
||||||
class={[
|
class={[
|
||||||
'flex flex-col w-full justify-between gap-2 max-w-full @container/setting setting',
|
'flex flex-col w-full justify-between gap-2 max-w-full @container/setting setting',
|
||||||
mainClass,
|
mainClass,
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.setting-grid {
|
.setting-grid {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<li
|
||||||
class="flex flex-col w-full justify-between gap-2 max-w-full setting @container/setting"
|
class="flex flex-col w-full justify-between gap-2 max-w-full setting @container/setting"
|
||||||
>
|
>
|
||||||
{#if Object.values(supportedPlatforms).some(v => v == false) || beta}
|
{#if Object.values(supportedPlatforms).some(v => v == false) || beta}
|
||||||
@@ -94,4 +94,4 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
Reference in new issue
Block a user