migrate: convert most components to svelte 5
This commit is contained in:
1 parent
d670f39f0a
commit
10ef4123da
225 files changed
+5441
-3341
No files matched your search
+60
-43
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import '../style/app.css'
|
||||
import { navigating, page } from '$app/stores'
|
||||
@@ -32,6 +34,11 @@
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { locale } from '$lib/translations'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
|
||||
nProgress.configure({
|
||||
minimum: 0.4,
|
||||
@@ -41,9 +48,9 @@
|
||||
showSpinner: false,
|
||||
})
|
||||
|
||||
let barTimeout: any = 0
|
||||
let barTimeout: any = $state(0)
|
||||
|
||||
$: {
|
||||
run(() => {
|
||||
if (browser) {
|
||||
if ($navigating) {
|
||||
document.body.classList.toggle('wait', true)
|
||||
@@ -55,7 +62,7 @@
|
||||
nProgress.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
if (browser) {
|
||||
@@ -116,7 +123,9 @@
|
||||
class="fixed -top-16 focus:top-0 left-0 m-4 z-[300] transition-all"
|
||||
href="#main"
|
||||
>
|
||||
<Icon src={Forward} mini size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Forward} mini size="16" />
|
||||
{/snippet}
|
||||
Skip Navigation
|
||||
</Button>
|
||||
<Shell
|
||||
@@ -129,43 +138,51 @@
|
||||
<ExpandableImage />
|
||||
<ModalContainer />
|
||||
|
||||
<Sidebar
|
||||
route={$page.route.id ?? ''}
|
||||
slot="sidebar"
|
||||
let:style={s}
|
||||
let:class={c}
|
||||
class={c}
|
||||
style={s}
|
||||
/>
|
||||
<main
|
||||
slot="main"
|
||||
let:style={s}
|
||||
let:class={c}
|
||||
class="p-4 sm:p-6 min-w-0 w-full flex flex-col h-full relative {c}"
|
||||
style={s}
|
||||
id="main"
|
||||
>
|
||||
<slot />
|
||||
</main>
|
||||
<Navbar slot="navbar" let:style={s} let:class={c} class={c} style={s} />
|
||||
<div slot="suffix" let:class={c} let:style={s} class={c} style={s}>
|
||||
{#if $page.data.slots?.sidebar?.component}
|
||||
<svelte:component
|
||||
this={$page.data.slots.sidebar.component}
|
||||
{...$page.data.slots.sidebar.props}
|
||||
/>
|
||||
{:else if $site}
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
taglines={$site.taglines}
|
||||
admins={$site.admins}
|
||||
version={$site.version}
|
||||
class=""
|
||||
/>
|
||||
{:else}
|
||||
<div class="h-64 w-full grid place-items-center">
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#snippet sidebar({ style: s, class: c })}
|
||||
<Sidebar
|
||||
route={$page.route.id ?? ''}
|
||||
|
||||
|
||||
|
||||
class={c}
|
||||
style={s}
|
||||
/>
|
||||
{/snippet}
|
||||
{#snippet main({ style: s, class: c })}
|
||||
<main
|
||||
|
||||
|
||||
|
||||
class="p-4 sm:p-6 min-w-0 w-full flex flex-col h-full relative {c}"
|
||||
style={s}
|
||||
id="main"
|
||||
>
|
||||
{@render children?.()}
|
||||
</main>
|
||||
{/snippet}
|
||||
{#snippet navbar({ style: s, class: c })}
|
||||
<Navbar class={c} style={s} />
|
||||
{/snippet}
|
||||
{#snippet suffix({ class: c, style: s })}
|
||||
<div class={c} style={s}>
|
||||
{#if $page.data.slots?.sidebar?.component}
|
||||
{@const SvelteComponent = $page.data.slots.sidebar.component}
|
||||
<SvelteComponent
|
||||
{...$page.data.slots.sidebar.props}
|
||||
/>
|
||||
{:else if $site}
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
taglines={$site.taglines}
|
||||
admins={$site.admins}
|
||||
version={$site.version}
|
||||
class=""
|
||||
/>
|
||||
{:else}
|
||||
<div class="h-64 w-full grid place-items-center">
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
</Shell>
|
||||
+18
-15
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" context="module">
|
||||
<script lang="ts" module>
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -17,7 +17,13 @@
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
const SvelteComponent = $derived($userSettings.infiniteScroll &&
|
||||
browser &&
|
||||
!$userSettings.posts.noVirtualize
|
||||
? VirtualFeed
|
||||
: PostFeed);
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-2 max-w-full w-full min-w-0">
|
||||
@@ -25,22 +31,19 @@
|
||||
<Header pageHeader>
|
||||
{$t('routes.frontpage.title')}
|
||||
|
||||
<div class="flex items-center gap-2" slot="extended">
|
||||
{#if data.type_}
|
||||
<Location changeDefault selected={data.type_} />
|
||||
{/if}
|
||||
<Sort changeDefault selected={data.sort} />
|
||||
<ViewSelect />
|
||||
</div>
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center gap-2" >
|
||||
{#if data.type_}
|
||||
<Location changeDefault selected={data.type_} />
|
||||
{/if}
|
||||
<Sort changeDefault selected={data.sort} />
|
||||
<ViewSelect />
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
</header>
|
||||
|
||||
<svelte:component
|
||||
this={$userSettings.infiniteScroll &&
|
||||
browser &&
|
||||
!$userSettings.posts.noVirtualize
|
||||
? VirtualFeed
|
||||
: PostFeed}
|
||||
<SvelteComponent
|
||||
posts={data.posts.posts}
|
||||
bind:feedData={data}
|
||||
feedId="main"
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
<script lang="ts">
|
||||
import { Badge } from 'mono-svelte'
|
||||
|
||||
export let name: string
|
||||
export let description: string
|
||||
export let badge: string | undefined = undefined
|
||||
|
||||
export let link: string = '#'
|
||||
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
interface Props {
|
||||
name: string;
|
||||
description: string;
|
||||
badge?: string | undefined;
|
||||
link?: string;
|
||||
class?: string;
|
||||
}
|
||||
|
||||
let {
|
||||
name,
|
||||
description,
|
||||
badge = undefined,
|
||||
link = '#',
|
||||
class: clazz = ''
|
||||
}: Props = $props();
|
||||
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col w-max {clazz}">
|
||||
|
||||
+188
-154
@@ -37,15 +37,15 @@
|
||||
import FilterTabs from '$lib/components/ui/tabs/FilterTabs.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
let debugging = false
|
||||
let debugProfile: Profile | undefined = undefined
|
||||
let debugging = $state(false)
|
||||
let debugProfile: Profile | undefined = $state(undefined)
|
||||
|
||||
let removing = {
|
||||
let removing = $state({
|
||||
shown: false,
|
||||
account: undefined as Profile | undefined,
|
||||
}
|
||||
})
|
||||
|
||||
let switching = -2
|
||||
let switching = $state(-2)
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -57,18 +57,22 @@
|
||||
object={debugProfile?.id == $profile?.id ? $profile : debugProfile}
|
||||
bind:open={debugging}
|
||||
>
|
||||
<span slot="title" class="flex flex-col">
|
||||
<h1 class="font-bold text-2xl">Debug</h1>
|
||||
<span class="text-slate-600 dark:text-zinc-400 text-base font-normal">
|
||||
Do NOT share anything from this menu.
|
||||
{#snippet title()}
|
||||
<span class="flex flex-col">
|
||||
<h1 class="font-bold text-2xl">Debug</h1>
|
||||
<span class="text-slate-600 dark:text-zinc-400 text-base font-normal">
|
||||
Do NOT share anything from this menu.
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
{/snippet}
|
||||
</DebugObject>
|
||||
{/if}
|
||||
|
||||
{#if removing.shown && removing.account}
|
||||
<Modal bind:open={removing.shown}>
|
||||
<span slot="title">Removing Account</span>
|
||||
{#snippet title()}
|
||||
<span >Removing Account</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<ProfileAvatar profile={removing.account} selected={true} />
|
||||
|
||||
@@ -115,11 +119,15 @@
|
||||
</div>
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button href="/accounts/login" size="lg">
|
||||
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" micro />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" micro />
|
||||
{/snippet}
|
||||
Log in
|
||||
</Button>
|
||||
<Button href="/signup" size="lg">
|
||||
<Icon slot="prefix" src={Identification} size="16" micro />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Identification} size="16" micro />
|
||||
{/snippet}
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
@@ -129,151 +137,177 @@
|
||||
<div class="flex flex-col h-full gap-4">
|
||||
<Header pageHeader>
|
||||
{$t('routes.accounts')}
|
||||
<div class="flex" slot="extended">
|
||||
<div class="flex gap-2 mr-auto">
|
||||
<Button
|
||||
href="/accounts/login"
|
||||
size="lg"
|
||||
class="flex-1 px-8"
|
||||
color="primary"
|
||||
>
|
||||
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" mini />
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<Button href="/accounts/login/guest" size="lg">
|
||||
<Icon slot="prefix" src={Plus} size="16" micro />
|
||||
{$t('account.addGuest')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Header>
|
||||
<FilterTabs items={$profileData.profiles} id={(i) => i.instance} let:items>
|
||||
<EditableList
|
||||
on:action={(acc) => {
|
||||
removing.account = acc.detail
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
let:action
|
||||
>
|
||||
{#each items as profile, index (profile.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-3"
|
||||
transition:fly={{ duration: 500, y: -12, easing: expoOut }}
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
>
|
||||
{#snippet extended()}
|
||||
<div class="flex" >
|
||||
<div class="flex gap-2 mr-auto">
|
||||
<Button
|
||||
title={profile.id == $currentProfile?.id ? 'Switch' : 'Current'}
|
||||
on:click={async () => {
|
||||
if (profile.id != $currentProfile?.id) {
|
||||
switching = profile.id
|
||||
await setUserID(profile.id)
|
||||
switching = -69
|
||||
}
|
||||
}}
|
||||
size="square-md"
|
||||
color={profile.id == $currentProfile?.id ? 'primary' : 'ghost'}
|
||||
loading={switching == profile.id}
|
||||
disabled={switching == profile.id}
|
||||
rounding="pill"
|
||||
href="/accounts/login"
|
||||
size="lg"
|
||||
class="flex-1 px-8"
|
||||
color="primary"
|
||||
>
|
||||
<svelte:fragment slot="prefix">
|
||||
{#if profile.id == $currentProfile?.id}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{:else}
|
||||
<Icon src={ArrowsRightLeft} size="16" mini />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative group flex-col items-center">
|
||||
<ProfileAvatar
|
||||
{profile}
|
||||
{index}
|
||||
selected={$currentProfile?.id == profile.id}
|
||||
size={24}
|
||||
/>
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full opacity-0
|
||||
grid group-hover:opacity-100 z-20 place-items-center
|
||||
bg-slate-200 dark:bg-zinc-900 border border-slate-300 dark:border-zinc-800 rounded-full
|
||||
transition-all"
|
||||
>
|
||||
<Icon src={PaintBrush} mini size="14" />
|
||||
</div>
|
||||
<input
|
||||
type="color"
|
||||
class="opacity-0 absolute top-0 left-0 h-full w-full rounded-full cursor-pointer z-30"
|
||||
bind:value={profile.color}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{profile.username}</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-auto" />
|
||||
<Menu placement="bottom-end">
|
||||
<Button size="square-md" slot="target">
|
||||
<Icon src={EllipsisHorizontal} mini size="16" slot="prefix" />
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<Button href="/accounts/login/guest" size="lg">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('account.addGuest')}
|
||||
</Button>
|
||||
<div class="px-4 py-2 flex items-center gap-2">
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
on:click={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
<Icon src={ChevronUp} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
on:click={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
<MenuButton
|
||||
disabled={!profile.color}
|
||||
on:click={() => (profile.color = undefined)}
|
||||
>
|
||||
<Icon src={ArrowUturnLeft} size="16" mini slot="prefix" />
|
||||
{$t('account.resetColor')}
|
||||
</MenuButton>
|
||||
{#if $userSettings.debugInfo}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
debugProfile = profile
|
||||
debugging = !debugging
|
||||
}}
|
||||
>
|
||||
<Icon src={BugAnt} size="16" mini slot="prefix" />
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if !LINKED_INSTANCE_URL || profile.user}
|
||||
<MenuButton
|
||||
on:click={() => action(profile)}
|
||||
color="danger-subtle"
|
||||
>
|
||||
<Icon
|
||||
slot="prefix"
|
||||
src={ArrowRightOnRectangle}
|
||||
size="16"
|
||||
mini
|
||||
/>
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</EditableList>
|
||||
</FilterTabs>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
<FilterTabs items={$profileData.profiles} id={(i) => i.instance} >
|
||||
{#snippet children({ items })}
|
||||
<EditableList
|
||||
on:action={(acc) => {
|
||||
removing.account = acc.detail
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
|
||||
>
|
||||
{#snippet children({ action })}
|
||||
{#each items as profile, index (profile.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-3"
|
||||
transition:fly={{ duration: 500, y: -12, easing: expoOut }}
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
>
|
||||
<Button
|
||||
title={profile.id == $currentProfile?.id ? 'Switch' : 'Current'}
|
||||
on:click={async () => {
|
||||
if (profile.id != $currentProfile?.id) {
|
||||
switching = profile.id
|
||||
await setUserID(profile.id)
|
||||
switching = -69
|
||||
}
|
||||
}}
|
||||
size="square-md"
|
||||
color={profile.id == $currentProfile?.id ? 'primary' : 'ghost'}
|
||||
loading={switching == profile.id}
|
||||
disabled={switching == profile.id}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
|
||||
{#if profile.id == $currentProfile?.id}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{:else}
|
||||
<Icon src={ArrowsRightLeft} size="16" mini />
|
||||
{/if}
|
||||
|
||||
{/snippet}
|
||||
</Button>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative group flex-col items-center">
|
||||
<ProfileAvatar
|
||||
{profile}
|
||||
{index}
|
||||
selected={$currentProfile?.id == profile.id}
|
||||
size={24}
|
||||
/>
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full opacity-0
|
||||
grid group-hover:opacity-100 z-20 place-items-center
|
||||
bg-slate-200 dark:bg-zinc-900 border border-slate-300 dark:border-zinc-800 rounded-full
|
||||
transition-all"
|
||||
>
|
||||
<Icon src={PaintBrush} mini size="14" />
|
||||
</div>
|
||||
<input
|
||||
type="color"
|
||||
class="opacity-0 absolute top-0 left-0 h-full w-full rounded-full cursor-pointer z-30"
|
||||
bind:value={profile.color}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{profile.username}</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-auto"></div>
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" >
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<div class="px-4 py-2 flex items-center gap-2">
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
on:click={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
on:click={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<MenuButton
|
||||
disabled={!profile.color}
|
||||
on:click={() => (profile.color = undefined)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUturnLeft} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.resetColor')}
|
||||
</MenuButton>
|
||||
{#if $userSettings.debugInfo}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
debugProfile = profile
|
||||
debugging = !debugging
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if !LINKED_INSTANCE_URL || profile.user}
|
||||
<MenuButton
|
||||
on:click={() => action(profile)}
|
||||
color="danger-subtle"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
|
||||
src={ArrowRightOnRectangle}
|
||||
size="16"
|
||||
mini
|
||||
/>
|
||||
{/snippet}
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</FilterTabs>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -4,6 +4,13 @@
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { Badge } from 'mono-svelte'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
{#if $notifications.applications > 0}
|
||||
@@ -44,5 +51,5 @@
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -9,7 +9,7 @@
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.applications.title')}</Header>
|
||||
|
||||
@@ -15,12 +15,16 @@
|
||||
import ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let application: RegistrationApplicationView
|
||||
interface Props {
|
||||
application: RegistrationApplicationView;
|
||||
}
|
||||
|
||||
let approving = false
|
||||
let denying = false
|
||||
let denyReason = ''
|
||||
let reviewing = false
|
||||
let { application = $bindable() }: Props = $props();
|
||||
|
||||
let approving = $state(false)
|
||||
let denying = $state(false)
|
||||
let denyReason = $state('')
|
||||
let reviewing = $state(false)
|
||||
|
||||
async function review(approve: boolean) {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -114,7 +118,7 @@
|
||||
</div>
|
||||
<p>{application.registration_application.deny_reason}</p>
|
||||
</div>
|
||||
<div class="md:ml-auto" />
|
||||
<div class="md:ml-auto"></div>
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<UserLink avatar user={application.admin} />
|
||||
@@ -124,7 +128,7 @@
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
</div>
|
||||
<div class="md:ml-auto" />
|
||||
<div class="md:ml-auto"></div>
|
||||
{/if}
|
||||
{/if}
|
||||
<div class="ml-auto self-end">
|
||||
@@ -139,7 +143,9 @@
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
<Icon src={XMark} mini size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
@@ -152,7 +158,9 @@
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
<Icon src={Check} mini size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { Label, Switch, toast } from 'mono-svelte'
|
||||
@@ -11,14 +13,18 @@
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
interface Props {
|
||||
data: PageData;
|
||||
}
|
||||
|
||||
const formData: Omit<EditSite, 'auth'> | undefined = data.site
|
||||
let { data }: Props = $props();
|
||||
|
||||
const formData: Omit<EditSite, 'auth'> | undefined = $state(data.site
|
||||
? {
|
||||
...data.site.site_view.local_site,
|
||||
...data.site.site_view.site,
|
||||
}
|
||||
: undefined
|
||||
: undefined)
|
||||
|
||||
async function save() {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -44,19 +50,19 @@
|
||||
saving = false
|
||||
}
|
||||
|
||||
let saving = false
|
||||
let saving = $state(false)
|
||||
|
||||
let uploading = {
|
||||
let uploading = $state({
|
||||
icon: false,
|
||||
banner: false,
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$t('routes.admin.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<form class="flex flex-col gap-4" on:submit|preventDefault={save}>
|
||||
<form class="flex flex-col gap-4" onsubmit={preventDefault(save)}>
|
||||
<Header pageHeader>{$t('routes.admin.config.title')}</Header>
|
||||
{#if formData}
|
||||
<TextInput bind:value={formData.name} label={$t('form.name')} />
|
||||
@@ -78,7 +84,7 @@
|
||||
<Label>{$t('routes.admin.config.icon')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.icon = !uploading.icon)}
|
||||
onclick={() => (uploading.icon = !uploading.icon)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.icon}
|
||||
@@ -106,7 +112,7 @@
|
||||
<Label>{$t('routes.admin.config.banner')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.banner = !uploading.banner)}
|
||||
onclick={() => (uploading.banner = !uploading.banner)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.banner}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
@@ -29,17 +31,17 @@
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let blockInstance = {
|
||||
let blockInstance = $state({
|
||||
instance: '',
|
||||
loading: false,
|
||||
},
|
||||
allowInstance = {
|
||||
}),
|
||||
allowInstance = $state({
|
||||
instance: '',
|
||||
loading: false,
|
||||
},
|
||||
saving = false
|
||||
}),
|
||||
saving = $state(false)
|
||||
|
||||
const moderateInstance = async (instance: string, blocked: boolean) => {
|
||||
if (instance == '') return
|
||||
@@ -117,7 +119,7 @@
|
||||
saving = false
|
||||
}
|
||||
|
||||
let csv: FileList | null
|
||||
let csv: FileList | null = $state()
|
||||
|
||||
async function parseCsv(files: FileList) {
|
||||
if (!(files.length > 0)) return
|
||||
@@ -162,9 +164,9 @@
|
||||
reader.readAsText(files[0])
|
||||
}
|
||||
|
||||
$: {
|
||||
run(() => {
|
||||
if (csv) parseCsv(csv)
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -179,20 +181,26 @@
|
||||
</Header>
|
||||
{#if data.site && data.federated_instances?.federated_instances?.blocked}
|
||||
<FileInput preview={false} bind:files={csv}>
|
||||
<Button class="w-max" slot="button">
|
||||
<Icon src={Plus} mini size="18" slot="prefix" />
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
<svelte:fragment slot="choose">
|
||||
{''}
|
||||
</svelte:fragment>
|
||||
{#snippet button()}
|
||||
<Button class="w-max" >
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#snippet choose()}
|
||||
|
||||
{''}
|
||||
|
||||
{/snippet}
|
||||
</FileInput>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-1 w-full max-h-[42rem] h-full flex flex-col gap-2">
|
||||
<h2 class="font-bold text-lg">{$t('routes.admin.federation.blocked')}</h2>
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
moderateInstance(blockInstance.instance, true)}
|
||||
onsubmit={preventDefault(() =>
|
||||
moderateInstance(blockInstance.instance, true))}
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
@@ -242,7 +250,9 @@
|
||||
)
|
||||
}}
|
||||
>
|
||||
<Icon src={XMark} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -261,13 +271,15 @@
|
||||
<span>{$t('routes.admin.federation.allowed')}</span>
|
||||
{#if allowInstance.instance || !(data.federated_instances.federated_instances.allowed?.length == 0)}
|
||||
<Popover openOnHover placement="bottom-end">
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
solid
|
||||
class="text-yellow-500"
|
||||
slot="target"
|
||||
size="20"
|
||||
/>
|
||||
{#snippet target()}
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
solid
|
||||
class="text-yellow-500"
|
||||
|
||||
size="20"
|
||||
/>
|
||||
{/snippet}
|
||||
<p class="font-normal">
|
||||
{$t('routes.admin.federation.emptyAllow.description')}
|
||||
</p>
|
||||
@@ -275,8 +287,8 @@
|
||||
{/if}
|
||||
</h2>
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
moderateInstance(allowInstance.instance, false)}
|
||||
onsubmit={preventDefault(() =>
|
||||
moderateInstance(allowInstance.instance, false))}
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
@@ -322,7 +334,9 @@
|
||||
)
|
||||
}}
|
||||
>
|
||||
<Icon src={XMark} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
@@ -12,12 +14,12 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
let taglines = [...(data.site?.taglines.map((t: Tagline) => t.content) ?? [])]
|
||||
let newTagline = ''
|
||||
let taglines = $state([...(data.site?.taglines.map((t: Tagline) => t.content) ?? [])])
|
||||
let newTagline = $state('')
|
||||
|
||||
let saving = false
|
||||
let saving = $state(false)
|
||||
|
||||
async function save() {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -58,7 +60,7 @@
|
||||
</Header>
|
||||
|
||||
<EditableList
|
||||
let:action
|
||||
|
||||
on:action={(e) => {
|
||||
taglines.splice(
|
||||
taglines.findIndex((i) => i == e.detail),
|
||||
@@ -69,32 +71,36 @@
|
||||
taglines = taglines
|
||||
}}
|
||||
>
|
||||
{#each taglines as tagline}
|
||||
<div class="flex py-3">
|
||||
<Markdown source={tagline} inline />
|
||||
{#snippet children({ action })}
|
||||
{#each taglines as tagline}
|
||||
<div class="flex py-3">
|
||||
<Markdown source={tagline} inline />
|
||||
|
||||
<div class="flex gap-2 ml-auto">
|
||||
<Button on:click={() => action(tagline)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
<div class="flex gap-2 ml-auto">
|
||||
<Button on:click={() => action(tagline)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</EditableList>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
<form
|
||||
class="flex flex-col mt-auto gap-2 w-full"
|
||||
on:submit|preventDefault={() => {
|
||||
onsubmit={preventDefault(() => {
|
||||
if (newTagline == '' || !data.site) return
|
||||
|
||||
taglines = [...taglines, newTagline]
|
||||
|
||||
newTagline = ''
|
||||
}}
|
||||
})}
|
||||
>
|
||||
<MarkdownEditor bind:value={newTagline} images={false} />
|
||||
|
||||
<Button size="lg" submit>
|
||||
<Icon src={Plus} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -108,13 +114,13 @@
|
||||
<div class="mt-4 max-w-xl w-full flex flex-col gap-2">
|
||||
<form
|
||||
class="flex flex-col gap-2 w-full"
|
||||
on:submit|preventDefault={() => {
|
||||
onsubmit={preventDefault(() => {
|
||||
if (newTagline == '' || !data.site) return
|
||||
|
||||
taglines = [...taglines, newTagline]
|
||||
|
||||
newTagline = ''
|
||||
}}
|
||||
})}
|
||||
>
|
||||
<MarkdownEditor
|
||||
bind:value={newTagline}
|
||||
@@ -123,7 +129,9 @@
|
||||
/>
|
||||
|
||||
<Button size="lg" submit>
|
||||
<Icon src={Plus} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
@@ -13,10 +15,10 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let newAdmin: string = '',
|
||||
adding: boolean = false
|
||||
let newAdmin: string = $state(''),
|
||||
adding: boolean = $state(false)
|
||||
|
||||
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
||||
if (!confirm)
|
||||
@@ -46,27 +48,29 @@
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.team.title')}</Header>
|
||||
{#if data.site}
|
||||
<EditableList let:action on:action={(e) => removeAdmin(e.detail, false)}>
|
||||
{#if data.site.admins.length <= 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title={$t('routes.admin.team.empty.title')}
|
||||
description={$t('routes.admin.team.empty.description')}
|
||||
/>
|
||||
{:else}
|
||||
{#each data.site?.admins ?? [] as admin}
|
||||
<div class="py-3 flex items-center justify-between">
|
||||
<UserLink avatar showInstance={false} user={admin.person} />
|
||||
<Button on:click={() => action(admin.person.id)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</EditableList>
|
||||
<EditableList on:action={(e) => removeAdmin(e.detail, false)}>
|
||||
{#snippet children({ action })}
|
||||
{#if data.site.admins.length <= 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title={$t('routes.admin.team.empty.title')}
|
||||
description={$t('routes.admin.team.empty.description')}
|
||||
/>
|
||||
{:else}
|
||||
{#each data.site?.admins ?? [] as admin}
|
||||
<div class="py-3 flex items-center justify-between">
|
||||
<UserLink avatar showInstance={false} user={admin.person} />
|
||||
<Button on:click={() => action(admin.person.id)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
<form
|
||||
class="flex flex-row items-center gap-2 mt-auto w-full"
|
||||
on:submit|preventDefault={() => {
|
||||
onsubmit={preventDefault(() => {
|
||||
trycatch(async () => {
|
||||
if (!$profile?.jwt || newAdmin == '') return
|
||||
adding = true
|
||||
@@ -84,7 +88,7 @@
|
||||
newAdmin = ''
|
||||
adding = false
|
||||
})
|
||||
}}
|
||||
})}
|
||||
>
|
||||
<TextInput
|
||||
bind:value={newAdmin}
|
||||
@@ -93,7 +97,9 @@
|
||||
pattern={'@[^ |]{1,}'}
|
||||
/>
|
||||
<Button loading={adding} disabled={adding} size="md" class="h-full" submit>
|
||||
<Icon src={Plus} mini size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
export let data
|
||||
let { data, children } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -16,4 +16,4 @@
|
||||
/>
|
||||
{/if}
|
||||
</svelte:head>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
@@ -31,11 +33,14 @@
|
||||
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
$: community = data.community.community_view
|
||||
let community;
|
||||
run(() => {
|
||||
community = data.community.community_view
|
||||
});
|
||||
|
||||
let sidebar: boolean = false
|
||||
let sidebar: boolean = $state(false)
|
||||
|
||||
onMount(() => {
|
||||
if (browser)
|
||||
@@ -63,7 +68,9 @@
|
||||
|
||||
{#if sidebar}
|
||||
<Modal bind:open={sidebar}>
|
||||
<span slot="title">About</span>
|
||||
{#snippet title()}
|
||||
<span >About</span>
|
||||
{/snippet}
|
||||
<div>
|
||||
<CommunityCard
|
||||
bind:community_view={community}
|
||||
@@ -83,7 +90,9 @@
|
||||
counts={community.counts}
|
||||
class="w-full relative"
|
||||
/>
|
||||
<Sort selected={data.sort} slot="extended" />
|
||||
{#snippet extended()}
|
||||
<Sort selected={data.sort} />
|
||||
{/snippet}
|
||||
</Header>
|
||||
{#if community.blocked}
|
||||
<Placeholder
|
||||
@@ -92,13 +101,15 @@
|
||||
description="You've blocked this community."
|
||||
>
|
||||
<Button href="/profile/blocks">
|
||||
<Icon src={ArrowRight} size="16" mini slot="suffix" />
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
Blocked Communities
|
||||
</Button>
|
||||
</Placeholder>
|
||||
{:else}
|
||||
<svelte:component
|
||||
this={browser ? VirtualFeed : PostFeed}
|
||||
{@const SvelteComponent = browser ? VirtualFeed : PostFeed}
|
||||
<SvelteComponent
|
||||
posts={data.posts.posts}
|
||||
bind:feedData={data}
|
||||
feedId="community"
|
||||
|
||||
@@ -8,12 +8,17 @@
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
export let data: PageData
|
||||
interface Props {
|
||||
data: PageData;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
$: communityUrl = `/c/${fullCommunityName(
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
let communityUrl = $derived(`/c/${fullCommunityName(
|
||||
data.community.community_view.community.name,
|
||||
data.community.community_view.community.actor_id
|
||||
)}`
|
||||
)}`)
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
@@ -34,5 +39,5 @@
|
||||
]}
|
||||
></Tabs>
|
||||
</div>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -3,16 +3,18 @@
|
||||
import CommunityTitle from '$lib/components/lemmy/community/CommunityTitle.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<Header pageHeader>
|
||||
<span>Settings</span>
|
||||
<CommunityTitle
|
||||
slot="extended"
|
||||
community={data.community.community_view.community}
|
||||
/>
|
||||
{#snippet extended()}
|
||||
<CommunityTitle
|
||||
|
||||
community={data.community.community_view.community}
|
||||
/>
|
||||
{/snippet}
|
||||
</Header>
|
||||
<CommunityForm
|
||||
edit={data.community.community_view.community.id}
|
||||
@@ -29,6 +31,8 @@
|
||||
submitting: false,
|
||||
}}
|
||||
>
|
||||
<svelte:fragment slot="formtitle">{''}</svelte:fragment>
|
||||
{#snippet formtitle()}
|
||||
{''}
|
||||
{/snippet}
|
||||
</CommunityForm>
|
||||
</div>
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
@@ -12,12 +14,16 @@
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
interface Props {
|
||||
data: PageData;
|
||||
}
|
||||
|
||||
let formData = {
|
||||
let { data = $bindable() }: Props = $props();
|
||||
|
||||
let formData = $state({
|
||||
newModerator: '',
|
||||
addingModerator: false,
|
||||
}
|
||||
})
|
||||
|
||||
async function addModerator() {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -103,7 +109,7 @@
|
||||
|
||||
<Header pageHeader>Moderators</Header>
|
||||
<EditableList
|
||||
let:action
|
||||
|
||||
on:action={(e) => {
|
||||
toast({
|
||||
content: `Are you sure you want to remove ${e.detail.name} as a moderator?`,
|
||||
@@ -111,31 +117,33 @@
|
||||
})
|
||||
}}
|
||||
>
|
||||
{#each data.community.moderators as moderator (moderator.moderator.id)}
|
||||
<div
|
||||
class="py-4 flex items-center gap-2 justify-between"
|
||||
animate:flip={{ duration: 300 }}
|
||||
>
|
||||
<div class="flex gap-2 items-center">
|
||||
<Avatar
|
||||
width={28}
|
||||
url={moderator.moderator.avatar}
|
||||
alt={moderator.moderator.name}
|
||||
/>
|
||||
<div class="flex flex-col gap-0">
|
||||
<UserLink user={moderator.moderator} showInstance={false} />
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(moderator.moderator.actor_id).hostname}
|
||||
</span>
|
||||
{#snippet children({ action })}
|
||||
{#each data.community.moderators as moderator (moderator.moderator.id)}
|
||||
<div
|
||||
class="py-4 flex items-center gap-2 justify-between"
|
||||
animate:flip={{ duration: 300 }}
|
||||
>
|
||||
<div class="flex gap-2 items-center">
|
||||
<Avatar
|
||||
width={28}
|
||||
url={moderator.moderator.avatar}
|
||||
alt={moderator.moderator.name}
|
||||
/>
|
||||
<div class="flex flex-col gap-0">
|
||||
<UserLink user={moderator.moderator} showInstance={false} />
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(moderator.moderator.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button size="square-md" on:click={() => action(moderator.moderator)}>
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
<Button size="square-md" on:click={() => action(moderator.moderator)}>
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
<form on:submit|preventDefault={addModerator} class="mt-auto flex gap-2 w-full">
|
||||
<form onsubmit={preventDefault(addModerator)} class="mt-auto flex gap-2 w-full">
|
||||
<TextInput
|
||||
bind:value={formData.newModerator}
|
||||
class="w-full"
|
||||
@@ -149,6 +157,8 @@
|
||||
color="primary"
|
||||
submit
|
||||
>
|
||||
<Icon slot="prefix" src={Plus} micro size="16" /> Add moderator
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet} Add moderator
|
||||
</Button>
|
||||
</form>
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import {
|
||||
GlobeAmericas,
|
||||
@@ -29,22 +31,22 @@
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
let search = data.query || ''
|
||||
let searchElement: HTMLInputElement
|
||||
let search = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement = $state()
|
||||
let instance = ''
|
||||
|
||||
let virtualList: HTMLDivElement
|
||||
let offset: number = 0
|
||||
let virtualList: HTMLDivElement = $state()
|
||||
let offset: number = $state(0)
|
||||
|
||||
$: showTop =
|
||||
(data.query ?? '' != '') && data.communities.length > 0 && data.page == 1
|
||||
let showTop =
|
||||
$derived((data.query ?? '' != '') && data.communities.length > 0 && data.page == 1)
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
bind:scrollY={offset}
|
||||
on:keydown={(e) => {
|
||||
onkeydown={(e) => {
|
||||
if (e.target == document.body) searchElement?.focus()
|
||||
}}
|
||||
/>
|
||||
@@ -62,8 +64,8 @@
|
||||
>
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
searchParam($page.url, 'q', search, 'page')}
|
||||
onsubmit={preventDefault(() =>
|
||||
searchParam($page.url, 'q', search, 'page'))}
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
@@ -83,7 +85,9 @@
|
||||
rounding="pill"
|
||||
loading={$navigating != null}
|
||||
>
|
||||
<Icon src={MagnifyingGlass} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
|
||||
@@ -4,9 +4,14 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
|
||||
export let community: CommunityView | undefined = undefined
|
||||
interface Props {
|
||||
community?: CommunityView | undefined;
|
||||
children?: import('svelte').Snippet<[any]>;
|
||||
}
|
||||
|
||||
let subscribing = false
|
||||
let { community = undefined, children }: Props = $props();
|
||||
|
||||
let subscribing = $state(false)
|
||||
|
||||
async function subscribe(
|
||||
id: number | undefined = community?.community.id,
|
||||
@@ -33,4 +38,4 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<slot {subscribe} {subscribing} />
|
||||
{@render children?.({ subscribe, subscribing, })}
|
||||
@@ -7,9 +7,9 @@
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data = {
|
||||
let { data = {
|
||||
crosspost: false,
|
||||
}
|
||||
} } = $props();
|
||||
|
||||
onMount(() => {
|
||||
if (!$profile?.jwt) {
|
||||
@@ -48,8 +48,10 @@
|
||||
passedCommunity={community}
|
||||
on:submit={(e) => goto(`/post/${e.detail.post.id}`)}
|
||||
>
|
||||
<Header class="text-3xl font-bold" slot="formtitle" pageHeader>
|
||||
{$t('routes.createPost')}
|
||||
</Header>
|
||||
{#snippet formtitle()}
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
{$t('routes.createPost')}
|
||||
</Header>
|
||||
{/snippet}
|
||||
</PostForm>
|
||||
</div>
|
||||
@@ -25,9 +25,9 @@
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
let markingAsRead = false
|
||||
let markingAsRead = $state(false)
|
||||
|
||||
async function markAllAsRead() {
|
||||
if (!$profile?.user) {
|
||||
@@ -141,7 +141,9 @@ items-center px-2 w-max"
|
||||
rounding="xl"
|
||||
title={$t('common.refresh')}
|
||||
>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={markAllAsRead}
|
||||
@@ -150,7 +152,9 @@ items-center px-2 w-max"
|
||||
size="lg"
|
||||
class="h-10"
|
||||
>
|
||||
<Icon src={Check} width={16} mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} width={16} mini />
|
||||
{/snippet}
|
||||
{$t('routes.inbox.markAsRead')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -28,11 +28,15 @@
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
|
||||
export let item: InboxItem
|
||||
interface Props {
|
||||
item: InboxItem;
|
||||
}
|
||||
|
||||
let replying = false
|
||||
let { item = $bindable() }: Props = $props();
|
||||
|
||||
let replying = $state(false)
|
||||
let reply = ''
|
||||
let loading = false
|
||||
let loading = $state(false)
|
||||
|
||||
async function markAsRead(isRead: boolean) {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -74,55 +78,90 @@
|
||||
{/if}
|
||||
|
||||
<Expandable open icon={false}>
|
||||
<div class="flex flex-row gap-2 items-center w-full" slot="title">
|
||||
<Avatar
|
||||
url={item.creator.avatar}
|
||||
circle={false}
|
||||
width={28}
|
||||
alt={item.creator.name}
|
||||
/>
|
||||
<!-- <div class="rounded-full p-1 border border-slate-200 dark:border-zinc-800">
|
||||
<Icon
|
||||
src={item.type == 'comment_reply'
|
||||
? ChatBubbleOvalLeft
|
||||
: item.type == 'private_message'
|
||||
? Envelope
|
||||
: item.type == 'person_mention'
|
||||
? AtSymbol
|
||||
: AtSymbol}
|
||||
size="20"
|
||||
mini
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
{#snippet title()}
|
||||
<div class="flex flex-row gap-2 items-center w-full" >
|
||||
<Avatar
|
||||
url={item.creator.avatar}
|
||||
circle={false}
|
||||
width={28}
|
||||
alt={item.creator.name}
|
||||
/>
|
||||
</div> -->
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm font-normal">
|
||||
{#if item.type == 'comment_reply'}
|
||||
{@html $t('routes.inbox.item.reply', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'person_mention'}
|
||||
{@html $t('routes.inbox.item.mention', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'private_message'}
|
||||
{@html $t('routes.inbox.item.message', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.item.creator.name}</span>`,
|
||||
recipient: `<span class="font-medium">${item.item.recipient.name}</span>`,
|
||||
})}
|
||||
<!-- <div class="rounded-full p-1 border border-slate-200 dark:border-zinc-800">
|
||||
<Icon
|
||||
src={item.type == 'comment_reply'
|
||||
? ChatBubbleOvalLeft
|
||||
: item.type == 'private_message'
|
||||
? Envelope
|
||||
: item.type == 'person_mention'
|
||||
? AtSymbol
|
||||
: AtSymbol}
|
||||
size="20"
|
||||
mini
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
</div> -->
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm font-normal">
|
||||
{#if item.type == 'comment_reply'}
|
||||
{@html $t('routes.inbox.item.reply', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'person_mention'}
|
||||
{@html $t('routes.inbox.item.mention', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'private_message'}
|
||||
{@html $t('routes.inbox.item.message', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.item.creator.name}</span>`,
|
||||
recipient: `<span class="font-medium">${item.item.recipient.name}</span>`,
|
||||
})}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
<RelativeDate date={publishedToDate(item.published)} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
<div class="flex gap-2 max-md:hidden flex-shrink-0">
|
||||
<Button
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={(e) => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
class="flex-shrink-0"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
</Button>
|
||||
{#if item.type == 'comment_reply' || item.type == 'person_mention'}
|
||||
<Button
|
||||
href="/comment/{item.item.comment.id}"
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
class="flex-shrink-0"
|
||||
>
|
||||
{$t('common.jump')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
<RelativeDate date={publishedToDate(item.published)} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1" />
|
||||
<div class="flex gap-2 max-md:hidden flex-shrink-0">
|
||||
{/snippet}
|
||||
{#snippet extended()}
|
||||
<div class="flex gap-2 w-full md:hidden mt-1">
|
||||
<Button
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
@@ -133,61 +172,36 @@
|
||||
}}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
class="flex-shrink-0"
|
||||
>
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
</Button>
|
||||
{#if item.type == 'comment_reply' || item.type == 'person_mention'}
|
||||
<Button
|
||||
href="/comment/{item.item.comment.id}"
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
class="flex-shrink-0"
|
||||
>
|
||||
<Button href="/comment/{item.item.comment.id}" size="sm" rounding="pill">
|
||||
{$t('common.jump')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div slot="extended" class="flex gap-2 w-full md:hidden mt-1">
|
||||
<Button
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={(e) => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
>
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro slot="prefix" />
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
</Button>
|
||||
{#if item.type == 'comment_reply' || item.type == 'person_mention'}
|
||||
<Button href="/comment/{item.item.comment.id}" size="sm" rounding="pill">
|
||||
{$t('common.jump')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
<svelte:fragment slot="content">
|
||||
{#if item.type == 'comment_reply' || item.type == 'person_mention'}
|
||||
<CommentItem
|
||||
comment={item.item}
|
||||
community={false}
|
||||
view="cozy"
|
||||
meta={false}
|
||||
class="pt-0 pb-0"
|
||||
/>
|
||||
{:else}
|
||||
<PrivateMessage message={item.item} meta={false} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
{/snippet}
|
||||
{#snippet content()}
|
||||
|
||||
{#if item.type == 'comment_reply' || item.type == 'person_mention'}
|
||||
<CommentItem
|
||||
comment={item.item}
|
||||
community={false}
|
||||
view="cozy"
|
||||
meta={false}
|
||||
class="pt-0 pb-0"
|
||||
/>
|
||||
{:else}
|
||||
<PrivateMessage message={item.item} meta={false} />
|
||||
{/if}
|
||||
|
||||
{/snippet}
|
||||
</Expandable>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
}))
|
||||
}
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { Button, Material, Spinner, TextInput, toast } from 'mono-svelte'
|
||||
import Message from './Message.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
@@ -15,14 +17,14 @@
|
||||
import { report } from '$lib/components/lemmy/moderation/moderation'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let textbox = {
|
||||
let textbox = $state({
|
||||
message: '',
|
||||
loading: false,
|
||||
}
|
||||
})
|
||||
|
||||
let chatWindow: HTMLDivElement
|
||||
let chatWindow: HTMLDivElement = $state()
|
||||
|
||||
async function sendMessage(
|
||||
message: string
|
||||
@@ -50,11 +52,13 @@
|
||||
textbox.loading = false
|
||||
}
|
||||
|
||||
$: if (browser && data.message && chatWindow) {
|
||||
tick().then(() =>
|
||||
chatWindow.scrollTo({ top: chatWindow.scrollHeight, behavior: 'smooth' })
|
||||
)
|
||||
}
|
||||
run(() => {
|
||||
if (browser && data.message && chatWindow) {
|
||||
tick().then(() =>
|
||||
chatWindow.scrollTo({ top: chatWindow.scrollHeight, behavior: 'smooth' })
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
async function deleteMessage(id: number) {
|
||||
const res = await client().deletePrivateMessage({
|
||||
@@ -85,7 +89,7 @@
|
||||
>
|
||||
<div class="h-full overflow-auto" bind:this={chatWindow}>
|
||||
<ul id="chat-window" class="flex flex-col gap-1 flex-1 px-4 py-4">
|
||||
<div class="mt-auto" />
|
||||
<div class="mt-auto"></div>
|
||||
{#each data.message.private_messages.toReversed() as private_message, index (private_message.private_message.id)}
|
||||
<div
|
||||
class={private_message.creator.id == data.creator
|
||||
@@ -117,7 +121,7 @@
|
||||
border-slate-200 dark:border-zinc-800
|
||||
p-2 gap-2 backdrop-blur-xl
|
||||
bg-white/50 dark:bg-zinc-950/50 border rounded-2xl"
|
||||
on:submit|preventDefault={async () => {
|
||||
onsubmit={preventDefault(async () => {
|
||||
const res = await sendMessage(textbox.message)
|
||||
if (!res) return
|
||||
|
||||
@@ -129,7 +133,7 @@
|
||||
}
|
||||
|
||||
textbox.message = ''
|
||||
}}
|
||||
})}
|
||||
>
|
||||
<TextInput
|
||||
bind:value={textbox.message}
|
||||
@@ -146,7 +150,9 @@
|
||||
loading={textbox.loading}
|
||||
disabled={textbox.loading}
|
||||
>
|
||||
<Icon src={PaperAirplane} size="18" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={PaperAirplane} size="18" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { EllipsisVertical, Flag, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
export let message: PrivateMessageView
|
||||
export let primary: boolean = false
|
||||
interface Props {
|
||||
message: PrivateMessageView;
|
||||
primary?: boolean;
|
||||
}
|
||||
|
||||
let { message, primary = false }: Props = $props();
|
||||
|
||||
const dispatch = createEventDispatcher<{ delete: boolean; report: boolean }>()
|
||||
</script>
|
||||
@@ -28,23 +32,27 @@
|
||||
<Markdown source={message.private_message.content} inline />
|
||||
</div>
|
||||
<Menu>
|
||||
<Button
|
||||
color="tertiary"
|
||||
class="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-all flex-shrink-0"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
slot="target"
|
||||
title={$t('post.actions.more.actions')}
|
||||
>
|
||||
<Icon src={EllipsisVertical} size="16" micro />
|
||||
</Button>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
color="tertiary"
|
||||
class="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-all flex-shrink-0"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
|
||||
title={$t('post.actions.more.actions')}
|
||||
>
|
||||
<Icon src={EllipsisVertical} size="16" micro />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('post.actions.more.actions')}</MenuDivider>
|
||||
{#if primary}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => dispatch('delete', true)}
|
||||
>
|
||||
<Icon src={Trash} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{:else}
|
||||
@@ -52,7 +60,9 @@
|
||||
color="danger-subtle"
|
||||
on:click={() => dispatch('report', true)}
|
||||
>
|
||||
<Icon src={Flag} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<Header pageHeader>Linked Instances</Header>
|
||||
@@ -17,7 +17,9 @@
|
||||
<h2 class="font-bold text-xl flex flex-row items-center gap-1">
|
||||
Linked
|
||||
<Popover openOnHover>
|
||||
<Icon src={InformationCircle} mini size="20" slot="target" />
|
||||
{#snippet target()}
|
||||
<Icon src={InformationCircle} mini size="20" />
|
||||
{/snippet}
|
||||
<p class="font-normal">
|
||||
These are the instances your instance can see and interact with
|
||||
content from.
|
||||
@@ -57,7 +59,9 @@
|
||||
Blocked
|
||||
|
||||
<Popover openOnHover placement="bottom">
|
||||
<Icon src={InformationCircle} mini size="20" slot="target" />
|
||||
{#snippet target()}
|
||||
<Icon src={InformationCircle} mini size="20" />
|
||||
{/snippet}
|
||||
<p class="font-normal">
|
||||
These are the instances your instance is explicitly blocking content
|
||||
from.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import { Note, toast } from 'mono-svelte'
|
||||
@@ -27,16 +29,21 @@
|
||||
} from '$lib/components/error/ErrorContainer.svelte'
|
||||
import { page } from '$app/stores'
|
||||
|
||||
export let ref: string = '/'
|
||||
interface Props {
|
||||
ref?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let data = {
|
||||
let { ref = '/', children }: Props = $props();
|
||||
|
||||
let data = $state({
|
||||
instance: DEFAULT_INSTANCE_URL,
|
||||
username: '',
|
||||
password: '',
|
||||
totp: '',
|
||||
loading: false,
|
||||
attempts: 0,
|
||||
}
|
||||
})
|
||||
|
||||
async function logIn() {
|
||||
data.loading = true
|
||||
@@ -89,9 +96,9 @@
|
||||
</svelte:head>
|
||||
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={logIn} class="flex flex-col gap-5">
|
||||
<form onsubmit={preventDefault(logIn)} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col">
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
<Header>{$t('account.login')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { site, validateInstance } from '$lib/lemmy.js'
|
||||
import { Button, Note, TextInput, toast } from 'mono-svelte'
|
||||
import { MINIMUM_VERSION } from '$lib/version'
|
||||
@@ -10,13 +12,18 @@
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let ref: string = '/'
|
||||
interface Props {
|
||||
ref?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let form = {
|
||||
let { ref = '/', children }: Props = $props();
|
||||
|
||||
let form = $state({
|
||||
instance: '',
|
||||
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
loading: false,
|
||||
}
|
||||
})
|
||||
|
||||
async function addGuest() {
|
||||
form.loading = true
|
||||
@@ -51,9 +58,9 @@
|
||||
</script>
|
||||
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={addGuest} class="flex flex-col gap-5">
|
||||
<form onsubmit={preventDefault(addGuest)} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
<Header>{$t('account.addGuest')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import {
|
||||
DEFAULT_INSTANCE_URL,
|
||||
@@ -9,9 +11,9 @@
|
||||
import { t } from '$lib/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
let instance = LINKED_INSTANCE_URL || $currentInstance || ''
|
||||
let email = ''
|
||||
let loading = false
|
||||
let instance = $state(LINKED_INSTANCE_URL || $currentInstance || '')
|
||||
let email = $state('')
|
||||
let loading = $state(false)
|
||||
|
||||
async function submit() {
|
||||
loading = true
|
||||
@@ -42,7 +44,7 @@
|
||||
<p>
|
||||
{$t('routes.resetLogin.description')}
|
||||
</p>
|
||||
<form class="mt-2 flex flex-col gap-4" on:submit|preventDefault={submit}>
|
||||
<form class="mt-2 flex flex-col gap-4" onsubmit={preventDefault(submit)}>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
bind:value={instance}
|
||||
|
||||
@@ -17,29 +17,33 @@
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<div class="mb-4 flex flex-col gap-4">
|
||||
<Header pageHeader>
|
||||
{$t('routes.moderation.title')}
|
||||
<div class="flex flex-row gap-2 flex-wrap items-end" slot="extended">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
<option value="all">{$t('filter.location.all')}</option>
|
||||
<option value="unread">{$t('filter.unread')}</option>
|
||||
</Select>
|
||||
<Button href="/modlog" class="h-max ml-auto">
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
{$t('routes.modlog')}
|
||||
</Button>
|
||||
</div>
|
||||
{#snippet extended()}
|
||||
<div class="flex flex-row gap-2 flex-wrap items-end" >
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="all">{$t('filter.location.all')}</option>
|
||||
<option value="unread">{$t('filter.unread')}</option>
|
||||
</Select>
|
||||
<Button href="/modlog" class="h-max ml-auto">
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
{$t('routes.modlog')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
</div>
|
||||
{#if data.items && data.items.length > 0}
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
|
||||
export let item: ReportView
|
||||
interface Props {
|
||||
item: ReportView;
|
||||
}
|
||||
|
||||
let resolving = false
|
||||
let { item = $bindable() }: Props = $props();
|
||||
|
||||
let resolving = $state(false)
|
||||
async function resolve() {
|
||||
if (!$profile?.jwt || !$profile.user) return
|
||||
resolving = true
|
||||
@@ -135,7 +139,9 @@
|
||||
loading={resolving}
|
||||
disabled={resolving}
|
||||
>
|
||||
<Icon src={CheckCircle} micro={item.resolved} size="18" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={CheckCircle} micro={item.resolved} size="18" />
|
||||
{/snippet}
|
||||
{!item.resolved
|
||||
? $t('routes.moderation.resolve')
|
||||
: $t('routes.moderation.resolved')}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { page } from '$app/stores'
|
||||
@@ -20,16 +22,18 @@
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let view = `${
|
||||
let view = $state(`${
|
||||
$userSettings.modlogCardView ?? browser
|
||||
? !window.matchMedia('(min-width: 1600px)').matches
|
||||
: false
|
||||
}`
|
||||
}`)
|
||||
|
||||
$: $userSettings.modlogCardView =
|
||||
view == 'true' ? true : view == 'false' ? false : undefined
|
||||
run(() => {
|
||||
$userSettings.modlogCardView =
|
||||
view == 'true' ? true : view == 'false' ? false : undefined
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -44,10 +48,12 @@
|
||||
on:change={(e) => searchParam($page.url, 'type', data.type, 'page')}
|
||||
class="w-48"
|
||||
>
|
||||
<span slot="label" class="flex gap-1 items-center">
|
||||
<Icon src={Bars3BottomRight} size="15" mini />
|
||||
Type
|
||||
</span>
|
||||
{#snippet label()}
|
||||
<span class="flex gap-1 items-center">
|
||||
<Icon src={Bars3BottomRight} size="15" mini />
|
||||
Type
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="All">All</option>
|
||||
<option value="ModRemovePost">Remove Post</option>
|
||||
<option value="ModLockPost">Lock Post</option>
|
||||
@@ -67,10 +73,12 @@
|
||||
</Select>
|
||||
|
||||
<Select bind:value={view} class="w-36">
|
||||
<span slot="label" class="flex gap-1 items-center">
|
||||
<Icon src={ViewColumns} size="15" mini />
|
||||
View
|
||||
</span>
|
||||
{#snippet label()}
|
||||
<span class="flex gap-1 items-center">
|
||||
<Icon src={ViewColumns} size="15" mini />
|
||||
View
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="false">Table</option>
|
||||
<option value="true">Cards</option>
|
||||
<option value="undefined">Default</option>
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import type { ActionName } from './+page.js'
|
||||
|
||||
export let action: ActionName
|
||||
interface Props {
|
||||
action: ActionName;
|
||||
}
|
||||
|
||||
let { action }: Props = $props();
|
||||
|
||||
$: actionData = getAction(action)
|
||||
|
||||
const getAction = (
|
||||
action: ActionName
|
||||
@@ -151,6 +154,7 @@
|
||||
class: '',
|
||||
}
|
||||
}
|
||||
let actionData = $derived(getAction(action))
|
||||
</script>
|
||||
|
||||
<span class="font-bold">
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
import type { ModLog } from '../+page.js'
|
||||
import ModlogAction from '../ModlogAction.svelte'
|
||||
|
||||
export let item: ModLog
|
||||
interface Props {
|
||||
item: ModLog;
|
||||
}
|
||||
|
||||
let { item }: Props = $props();
|
||||
</script>
|
||||
|
||||
<Material padding="lg" class="flex flex-col gap-2">
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
import type { ModLog } from '../+page.js'
|
||||
import ModlogAction from '../ModlogAction.svelte'
|
||||
|
||||
export let item: ModLog
|
||||
interface Props {
|
||||
item: ModLog;
|
||||
}
|
||||
|
||||
let { item }: Props = $props();
|
||||
</script>
|
||||
|
||||
<tr class="">
|
||||
@@ -24,7 +28,7 @@
|
||||
user={item.moderator}
|
||||
/>
|
||||
{:else}
|
||||
<p class="text-slate-500 dark:text-zinc-500">Hidden<p/>
|
||||
<p class="text-slate-500 dark:text-zinc-500">Hidden<p></p>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import {
|
||||
@@ -10,14 +12,18 @@
|
||||
import { t } from '$lib/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
export let data: {
|
||||
interface Props {
|
||||
data: {
|
||||
token: string
|
||||
};
|
||||
}
|
||||
|
||||
let instance = LINKED_INSTANCE_URL || $currentInstance || ''
|
||||
let password = '',
|
||||
password_verify = ''
|
||||
let loading = false
|
||||
let { data }: Props = $props();
|
||||
|
||||
let instance = $state(LINKED_INSTANCE_URL || $currentInstance || '')
|
||||
let password = $state(''),
|
||||
password_verify = $state('')
|
||||
let loading = $state(false)
|
||||
|
||||
async function submit() {
|
||||
loading = true
|
||||
@@ -52,7 +58,7 @@
|
||||
<p>
|
||||
{$t('routes.passwordChange.description')}
|
||||
</p>
|
||||
<form class="mt-2 flex flex-col gap-4" on:submit|preventDefault={submit}>
|
||||
<form class="mt-2 flex flex-col gap-4" onsubmit={preventDefault(submit)}>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
bind:value={instance}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.js'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
@@ -46,9 +48,9 @@
|
||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
$: type = mediaType(data.post.post_view.post.url, 'cozy')
|
||||
let type = $derived(mediaType(data.post.post_view.post.url, 'cozy'))
|
||||
|
||||
const updateActions = () => {
|
||||
// @ts-ignore
|
||||
@@ -96,7 +98,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: if (data.post) updateActions()
|
||||
run(() => {
|
||||
if (data.post) updateActions()
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
if (
|
||||
@@ -147,8 +151,8 @@
|
||||
}
|
||||
|
||||
let commentsPage = 1
|
||||
let commentSort: CommentSortType = data.commentSort
|
||||
let loading = false
|
||||
let commentSort: CommentSortType = $state(data.commentSort)
|
||||
let loading = $state(false)
|
||||
|
||||
async function reloadComments() {
|
||||
loading = true
|
||||
@@ -165,10 +169,10 @@
|
||||
commentsPage = 1
|
||||
}
|
||||
|
||||
let commenting = false
|
||||
let commenting = $state(false)
|
||||
|
||||
$: remoteView =
|
||||
$page.params.instance?.toLowerCase() != $instance.toLowerCase()
|
||||
let remoteView =
|
||||
$derived($page.params.instance?.toLowerCase() != $instance.toLowerCase())
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -215,13 +219,15 @@
|
||||
"
|
||||
>
|
||||
<Popover openOnHover>
|
||||
<Icon
|
||||
src={InformationCircle}
|
||||
size="24"
|
||||
solid
|
||||
slot="target"
|
||||
class="bg-slate-200 dark:bg-zinc-700 p-0.5 rounded-full text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{#snippet target()}
|
||||
<Icon
|
||||
src={InformationCircle}
|
||||
size="24"
|
||||
solid
|
||||
|
||||
class="bg-slate-200 dark:bg-zinc-700 p-0.5 rounded-full text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{/snippet}
|
||||
{$t('routes.post.instanceWarning')}
|
||||
</Popover>
|
||||
<span class="text-primary-900 dark:text-primary-100 font-bold">
|
||||
@@ -267,7 +273,9 @@
|
||||
style="width: max-content;"
|
||||
/>
|
||||
<Button on:click={() => history.back()} size="square-md">
|
||||
<Icon src={ArrowLeft} micro size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<h1 class="font-bold text-xl font-display leading-5">
|
||||
@@ -305,13 +313,15 @@
|
||||
class="text-base mt-2 w-full cursor-pointer"
|
||||
open={data.post.cross_posts?.length <= 3}
|
||||
>
|
||||
<div
|
||||
slot="title"
|
||||
class="inline-block w-full text-left text-base font-normal"
|
||||
>
|
||||
<span class="font-bold">{data.post.cross_posts.length}</span>
|
||||
{$t('routes.post.crosspostCount')}
|
||||
</div>
|
||||
{#snippet title()}
|
||||
<div
|
||||
|
||||
class="inline-block w-full text-left text-base font-normal"
|
||||
>
|
||||
<span class="font-bold">{data.post.cross_posts.length}</span>
|
||||
{$t('routes.post.crosspostCount')}
|
||||
</div>
|
||||
{/snippet}
|
||||
<div
|
||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
@@ -365,9 +375,9 @@
|
||||
<div class="space-y-4">
|
||||
{#each new Array(10) as empty}
|
||||
<div class="animate-pulse flex flex-col gap-2 skeleton w-full">
|
||||
<div class="w-96 h-4" />
|
||||
<div class="w-full h-12" />
|
||||
<div class="w-48 h-4" />
|
||||
<div class="w-96 h-4"></div>
|
||||
<div class="w-full h-12"></div>
|
||||
<div class="w-48 h-4"></div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -380,24 +390,28 @@
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
|
||||
<div class="gap-2 flex items-center" slot="action">
|
||||
<Select
|
||||
size="md"
|
||||
bind:value={commentSort}
|
||||
on:change={reloadComments}
|
||||
>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
{#snippet action()}
|
||||
<div class="gap-2 flex items-center" >
|
||||
<Select
|
||||
size="md"
|
||||
bind:value={commentSort}
|
||||
on:change={reloadComments}
|
||||
>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
{:else}
|
||||
<CommentForm
|
||||
@@ -438,7 +452,9 @@
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -470,14 +486,18 @@
|
||||
</span>
|
||||
{$t('routes.post.commentCount')}
|
||||
|
||||
<Button
|
||||
color="tertiary"
|
||||
on:click={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
slot="action"
|
||||
>
|
||||
<Icon src={ChevronDoubleUp} mini size="16" slot="prefix" />
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
{#snippet action()}
|
||||
<Button
|
||||
color="tertiary"
|
||||
on:click={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDoubleUp} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
@@ -1 +1,11 @@
|
||||
<slot />
|
||||
<script>
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -1,5 +1,15 @@
|
||||
<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"
|
||||
>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -22,12 +22,17 @@
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
export let data: PageData & {
|
||||
|
||||
interface Props {
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
data: PageData & {
|
||||
person_blocks: PersonBlockView[]
|
||||
community_blocks: CommunityBlockView[]
|
||||
};
|
||||
}
|
||||
|
||||
let { data = $bindable() }: Props = $props();
|
||||
|
||||
async function unblockUser(item: PersonBlockView) {
|
||||
if (!$profile?.jwt) return
|
||||
|
||||
@@ -86,77 +91,89 @@
|
||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.instances')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockInstances(i.detail)}>
|
||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-4"
|
||||
animate:flip={{ duration: 250 }}
|
||||
out:slide|local={{ axis: 'y' }}
|
||||
>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
<EditableList on:action={(i) => unblockInstances(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-4"
|
||||
animate:flip={{ duration: 250 }}
|
||||
out:slide|local={{ axis: 'y' }}
|
||||
>
|
||||
<Icon src={XMark} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
<Entity
|
||||
icon={block.site?.icon}
|
||||
name={block.site?.name ?? block.instance.domain}
|
||||
label={block.instance.domain}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</EditableList>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Entity
|
||||
icon={block.site?.icon}
|
||||
name={block.site?.name ?? block.instance.domain}
|
||||
label={block.instance.domain}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.community_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockCommunity(i.detail)}>
|
||||
{#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"
|
||||
on:click={() => action(block)}
|
||||
<EditableList on:action={(i) => unblockCommunity(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#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 }}
|
||||
>
|
||||
<Icon src={XMark} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
<CommunityLink community={block.community} avatar />
|
||||
</div>
|
||||
{/each}
|
||||
</EditableList>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<CommunityLink community={block.community} avatar />
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.person_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.users')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockUser(i.detail)}>
|
||||
{#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"
|
||||
on:click={() => action(block)}
|
||||
<EditableList on:action={(i) => unblockUser(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#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 }}
|
||||
>
|
||||
<Icon src={XMark} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
<UserLink user={block.target} avatar badges />
|
||||
</div>
|
||||
{/each}
|
||||
</EditableList>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<UserLink user={block.target} avatar badges />
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { page } from '$app/stores'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -47,6 +54,6 @@
|
||||
{/each}
|
||||
</nav>
|
||||
<div class="flex-[3] max-w-full w-full min-w-0">
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,7 +10,7 @@
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
@@ -8,14 +10,17 @@
|
||||
import { Button, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { ClipboardDocument, Icon } from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
// @ts-ignore
|
||||
let totpLink: string | undefined = undefined
|
||||
$: totpEnabled =
|
||||
data.my_user?.local_user_view.local_user.totp_2fa_enabled ?? totpLink
|
||||
let totpLink: string | undefined = $state(undefined)
|
||||
let totpEnabled;
|
||||
run(() => {
|
||||
totpEnabled =
|
||||
data.my_user?.local_user_view.local_user.totp_2fa_enabled ?? totpLink
|
||||
});
|
||||
|
||||
let verify_totp = ''
|
||||
let verify_totp = $state('')
|
||||
|
||||
async function twofa(enabled: boolean, update: boolean = false) {
|
||||
try {
|
||||
@@ -59,17 +64,19 @@
|
||||
value={totpLink}
|
||||
label={$t('form.profile.2fa.totp')}
|
||||
>
|
||||
<button
|
||||
slot="suffix"
|
||||
class="contents"
|
||||
on:click={() => {
|
||||
{#snippet suffix()}
|
||||
<button
|
||||
|
||||
class="contents"
|
||||
onclick={() => {
|
||||
if (!totpLink) return
|
||||
navigator.clipboard?.writeText(totpLink)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Icon src={ClipboardDocument} size="20" mini />
|
||||
</button>
|
||||
>
|
||||
<Icon src={ClipboardDocument} size="20" mini />
|
||||
</button>
|
||||
{/snippet}
|
||||
<span class="font-normal text-xs">
|
||||
{$t('form.profile.2fa.paste')}
|
||||
</span>
|
||||
@@ -77,7 +84,7 @@
|
||||
{/if}
|
||||
<form
|
||||
class="flex flex-col gap-2 w-full"
|
||||
on:submit|preventDefault={() => {}}
|
||||
onsubmit={preventDefault(() => {})}
|
||||
>
|
||||
<TextInput
|
||||
bind:value={verify_totp}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { deleteProfile, profile, setUser } from '$lib/auth'
|
||||
import { client } from '$lib/lemmy'
|
||||
import { instance as currentInstance } from '$lib/instance'
|
||||
@@ -6,10 +8,10 @@
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
|
||||
let oldPassword = '',
|
||||
newPassword = '',
|
||||
newPasswordVerify = ''
|
||||
let loading = false
|
||||
let oldPassword = $state(''),
|
||||
newPassword = $state(''),
|
||||
newPasswordVerify = $state('')
|
||||
let loading = $state(false)
|
||||
|
||||
async function changePassword() {
|
||||
try {
|
||||
@@ -42,7 +44,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<form on:submit|preventDefault={changePassword} class="flex flex-col gap-4">
|
||||
<form onsubmit={preventDefault(changePassword)} class="flex flex-col gap-4">
|
||||
<TextInput
|
||||
bind:value={oldPassword}
|
||||
label={$t('form.profile.currentPassword')}
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
|
||||
let deletion = {
|
||||
let deletion = $state({
|
||||
modal: false,
|
||||
password: '',
|
||||
deleteContent: false,
|
||||
}
|
||||
})
|
||||
|
||||
async function deleteAccount(level: number) {
|
||||
switch (level) {
|
||||
@@ -101,7 +101,9 @@
|
||||
action="Submit"
|
||||
on:action={() => deleteAccount(4)}
|
||||
>
|
||||
<span slot="title">{$t('form.profile.deleteAccount.label')}</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('form.profile.deleteAccount.label')}</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
@@ -109,9 +111,11 @@
|
||||
/>
|
||||
<Checkbox bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
<span slot="description">
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{/snippet}
|
||||
</Checkbox>
|
||||
</Modal>
|
||||
{/if}
|
||||
@@ -130,9 +134,11 @@
|
||||
</p>
|
||||
<Switch bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
<span slot="description">
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{/snippet}
|
||||
</Switch>
|
||||
<Button size="lg" color="danger" on:click={() => deleteAccount(3)}>
|
||||
{$t('routes.profile.delete.title')}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
import { UAParser } from 'ua-parser-js'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
let checked: {
|
||||
[token: string]: boolean
|
||||
} = {}
|
||||
} = $state({})
|
||||
</script>
|
||||
|
||||
<Material
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { profile, profileData, setUserID } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { ImageInput, Material, removeToast, toast } from 'mono-svelte'
|
||||
@@ -9,16 +11,21 @@
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let inline: boolean = false
|
||||
export let data
|
||||
|
||||
let formData: Omit<SaveUserSettings, 'auth'> | undefined = {
|
||||
...data.my_user?.local_user_view?.local_user,
|
||||
...data.my_user?.local_user_view?.person,
|
||||
interface Props {
|
||||
inline?: boolean;
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let profileImage: FileList | undefined
|
||||
let bannerImage: FileList | undefined
|
||||
let { inline = false, data, children }: Props = $props();
|
||||
|
||||
let formData: Omit<SaveUserSettings, 'auth'> | undefined = $state({
|
||||
...data.my_user?.local_user_view?.local_user,
|
||||
...data.my_user?.local_user_view?.person,
|
||||
})
|
||||
|
||||
let profileImage: FileList | undefined = $state()
|
||||
let bannerImage: FileList | undefined = $state()
|
||||
|
||||
async function save() {
|
||||
if (!formData || !$profile?.jwt) return
|
||||
@@ -53,14 +60,14 @@
|
||||
loading = false
|
||||
}
|
||||
|
||||
let loading = false
|
||||
let loading = $state(false)
|
||||
</script>
|
||||
|
||||
<form class="flex flex-col gap-4 h-full" on:submit|preventDefault={save}>
|
||||
<form class="flex flex-col gap-4 h-full" onsubmit={preventDefault(save)}>
|
||||
{#if !inline}
|
||||
<Header pageHeader>{$t('routes.profile.settings')}</Header>
|
||||
{/if}
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
{#if data.my_user?.local_user_view?.local_user && formData}
|
||||
<TextInput label={$t('form.profile.email')} bind:value={formData.email} />
|
||||
<TextInput
|
||||
|
||||
@@ -16,6 +16,13 @@
|
||||
Icon,
|
||||
Photo,
|
||||
} from 'svelte-hero-icons'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -57,33 +64,41 @@
|
||||
/>
|
||||
{#if feature('mediaAndVotes', $site?.version)}
|
||||
<Menu class="flex-1" placement="bottom-end">
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
slot="target"
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
color="none"
|
||||
class="bg-[#fff]/60 dark:bg-neutral-800/60
|
||||
border border-gray-200/60 dark:border-neutral-800
|
||||
backdrop-blur-xl shadow-xl hover:bg-slate-100 hover:dark:bg-zinc-800
|
||||
flex-shrink-0"
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
</Button>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
color="none"
|
||||
class="bg-[#fff]/60 dark:bg-neutral-800/60
|
||||
border border-gray-200/60 dark:border-neutral-800
|
||||
backdrop-blur-xl shadow-xl hover:bg-slate-100 hover:dark:bg-zinc-800
|
||||
flex-shrink-0"
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/media">
|
||||
<Icon src={Photo} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Photo} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('routes.profile.media.title')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/up">
|
||||
<Icon src={ArrowUp} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUp} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('routes.profile.upvoted')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/down">
|
||||
<Icon src={ArrowDown} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDown} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('routes.profile.downvoted')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
</div>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -21,9 +21,9 @@
|
||||
ShieldExclamation,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
$: my_user = data.my_user!.local_user_view
|
||||
let my_user = $derived(data.my_user!.local_user_view)
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
@@ -53,24 +53,28 @@
|
||||
},
|
||||
]}
|
||||
>
|
||||
<span class="text-sm flex gap-0 items-center w-max" slot="nameDetail">
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={my_user.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{#snippet nameDetail()}
|
||||
<span class="text-sm flex gap-0 items-center w-max" >
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={my_user.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#if (data.moderates ?? []).length > 0}
|
||||
<Expandable
|
||||
class="border rounded-xl bg-white/50 dark:bg-zinc-900/50 w-full p-3 px-4
|
||||
dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text-zinc-300 transition-colors"
|
||||
>
|
||||
<span slot="title" class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates?.map((m) => ({
|
||||
id: m.community.id,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import PictrsImage from './PictrsImage.svelte'
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.profile.media.title')}</Header>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
const dispatch = createEventDispatcher<{ delete: boolean }>()
|
||||
|
||||
let loading = false
|
||||
let loading = $state(false)
|
||||
|
||||
async function deleteImage(image: LocalImage) {
|
||||
if (!$profile?.jwt) return
|
||||
@@ -32,7 +32,11 @@
|
||||
loading = false
|
||||
}
|
||||
|
||||
export let image: LocalImage
|
||||
interface Props {
|
||||
image: LocalImage;
|
||||
}
|
||||
|
||||
let { image }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
@@ -54,7 +58,9 @@
|
||||
size="square-md"
|
||||
class="ml-auto"
|
||||
>
|
||||
<Icon src={ArrowDownTray} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
title={$t('post.actions.more.delete')}
|
||||
@@ -63,7 +69,9 @@
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
<Icon src={Trash} size="16" mini slot="prefix" color="text-red-500" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini color="text-red-500" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import UserPage from '../../u/[name]/+page.svelte'
|
||||
export let data
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
{#if data.user && data.sort && data.type && data.page}
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
const SvelteComponent = $derived(browser ? VirtualFeed : PostFeed);
|
||||
</script>
|
||||
|
||||
<Header>
|
||||
{data.upvoted ? $t('routes.profile.upvoted') : $t('routes.profile.downvoted')}
|
||||
</Header>
|
||||
|
||||
<svelte:component
|
||||
this={browser ? VirtualFeed : PostFeed}
|
||||
<SvelteComponent
|
||||
posts={data.feed.posts.posts}
|
||||
bind:feedData={data.feed}
|
||||
feedId="main"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
@@ -22,10 +24,13 @@
|
||||
AdjustmentsHorizontal,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
// svelte being stupid
|
||||
$: type = data.type as any
|
||||
let type;
|
||||
run(() => {
|
||||
type = data.type as any
|
||||
});
|
||||
|
||||
const isComment = (item: CommentView | PostView): item is CommentView =>
|
||||
'comment' in item
|
||||
@@ -38,29 +43,33 @@
|
||||
<Header pageHeader>
|
||||
{$t('routes.saved')}
|
||||
|
||||
<div slot="extended" class="flex items-center">
|
||||
<Select
|
||||
bind:value={type}
|
||||
on:change={() => searchParam($page.url, 'type', type, 'page')}
|
||||
>
|
||||
<div class="flex items-center gap-0.5" slot="label">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</div>
|
||||
<option value="all">
|
||||
<Icon src={Bars3} micro size="15" />
|
||||
{$t('content.all')}
|
||||
</option>
|
||||
<option value="posts">
|
||||
<Icon src={PencilSquare} micro size="15" />
|
||||
{$t('content.posts')}
|
||||
</option>
|
||||
<option value="comments">
|
||||
<Icon src={ChatBubbleOvalLeft} micro size="15" />
|
||||
{$t('content.comments')}
|
||||
</option>
|
||||
</Select>
|
||||
</div>
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center">
|
||||
<Select
|
||||
bind:value={type}
|
||||
on:change={() => searchParam($page.url, 'type', type, 'page')}
|
||||
>
|
||||
{#snippet label()}
|
||||
<div class="flex items-center gap-0.5" >
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</div>
|
||||
{/snippet}
|
||||
<option value="all">
|
||||
<Icon src={Bars3} micro size="15" />
|
||||
{$t('content.all')}
|
||||
</option>
|
||||
<option value="posts">
|
||||
<Icon src={PencilSquare} micro size="15" />
|
||||
{$t('content.posts')}
|
||||
</option>
|
||||
<option value="comments">
|
||||
<Icon src={ChatBubbleOvalLeft} micro size="15" />
|
||||
{$t('content.comments')}
|
||||
</option>
|
||||
</Select>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
<div
|
||||
class="flex flex-col list-none my-4 divide-slate-200 dark:divide-zinc-800"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
@@ -40,18 +42,18 @@
|
||||
|
||||
type Result = PostView | CommentView | PersonView | CommunityView
|
||||
|
||||
export let data
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let query = data.query || ''
|
||||
let searchElement: HTMLInputElement
|
||||
let query = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement = $state()
|
||||
|
||||
let pageNum = data.page
|
||||
let pageNum = $state(data.page)
|
||||
|
||||
let moreOptions = false
|
||||
let moreOptions = $state(false)
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
on:keydown={(e) => {
|
||||
onkeydown={(e) => {
|
||||
if (e.target == document.body) searchElement?.focus()
|
||||
}}
|
||||
/>
|
||||
@@ -69,8 +71,8 @@
|
||||
>
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
searchParam($page.url, 'q', query, 'page')}
|
||||
onsubmit={preventDefault(() =>
|
||||
searchParam($page.url, 'q', query, 'page'))}
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
@@ -89,7 +91,9 @@
|
||||
rounding="pill"
|
||||
loading={$navigating != null}
|
||||
>
|
||||
<Icon src={MagnifyingGlass} size="16" micro slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
@@ -99,10 +103,12 @@
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="All">{$t('content.all')}</option>
|
||||
<option value="Posts">{$t('content.posts')}</option>
|
||||
<option value="Comments">{$t('content.comments')}</option>
|
||||
@@ -110,15 +116,17 @@
|
||||
<option value="Users">{$t('content.users')}</option>
|
||||
</Select>
|
||||
<Sort navigate bind:selected={data.sort} />
|
||||
<Button
|
||||
slot="summary"
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
on:click={() => (moreOptions = !moreOptions)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</Button>
|
||||
{#snippet summary()}
|
||||
<Button
|
||||
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
on:click={() => (moreOptions = !moreOptions)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</Button>
|
||||
{/snippet}
|
||||
</div>
|
||||
{#if moreOptions}
|
||||
<div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm">
|
||||
@@ -201,7 +209,7 @@
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
<div class="mt-4" />
|
||||
<div class="mt-4"></div>
|
||||
{#if data.results.length > 0}
|
||||
<Pageination
|
||||
bind:page={pageNum}
|
||||
|
||||
+217
-131
@@ -47,8 +47,8 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { profile } from '$lib/auth'
|
||||
import AccountPage from '../profile/(local_user)/settings/+page.svelte'
|
||||
let importing = false
|
||||
let importText = ''
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
let localeMap: Map<
|
||||
string,
|
||||
@@ -122,7 +122,9 @@
|
||||
title={$t('settings.import')}
|
||||
roundingSide="left"
|
||||
>
|
||||
<Icon src={ArrowDownTray} mini size="18" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
@@ -135,7 +137,9 @@
|
||||
title={$t('settings.export')}
|
||||
rounding="none"
|
||||
>
|
||||
<Icon src={ArrowUpTray} mini size="18" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
@@ -149,7 +153,9 @@
|
||||
title={$t('settings.reset')}
|
||||
roundingSide="right"
|
||||
>
|
||||
<Icon src={ArrowPath} mini size="18" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Header>
|
||||
@@ -195,7 +201,9 @@
|
||||
class="block"
|
||||
>
|
||||
{$t('profile.profile')}
|
||||
<Icon src={ArrowRight} micro size="16" slot="suffix" />
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Section>
|
||||
@@ -203,16 +211,20 @@
|
||||
<Section id="app" title={$t('settings.app.title')}>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Setting>
|
||||
<span slot="title" class="inline-flex items-center gap-2">
|
||||
{$t('settings.app.lang.title')}
|
||||
<Badge>{$t('settings.beta')}</Badge>
|
||||
</span>
|
||||
<p slot="description">
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{#snippet title()}
|
||||
<span class="inline-flex items-center gap-2">
|
||||
{$t('settings.app.lang.title')}
|
||||
<Badge>{$t('settings.beta')}</Badge>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p >
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={$userSettings.language}>
|
||||
<option value={null}>
|
||||
@@ -240,36 +252,46 @@
|
||||
{/if}
|
||||
</div>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.view.title')}</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
<p slot="description">
|
||||
{#if $userSettings.view == 'list'}
|
||||
{$t('settings.app.view.list')}
|
||||
{:else if $userSettings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{:else if $userSettings.view == 'card'}
|
||||
{$t('settings.app.view.legacy')}
|
||||
{/if}
|
||||
</p>
|
||||
{#snippet description()}
|
||||
<p >
|
||||
{#if $userSettings.view == 'list'}
|
||||
{$t('settings.app.view.list')}
|
||||
{:else if $userSettings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{:else if $userSettings.view == 'card'}
|
||||
{$t('settings.app.view.legacy')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
<Setting
|
||||
optionClass="flex-[2] max-w-full flex-wrap min-w-0 "
|
||||
itemsClass="flex-col !items-start lg:!items-center lg:flex-row"
|
||||
>
|
||||
<span slot="title">{$t('settings.app.sort.title')}</span>
|
||||
<span slot="description">{$t('settings.app.sort.description')}</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={$userSettings.defaultSort.feed}>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="All">{$t('filter.location.all')}</option>
|
||||
<option value="Local">{$t('filter.location.local')}</option>
|
||||
<option value="Subscribed">
|
||||
@@ -288,10 +310,12 @@
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={$userSettings.defaultSort.comments}>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
@@ -307,10 +331,14 @@
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.thumbnailSide.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
@@ -337,8 +365,12 @@
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.font.title')}</span>
|
||||
<span slot="description">{$t('settings.app.font.description')}</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={$userSettings.font}>
|
||||
<option value="inter">Inter</option>
|
||||
<option value="satoshi/nunito">Satoshi + Nunito</option>
|
||||
@@ -347,11 +379,17 @@
|
||||
</Select>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.theming.title')}</span>
|
||||
<span slot="description">{$t('settings.app.theming.description')}</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.theming.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.theming.description')}</span>
|
||||
{/snippet}
|
||||
<Button href="/theme">
|
||||
{$t('settings.app.theming.link')}
|
||||
<Icon src={ArrowRight} size="16" mini slot="suffix" />
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
@@ -370,10 +408,14 @@
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.translation.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.app.translation.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.translation.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.app.translation.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
bind:value={$userSettings.translator}
|
||||
label={$t('settings.app.translation.instance')}
|
||||
@@ -387,9 +429,11 @@
|
||||
bind:checked={$userSettings.parseTags}
|
||||
/>
|
||||
<Setting>
|
||||
<svelte:fragment slot="title">
|
||||
{$t('settings.app.titleTags.rules.title')}
|
||||
</svelte:fragment>
|
||||
{#snippet title()}
|
||||
|
||||
{$t('settings.app.titleTags.rules.title')}
|
||||
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-col divide-y [&>*]:py-2 items-end divide-slate-200 dark:divide-zinc-800"
|
||||
>
|
||||
@@ -412,10 +456,14 @@
|
||||
</Section>
|
||||
<Section id="nav" title={$t('settings.navigation.title')}>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.navigation.dockPos.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.navigation.dockPos.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.dockPos.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.navigation.dockPos.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={[
|
||||
@@ -427,10 +475,14 @@
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.navigation.panel.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.navigation.panel.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.panel.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.navigation.panel.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={[
|
||||
@@ -444,38 +496,46 @@
|
||||
<Setting
|
||||
supportedPlatforms={{ desktop: true, tablet: true, mobile: false }}
|
||||
>
|
||||
<span slot="title">{$t('settings.navigation.pins.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.navigation.pins.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.pins.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.navigation.pins.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex items-center gap-1 flex-wrap">
|
||||
{#each getDefaultLinks() as pin}
|
||||
<Popover openOnHover placement="bottom">
|
||||
<Button
|
||||
size="square-md"
|
||||
slot="target"
|
||||
disabled={$userSettings.dock.pins
|
||||
?.map((p) => p.url)
|
||||
?.includes(pin.url)}
|
||||
on:click={() => {
|
||||
$userSettings.dock.pins = [
|
||||
...($userSettings.dock.pins ?? []),
|
||||
pin,
|
||||
]
|
||||
}}
|
||||
>
|
||||
<Icon src={iconOfLink(pin.url)} mini size="16" />
|
||||
</Button>
|
||||
<Material
|
||||
slot="popover"
|
||||
padding="none"
|
||||
class="px-4 py-2 flex flex-col"
|
||||
>
|
||||
<span class="font-medum text-base">{pin.label}</span>
|
||||
<code class="bg-slate-50 dark:!bg-zinc-950 !rounded-md">
|
||||
{pin.url}
|
||||
</code>
|
||||
</Material>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
size="square-md"
|
||||
|
||||
disabled={$userSettings.dock.pins
|
||||
?.map((p) => p.url)
|
||||
?.includes(pin.url)}
|
||||
on:click={() => {
|
||||
$userSettings.dock.pins = [
|
||||
...($userSettings.dock.pins ?? []),
|
||||
pin,
|
||||
]
|
||||
}}
|
||||
>
|
||||
<Icon src={iconOfLink(pin.url)} mini size="16" />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<Material
|
||||
|
||||
padding="none"
|
||||
class="px-4 py-2 flex flex-col"
|
||||
>
|
||||
<span class="font-medum text-base">{pin.label}</span>
|
||||
<code class="bg-slate-50 dark:!bg-zinc-950 !rounded-md">
|
||||
{pin.url}
|
||||
</code>
|
||||
</Material>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -489,10 +549,14 @@
|
||||
bind:checked={$userSettings.embeds.clickToView}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">YouTube</span>
|
||||
<span slot="description">
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Select bind:value={$userSettings.embeds.youtube}>
|
||||
<option value="youtube">YouTube</option>
|
||||
<option value="invidious">Invidious</option>
|
||||
@@ -501,10 +565,14 @@
|
||||
</Setting>
|
||||
{#if $userSettings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.embeds.instance.invidious')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
@@ -514,10 +582,14 @@
|
||||
{/if}
|
||||
{#if $userSettings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.embeds.instance.piped')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
@@ -554,10 +626,14 @@
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
<span slot="description">
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={$userSettings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
@@ -573,10 +649,14 @@
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.lemmy.instances.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={$userSettings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
@@ -598,25 +678,29 @@
|
||||
|
||||
<Section id="moderation" title={$t('settings.moderation.title')}>
|
||||
<Setting itemsClass="!flex-col !items-start">
|
||||
<span slot="title">{$t('settings.moderation.replyPresets.title')}</span>
|
||||
<span slot="description">
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#each $userSettings.moderation.presets as preset, index}
|
||||
<Material
|
||||
color="transparent"
|
||||
@@ -681,7 +765,9 @@
|
||||
]
|
||||
}}
|
||||
>
|
||||
<Icon src={Plus} mini size="16" slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</Material>
|
||||
|
||||
@@ -4,17 +4,27 @@
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
export let title: string
|
||||
export let id: string
|
||||
|
||||
export let open = true
|
||||
interface Props {
|
||||
title: string;
|
||||
id: string;
|
||||
open?: boolean;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
title,
|
||||
id,
|
||||
open = $bindable(true),
|
||||
children
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col max-w-full w-full">
|
||||
<button
|
||||
class="text-left hover:text-primary-900 dark:hover:text-primary-100
|
||||
flex items-center justify-between z-0 relative group transition-colors"
|
||||
on:click={() => (open = !open)}
|
||||
onclick={() => (open = !open)}
|
||||
>
|
||||
<h2 class="text-xl font-semibold text-inherit" {id}>
|
||||
<span>{title}</span>
|
||||
@@ -37,7 +47,7 @@
|
||||
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"
|
||||
>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -8,17 +8,33 @@
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let supportedPlatforms = {
|
||||
|
||||
interface Props {
|
||||
supportedPlatforms?: any;
|
||||
mainClass?: string;
|
||||
itemsClass?: string;
|
||||
optionClass?: string;
|
||||
class?: string;
|
||||
title?: import('svelte').Snippet;
|
||||
description?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
supportedPlatforms = {
|
||||
desktop: true,
|
||||
tablet: true,
|
||||
mobile: true,
|
||||
}
|
||||
|
||||
export let mainClass: string = ''
|
||||
export let itemsClass: string = ''
|
||||
export let optionClass: string = ''
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
},
|
||||
mainClass = '',
|
||||
itemsClass = '',
|
||||
optionClass = '',
|
||||
class: clazz = '',
|
||||
title,
|
||||
description,
|
||||
children
|
||||
}: Props = $props();
|
||||
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -28,19 +44,25 @@
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
{#if supportedPlatforms.desktop}
|
||||
<Badge>
|
||||
<Icon src={ComputerDesktop} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={ComputerDesktop} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.desktop')}
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if supportedPlatforms.tablet}
|
||||
<Badge>
|
||||
<Icon src={DeviceTablet} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={DeviceTablet} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.tablet')}
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if supportedPlatforms.mobile}
|
||||
<Badge>
|
||||
<Icon src={DevicePhoneMobile} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={DevicePhoneMobile} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.mobile')}
|
||||
</Badge>
|
||||
{/if}
|
||||
@@ -52,19 +74,19 @@
|
||||
<div
|
||||
class="flex flex-col gap-0.5 flex-[2] w-full flex-shrink-0 min-w-48 {clazz}"
|
||||
>
|
||||
<h1 class="font-medium text-base"><slot name="title" /></h1>
|
||||
{#if $$slots.description}
|
||||
<h1 class="font-medium text-base">{@render title?.()}</h1>
|
||||
{#if description}
|
||||
<p class="text-slate-800 dark:text-zinc-200 text-sm">
|
||||
<slot name="description" />
|
||||
{@render description?.()}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $$slots.default}
|
||||
{#if children}
|
||||
<div
|
||||
class="w-full flex flex-col gap-2 flex-1 max-w-full
|
||||
@md/setting:items-end flex-shrink-0 {optionClass}"
|
||||
>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -9,16 +9,26 @@
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let title: string
|
||||
export let description: string | undefined = undefined
|
||||
export let checked: boolean = false
|
||||
export let beta = false
|
||||
|
||||
export let supportedPlatforms = {
|
||||
interface Props {
|
||||
title: string;
|
||||
description?: string | undefined;
|
||||
checked?: boolean;
|
||||
beta?: boolean;
|
||||
supportedPlatforms?: any;
|
||||
}
|
||||
|
||||
let {
|
||||
title,
|
||||
description = undefined,
|
||||
checked = $bindable(false),
|
||||
beta = false,
|
||||
supportedPlatforms = {
|
||||
desktop: true,
|
||||
tablet: true,
|
||||
mobile: true,
|
||||
}
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col w-full justify-between gap-2 max-w-full">
|
||||
@@ -30,19 +40,25 @@
|
||||
{#if Object.values(supportedPlatforms).some((v) => v == false)}
|
||||
{#if supportedPlatforms.desktop}
|
||||
<Badge>
|
||||
<Icon src={ComputerDesktop} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={ComputerDesktop} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.desktop')}
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if supportedPlatforms.tablet}
|
||||
<Badge>
|
||||
<Icon src={DeviceTablet} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={DeviceTablet} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.tablet')}
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if supportedPlatforms.mobile}
|
||||
<Badge>
|
||||
<Icon src={DevicePhoneMobile} micro size="14" slot="icon" />
|
||||
{#snippet icon()}
|
||||
<Icon src={DevicePhoneMobile} micro size="14" />
|
||||
{/snippet}
|
||||
{$t('settings.mobile')}
|
||||
</Badge>
|
||||
{/if}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<script lang="ts">
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
|
||||
export let href: string
|
||||
export let size: keyof typeof sizes = 'medium'
|
||||
export let title: string = ''
|
||||
interface Props {
|
||||
href: string;
|
||||
size?: keyof typeof sizes;
|
||||
title?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
href,
|
||||
size = 'medium',
|
||||
title = '',
|
||||
children
|
||||
}: Props = $props();
|
||||
|
||||
const sizes = {
|
||||
large: 'h-24',
|
||||
@@ -13,17 +23,21 @@
|
||||
</script>
|
||||
|
||||
<Popover openOnHover placement="right">
|
||||
<a {href} slot="target">
|
||||
<slot />
|
||||
</a>
|
||||
<Material
|
||||
slot="popover"
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
elevation="medium"
|
||||
class="px-3 py-2 font-medium"
|
||||
>
|
||||
{title}
|
||||
</Material>
|
||||
{#snippet target()}
|
||||
<a {href} >
|
||||
{@render children?.()}
|
||||
</a>
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<Material
|
||||
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
elevation="medium"
|
||||
class="px-3 py-2 font-medium"
|
||||
>
|
||||
{title}
|
||||
</Material>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
<div class="{sizes[size]} border-l self-center"></div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<script context="module" lang="ts">
|
||||
<script module lang="ts">
|
||||
export interface Instance {
|
||||
baseurl: string
|
||||
name: string
|
||||
@@ -14,6 +14,8 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { Badge, Material, Spinner, toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL } from '$lib/instance.js'
|
||||
@@ -24,11 +26,11 @@
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let selectedInstance: string = ''
|
||||
let validating: boolean = false
|
||||
let placeholder = DEFAULT_INSTANCE_URL
|
||||
let selectedInstance: string = $state('')
|
||||
let validating: boolean = $state(false)
|
||||
let placeholder = $state(DEFAULT_INSTANCE_URL)
|
||||
|
||||
let instances: Instance[] | undefined = undefined
|
||||
let instances: Instance[] | undefined = $state(undefined)
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
@@ -76,7 +78,7 @@
|
||||
{#if instances}
|
||||
{#each instances as instance}
|
||||
<button
|
||||
on:click={() => (selectedInstance = instance.baseurl ?? '')}
|
||||
onclick={() => (selectedInstance = instance.baseurl ?? '')}
|
||||
class="flex flex-row gap-2 text-left py-2 first:pt-0 last:pb-0 items-center
|
||||
h-16 max-h-16 min-h-16 overflow-hidden w-full"
|
||||
>
|
||||
@@ -109,7 +111,7 @@
|
||||
</Material>
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
on:submit|preventDefault={async () => {
|
||||
onsubmit={preventDefault(async () => {
|
||||
if (selectedInstance != '') {
|
||||
validating = true
|
||||
|
||||
@@ -124,7 +126,7 @@
|
||||
|
||||
validating = false
|
||||
}
|
||||
}}
|
||||
})}
|
||||
>
|
||||
<TextInput
|
||||
bind:value={selectedInstance}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
@@ -23,32 +25,34 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
let { data } = $props();
|
||||
|
||||
const instance = $page.params.instance
|
||||
|
||||
let captchaRequired = data.site_view.local_site.captcha_enabled
|
||||
|
||||
let email: string | undefined = ''
|
||||
let email: string | undefined = $state('')
|
||||
|
||||
$: if (email == '') email = undefined
|
||||
run(() => {
|
||||
if (email == '') email = undefined
|
||||
});
|
||||
|
||||
let username = '',
|
||||
password = '',
|
||||
passwordVerify = '',
|
||||
captcha: GetCaptchaResponse | null = null,
|
||||
verifyCaptcha: string | undefined = undefined,
|
||||
application: string | undefined = undefined,
|
||||
submitting: boolean = false,
|
||||
honeypot: string | undefined = undefined,
|
||||
nsfw: boolean = false
|
||||
let username = $state(''),
|
||||
password = $state(''),
|
||||
passwordVerify = $state(''),
|
||||
captcha: GetCaptchaResponse | null = $state(null),
|
||||
verifyCaptcha: string | undefined = $state(undefined),
|
||||
application: string | undefined = $state(undefined),
|
||||
submitting: boolean = $state(false),
|
||||
honeypot: string | undefined = $state(undefined),
|
||||
nsfw: boolean = $state(false)
|
||||
|
||||
const getCaptcha = async () =>
|
||||
(captcha = await getClient(instance, fetch).getCaptcha())
|
||||
|
||||
$: captchaAudio = captcha?.ok?.wav
|
||||
let captchaAudio = $derived(captcha?.ok?.wav
|
||||
? `data:audio/wav;base64,${captcha.ok.wav}`
|
||||
: ''
|
||||
: '')
|
||||
|
||||
async function submit() {
|
||||
submitting = true
|
||||
@@ -115,7 +119,7 @@
|
||||
|
||||
<form
|
||||
class="flex flex-col gap-4 max-w-2xl mx-auto h-full w-full"
|
||||
on:submit|preventDefault={submit}
|
||||
onsubmit={preventDefault(submit)}
|
||||
>
|
||||
<span class="flex gap-4 items-center font-bold text-xl text-center mx-auto">
|
||||
{#if data.site_view.site.icon}
|
||||
@@ -172,7 +176,7 @@
|
||||
alt="Captcha"
|
||||
class="w-max"
|
||||
/>
|
||||
<audio controls src={captchaAudio} />
|
||||
<audio controls src={captchaAudio}></audio>
|
||||
{:else}
|
||||
<Material
|
||||
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
import ThemePreset from './ThemePreset.svelte'
|
||||
|
||||
let importing = false
|
||||
let importText = ''
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
$: defaultColors = getDefaultColors()
|
||||
let defaultColors = $derived(getDefaultColors())
|
||||
</script>
|
||||
|
||||
{#if importing}
|
||||
@@ -74,7 +74,7 @@
|
||||
<ThemePreset bind:theme />
|
||||
{/each}
|
||||
<button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
const newTheme = {
|
||||
id: Math.max(...$themeData.themes.map((t) => t.id)) + 1,
|
||||
colors: getDefaultColors(),
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { createBubbler } from 'svelte/legacy';
|
||||
|
||||
const bubble = createBubbler();
|
||||
import { hexToRgb } from '$lib/ui/colors'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let value: string
|
||||
|
||||
const dispatch = createEventDispatcher<{ change: string }>()
|
||||
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
interface Props {
|
||||
value: string;
|
||||
class?: string;
|
||||
}
|
||||
|
||||
let { value = $bindable(), class: clazz = '' }: Props = $props();
|
||||
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -19,7 +26,7 @@
|
||||
class="rounded-md border cursor-pointer absolute top-0 left-0 w-full h-full opacity-0"
|
||||
type="color"
|
||||
bind:value
|
||||
on:change={() => dispatch('change', hexToRgb(value))}
|
||||
on:contextmenu
|
||||
onchange={() => dispatch('change', hexToRgb(value))}
|
||||
oncontextmenu={bubble('contextmenu')}
|
||||
/>
|
||||
</div>
|
||||
@@ -1,15 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import { t } from '$lib/translations'
|
||||
import { calculateVars, themeData, type Theme } from '$lib/ui/colors'
|
||||
import { action, Button, Material, modal, TextInput } from 'mono-svelte'
|
||||
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
export let theme: Theme
|
||||
interface Props {
|
||||
theme: Theme;
|
||||
}
|
||||
|
||||
let editingName = false
|
||||
let { theme = $bindable() }: Props = $props();
|
||||
|
||||
let editingName = $state(false)
|
||||
</script>
|
||||
|
||||
<button class="h-full" on:click={() => ($themeData.currentTheme = theme.id)}>
|
||||
<button class="h-full" onclick={() => ($themeData.currentTheme = theme.id)}>
|
||||
<Material
|
||||
padding="none"
|
||||
class="{theme.id == $themeData.currentTheme
|
||||
@@ -27,10 +33,10 @@
|
||||
</div>
|
||||
<div
|
||||
class="bg-white dark:bg-zinc-900 w-8 h-4 rounded-sm border border-slate-200 dark:border-zinc-800"
|
||||
/>
|
||||
></div>
|
||||
<div
|
||||
class="w-3 h-3 bg-primary-900 dark:bg-primary-100 rounded-full ml-auto"
|
||||
/>
|
||||
></div>
|
||||
</div>
|
||||
{#if theme.id == $themeData.currentTheme}
|
||||
<Icon
|
||||
@@ -42,12 +48,12 @@
|
||||
{/if}
|
||||
<div class="px-4 py-2 flex items-center gap-1 justify-between">
|
||||
{#if editingName}
|
||||
<form on:submit|preventDefault={() => (editingName = false)}>
|
||||
<form onsubmit={preventDefault(() => (editingName = false))}>
|
||||
<TextInput bind:value={theme.name}></TextInput>
|
||||
</form>
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (theme.id > 0) editingName = true
|
||||
}}
|
||||
class="text-left font-medium text-lg font-display"
|
||||
@@ -90,7 +96,9 @@
|
||||
})
|
||||
}}
|
||||
>
|
||||
<Icon src={Trash} size="16" mini slot="prefix" />
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
@@ -37,8 +39,12 @@
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
|
||||
export let data
|
||||
export let inline: boolean = false
|
||||
interface Props {
|
||||
data: any;
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
let { data = $bindable(), inline = false }: Props = $props();
|
||||
|
||||
let blocking = false
|
||||
|
||||
@@ -78,16 +84,18 @@
|
||||
blocking = false
|
||||
}
|
||||
|
||||
let messaging = false
|
||||
let messaging = $state(false)
|
||||
|
||||
let purgingUser = false
|
||||
let purgeEnabled = false
|
||||
$: if (purgingUser) {
|
||||
purgeEnabled = false
|
||||
setTimeout(() => {
|
||||
purgeEnabled = true
|
||||
}, 3000)
|
||||
}
|
||||
let purgingUser = $state(false)
|
||||
let purgeEnabled = $state(false)
|
||||
run(() => {
|
||||
if (purgingUser) {
|
||||
purgeEnabled = false
|
||||
setTimeout(() => {
|
||||
purgeEnabled = true
|
||||
}, 3000)
|
||||
}
|
||||
});
|
||||
|
||||
async function purgeUser() {
|
||||
purgingUser = false
|
||||
@@ -118,7 +126,9 @@
|
||||
|
||||
{#if purgingUser}
|
||||
<Modal bind:open={purgingUser}>
|
||||
<svelte:fragment slot="title">Purging User</svelte:fragment>
|
||||
{#snippet title()}
|
||||
Purging User
|
||||
{/snippet}
|
||||
<p>
|
||||
Purging user <span class="font-bold">
|
||||
{data.person_view.person.name}
|
||||
@@ -172,24 +182,28 @@
|
||||
},
|
||||
]}
|
||||
>
|
||||
<span class="text-sm flex gap-0 items-center w-max" slot="nameDetail">
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={data.person_view.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{#snippet nameDetail()}
|
||||
<span class="text-sm flex gap-0 items-center w-max" >
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={data.person_view.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#if (data.moderates ?? []).length > 0}
|
||||
<Expandable
|
||||
class="border rounded-xl bg-white/50 dark:bg-zinc-900/50 w-full p-3 px-4
|
||||
dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text-zinc-300 transition-colors"
|
||||
>
|
||||
<span slot="title" class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{#snippet title()}
|
||||
<span class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates.map((m) => ({
|
||||
id: m.community.id,
|
||||
@@ -201,75 +215,93 @@
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
<svelte:fragment slot="actions">
|
||||
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
||||
<div class="flex items-center gap-2 w-full">
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="/inbox/messages/{data.person_view.person.id}"
|
||||
title="Message"
|
||||
>
|
||||
<Icon slot="prefix" solid size="16" src={Envelope} />
|
||||
</Button>
|
||||
{#if data.person_view.person.matrix_user_id}
|
||||
{#snippet actions()}
|
||||
|
||||
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
||||
<div class="flex items-center gap-2 w-full">
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="https://matrix.to/#/{data.person_view.person
|
||||
.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
href="/inbox/messages/{data.person_view.person.id}"
|
||||
title="Message"
|
||||
>
|
||||
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
||||
{#snippet prefix()}
|
||||
<Icon solid size="16" src={Envelope} />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if isAdmin($profile?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
<Button size="square-md" slot="target">
|
||||
<ShieldIcon width={16} filled />
|
||||
{#if data.person_view.person.matrix_user_id}
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="https://matrix.to/#/{data.person_view.person
|
||||
.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon solid size="16" src={AtSymbol} />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if isAdmin($profile?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" >
|
||||
<ShieldIcon width={16} filled />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
ban(
|
||||
data.person_view.person.banned,
|
||||
data.person_view.person
|
||||
)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
|
||||
mini
|
||||
size="16"
|
||||
src={ShieldExclamation}
|
||||
/>
|
||||
{/snippet}
|
||||
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => (purgingUser = !purgingUser)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={Fire} />
|
||||
{/snippet}
|
||||
Purge
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" >
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
ban(
|
||||
data.person_view.person.banned,
|
||||
data.person_view.person
|
||||
)}
|
||||
on:click={() => blockUser(data.person_view.person.id)}
|
||||
>
|
||||
<Icon
|
||||
slot="prefix"
|
||||
mini
|
||||
size="16"
|
||||
src={ShieldExclamation}
|
||||
/>
|
||||
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => (purgingUser = !purgingUser)}
|
||||
>
|
||||
<Icon slot="prefix" mini size="16" src={Fire} />
|
||||
Purge
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
{/snippet}
|
||||
{isBlocked($profile.user, data.person_view.person.id)
|
||||
? 'Unblock'
|
||||
: 'Block'}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
<Menu placement="bottom-end">
|
||||
<Button size="square-md" slot="target">
|
||||
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
|
||||
</Button>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => blockUser(data.person_view.person.id)}
|
||||
>
|
||||
<Icon slot="prefix" mini size="16" src={NoSymbol} />
|
||||
{isBlocked($profile.user, data.person_view.person.id)
|
||||
? 'Unblock'
|
||||
: 'Block'}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/snippet}
|
||||
</EntityHeader>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -280,10 +312,12 @@
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="all">{$t('content.all')}</option>
|
||||
<option value="posts">{$t('content.posts')}</option>
|
||||
<option value="comments">{$t('content.comments')}</option>
|
||||
@@ -292,10 +326,12 @@
|
||||
bind:value={data.sort}
|
||||
on:change={() => searchParam($page.url, 'sort', data.sort, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="TopAll">{$t('filter.sort.top.label')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
@@ -42,5 +47,5 @@
|
||||
currentRoute={$page.url.toString()}
|
||||
/>
|
||||
</div>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -2,9 +2,9 @@
|
||||
import { isImage, isVideo } from '$lib/ui/image.js'
|
||||
import { TextInput } from 'mono-svelte'
|
||||
|
||||
let imageInput = ''
|
||||
$: inputIsImage = isImage(imageInput)
|
||||
$: inputIsVideo = isVideo(imageInput)
|
||||
let imageInput = $state('')
|
||||
let inputIsImage = $derived(isImage(imageInput))
|
||||
let inputIsVideo = $derived(isVideo(imageInput))
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Functions</h1>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { photonify } from '$lib/components/markdown/renderers/plugins'
|
||||
import { TextInput } from 'mono-svelte'
|
||||
|
||||
let link = ''
|
||||
let link = $state('')
|
||||
|
||||
$: photonified = photonify(link)
|
||||
let photonified;
|
||||
run(() => {
|
||||
photonified = photonify(link)
|
||||
});
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Photonify links</h1>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import { placeholders } from '$lib/util.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
let post = placeholders.get('post')
|
||||
let comment = placeholders.get('comment')
|
||||
let url = placeholders.get('url')
|
||||
let post = $state(placeholders.get('post'))
|
||||
let comment = $state(placeholders.get('comment'))
|
||||
let url = $state(placeholders.get('url'))
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Placeholders</h1>
|
||||
|
||||
Reference in new issue
Block a user