migrate: change settings from a store to a state
This commit is contained in:
1 parent
ffcd9faa96
commit
d597349887
128 files changed
+1010
-1144
No files matched your search
+35
-45
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import '../style/app.css'
|
||||
@@ -15,7 +15,7 @@
|
||||
theme,
|
||||
themeVars,
|
||||
} from '$lib/ui/colors.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
ModalContainer,
|
||||
@@ -26,7 +26,7 @@
|
||||
import { onMount } from 'svelte'
|
||||
import { browser } from '$app/environment'
|
||||
import { Forward, Icon } from 'svelte-hero-icons'
|
||||
import { routes } from '$lib/util.js'
|
||||
import { routes } from '$lib/util.svelte.js'
|
||||
import Shell from '$lib/components/ui/layout/Shell.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
@@ -35,10 +35,10 @@
|
||||
import { locale } from '$lib/translations'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
let { children }: Props = $props()
|
||||
|
||||
nProgress.configure({
|
||||
minimum: 0.4,
|
||||
@@ -62,7 +62,7 @@
|
||||
nProgress.done()
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
onMount(() => {
|
||||
if (browser) {
|
||||
@@ -70,31 +70,33 @@
|
||||
history.replaceState(
|
||||
null,
|
||||
'',
|
||||
window.location.toString().replace('#main', '')
|
||||
window.location.toString().replace('#main', ''),
|
||||
)
|
||||
}
|
||||
document.body.querySelector('.loader')?.classList.add('hidden')
|
||||
themeVars.subscribe((vars) => {
|
||||
document.body.setAttribute('style', vars)
|
||||
})
|
||||
userSettings.subscribe((settings) => {
|
||||
document.body.classList.remove(
|
||||
'font-display',
|
||||
'font-inter',
|
||||
'font-sans',
|
||||
'font-system',
|
||||
'font-nunito'
|
||||
)
|
||||
document.body.classList.add(
|
||||
settings.font == 'inter'
|
||||
? 'font-inter'
|
||||
: $userSettings.font == 'system'
|
||||
? 'font-system'
|
||||
: $userSettings.font == 'satoshi/nunito'
|
||||
? 'font-nunito'
|
||||
: 'font-sans'
|
||||
)
|
||||
})
|
||||
// $effect(() => {
|
||||
// if (settings) {
|
||||
// document.body.classList.remove(
|
||||
// 'font-display',
|
||||
// 'font-inter',
|
||||
// 'font-sans',
|
||||
// 'font-system',
|
||||
// 'font-nunito',
|
||||
// )
|
||||
// document.body.classList.add(
|
||||
// settings.font == 'inter'
|
||||
// ? 'font-inter'
|
||||
// : settings.font == 'system'
|
||||
// ? 'font-system'
|
||||
// : settings.font == 'satoshi/nunito'
|
||||
// ? 'font-nunito'
|
||||
// : 'font-sans',
|
||||
// )
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -106,8 +108,8 @@
|
||||
name="theme-color"
|
||||
content={rgbToHex(
|
||||
$colorScheme && inDarkColorScheme()
|
||||
? $theme.colors.zinc?.[925] ?? getDefaultColors().zinc[925]
|
||||
: $theme.colors.slate?.[25] ?? getDefaultColors().slate[25]
|
||||
? ($theme.colors.zinc?.[925] ?? getDefaultColors().zinc[925])
|
||||
: ($theme.colors.slate?.[25] ?? getDefaultColors().slate[25]),
|
||||
)}
|
||||
/>
|
||||
{#if LINKED_INSTANCE_URL}
|
||||
@@ -124,12 +126,12 @@
|
||||
href="#main"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Forward} mini size="16" />
|
||||
<Icon src={Forward} mini size="16" />
|
||||
{/snippet}
|
||||
Skip Navigation
|
||||
</Button>
|
||||
<Shell
|
||||
dir={$locale == 'he' && $userSettings.useRtl ? 'rtl' : 'ltr'}
|
||||
dir={$locale == 'he' && settings.useRtl ? 'rtl' : 'ltr'}
|
||||
class="min-h-screen "
|
||||
route={$page.route}
|
||||
>
|
||||
@@ -139,20 +141,10 @@
|
||||
<ModalContainer />
|
||||
|
||||
{#snippet sidebar({ style: s, class: c })}
|
||||
<Sidebar
|
||||
route={$page.route.id ?? ''}
|
||||
|
||||
|
||||
|
||||
class={c}
|
||||
style={s}
|
||||
/>
|
||||
<Sidebar 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"
|
||||
@@ -161,15 +153,13 @@
|
||||
</main>
|
||||
{/snippet}
|
||||
{#snippet navbar({ style: s, class: c })}
|
||||
<Navbar class={c} style={s} />
|
||||
<Navbar class={c} style={s} />
|
||||
{/snippet}
|
||||
{#snippet suffix({ class: c, style: s })}
|
||||
<div 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}
|
||||
/>
|
||||
<SvelteComponent {...$page.data.slots.sidebar.props} />
|
||||
{:else if $site}
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { aliases, loadTranslations } from '$lib/translations.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -9,7 +9,7 @@ export let ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
export const load = async ({}) => {
|
||||
if (browser) {
|
||||
const initLocale =
|
||||
get(userSettings)?.language ?? navigator?.language ?? 'en'
|
||||
settings.language ?? navigator?.language ?? 'en'
|
||||
|
||||
console.log(`Loading locale ${aliases.get(initLocale) ?? initLocale}`)
|
||||
|
||||
|
||||
+22
-22
@@ -1,29 +1,35 @@
|
||||
<script lang="ts" module>
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { ChartBar, Icon } from 'svelte-hero-icons'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { browser } from '$app/environment'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
import type { ListingType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
const SvelteComponent = $derived($userSettings.infiniteScroll &&
|
||||
browser &&
|
||||
!$userSettings.posts.noVirtualize
|
||||
let type = $state(data.type_)
|
||||
let sort = $state(data.sort)
|
||||
|
||||
$effect(() => {
|
||||
if (sort) settings.defaultSort.sort = sort
|
||||
})
|
||||
|
||||
const FeedComponent = $derived(
|
||||
settings.infiniteScroll && browser && !settings.posts.noVirtualize
|
||||
? VirtualFeed
|
||||
: PostFeed);
|
||||
: PostFeed,
|
||||
)
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-2 max-w-full w-full min-w-0">
|
||||
@@ -32,24 +38,18 @@
|
||||
{$t('routes.frontpage.title')}
|
||||
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center gap-2" >
|
||||
{#if data.type_}
|
||||
<Location changeDefault selected={data.type_} />
|
||||
{/if}
|
||||
<Sort changeDefault selected={data.sort} />
|
||||
<div class="flex items-center gap-2">
|
||||
<Location bind:selected={type} />
|
||||
<Sort bind:selected={sort} />
|
||||
<ViewSelect />
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</Header>
|
||||
</header>
|
||||
|
||||
<SvelteComponent
|
||||
posts={data.posts.posts}
|
||||
bind:feedData={data}
|
||||
feedId="main"
|
||||
/>
|
||||
<FeedComponent posts={data.posts.posts} feedData={data} feedId="main" />
|
||||
<svelte:element
|
||||
this={$userSettings.infiniteScroll && !$userSettings.posts.noVirtualize
|
||||
this={settings.infiniteScroll && !settings.posts.noVirtualize
|
||||
? 'noscript'
|
||||
: 'div'}
|
||||
class="mt-auto"
|
||||
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { GetPostsResponse, ListingType, SortType } from 'lemmy-js-client'
|
||||
import { get, writable } from 'svelte/store'
|
||||
import { error } from '@sveltejs/kit'
|
||||
@@ -13,8 +13,6 @@ export async function load({ url, fetch }) {
|
||||
const cursor = url.searchParams.get('cursor') as string | undefined
|
||||
const prevCursor = url.searchParams.get('prevCursor') as string | undefined
|
||||
|
||||
const settings = get(userSettings)
|
||||
|
||||
const sort: SortType =
|
||||
(url.searchParams.get('sort') as SortType) || settings.defaultSort.sort
|
||||
const listingType: ListingType =
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
moveProfile,
|
||||
type Profile,
|
||||
profile,
|
||||
} from '$lib/auth.js'
|
||||
} from '$lib/auth.svelte.js'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import { Menu, MenuButton, Modal } from 'mono-svelte'
|
||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
@@ -58,21 +58,21 @@
|
||||
bind:open={debugging}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="flex flex-col">
|
||||
<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>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</DebugObject>
|
||||
{/if}
|
||||
|
||||
{#if removing.shown && removing.account}
|
||||
<Modal bind:open={removing.shown}>
|
||||
{#snippet title()}
|
||||
<span >Removing Account</span>
|
||||
{/snippet}
|
||||
{#snippet customTitle()}
|
||||
<span>Removing Account</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<ProfileAvatar profile={removing.account} selected={true} />
|
||||
|
||||
@@ -120,14 +120,14 @@
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button href="/accounts/login" size="lg">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" micro />
|
||||
{/snippet}
|
||||
Log in
|
||||
</Button>
|
||||
<Button href="/signup" size="lg">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Identification} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={Identification} size="16" micro />
|
||||
{/snippet}
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@
|
||||
<Header pageHeader>
|
||||
{$t('routes.accounts')}
|
||||
{#snippet extended()}
|
||||
<div class="flex" >
|
||||
<div class="flex">
|
||||
<div class="flex gap-2 mr-auto">
|
||||
<Button
|
||||
href="/accounts/login"
|
||||
@@ -147,40 +147,41 @@
|
||||
color="primary"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<Button href="/accounts/login/guest" size="lg">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={Plus} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('account.addGuest')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</Header>
|
||||
<FilterTabs items={$profileData.profiles} id={(i) => i.instance} >
|
||||
<FilterTabs items={$profileData.profiles} id={(i) => i.instance}>
|
||||
{#snippet children({ items })}
|
||||
<EditableList
|
||||
<EditableList
|
||||
on:action={(acc) => {
|
||||
removing.account = acc.detail
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
|
||||
>
|
||||
{#snippet children({ action })}
|
||||
{#each items as profile, index (profile.id)}
|
||||
{#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'}
|
||||
title={profile.id == $currentProfile?.id
|
||||
? 'Switch'
|
||||
: 'Current'}
|
||||
on:click={async () => {
|
||||
if (profile.id != $currentProfile?.id) {
|
||||
switching = profile.id
|
||||
@@ -189,20 +190,20 @@
|
||||
}
|
||||
}}
|
||||
size="square-md"
|
||||
color={profile.id == $currentProfile?.id ? 'primary' : 'ghost'}
|
||||
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}
|
||||
{#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">
|
||||
@@ -236,12 +237,12 @@
|
||||
<div class="ml-auto"></div>
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" >
|
||||
<Button size="square-md">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<div class="px-4 py-2 flex items-center gap-2">
|
||||
<Button
|
||||
size="square-md"
|
||||
@@ -250,8 +251,8 @@
|
||||
on:click={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
@@ -260,8 +261,8 @@
|
||||
on:click={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<MenuButton
|
||||
@@ -269,11 +270,11 @@
|
||||
on:click={() => (profile.color = undefined)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUturnLeft} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowUturnLeft} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.resetColor')}
|
||||
</MenuButton>
|
||||
{#if $userSettings.debugInfo}
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
debugProfile = profile
|
||||
@@ -281,8 +282,8 @@
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -292,22 +293,17 @@
|
||||
color="danger-subtle"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
|
||||
src={ArrowRightOnRectangle}
|
||||
size="16"
|
||||
mini
|
||||
/>
|
||||
{/snippet}
|
||||
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</FilterTabs>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</FilterTabs>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { notifications } from '$lib/auth'
|
||||
import { notifications } from '$lib/auth.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
{#if $notifications.applications > 0}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { get } from 'svelte/store'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { site as siteStore } from '$lib/lemmy'
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import { page } from '$app/stores'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { ClipboardDocumentCheck, Icon } from 'svelte-hero-icons'
|
||||
import Application from './Application.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.applications.title')}</Header>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/auth.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
@@ -16,10 +16,10 @@
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
interface Props {
|
||||
application: RegistrationApplicationView;
|
||||
application: RegistrationApplicationView
|
||||
}
|
||||
|
||||
let { application = $bindable() }: Props = $props();
|
||||
let { application = $bindable() }: Props = $props()
|
||||
|
||||
let approving = $state(false)
|
||||
let denying = $state(false)
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
try {
|
||||
await getClient().approveRegistrationApplication(
|
||||
registrationApplicationAnswer
|
||||
registrationApplicationAnswer,
|
||||
)
|
||||
toast({
|
||||
content: approve
|
||||
@@ -144,8 +144,8 @@
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
@@ -159,8 +159,8 @@
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { Label, Switch, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
@@ -14,17 +14,19 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
data: PageData
|
||||
}
|
||||
|
||||
let { data }: Props = $props();
|
||||
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)
|
||||
const formData: Omit<EditSite, 'auth'> | undefined = $state(
|
||||
data.site
|
||||
? {
|
||||
...data.site.site_view.local_site,
|
||||
...data.site.site_view.site,
|
||||
}
|
||||
: undefined,
|
||||
)
|
||||
|
||||
async function save() {
|
||||
if (!$profile?.jwt) return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
@@ -9,7 +9,7 @@
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { trycatch } from '$lib/util.js'
|
||||
import { trycatch } from '$lib/util.svelte.js'
|
||||
import type { Instance } from 'lemmy-js-client'
|
||||
import {
|
||||
Button,
|
||||
@@ -31,7 +31,7 @@
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let blockInstance = $state({
|
||||
instance: '',
|
||||
@@ -58,12 +58,12 @@
|
||||
|
||||
const blockedInstances =
|
||||
data.federated_instances.federated_instances.blocked.map(
|
||||
(i) => i.domain
|
||||
(i) => i.domain,
|
||||
)
|
||||
|
||||
const allowedInstances =
|
||||
data.federated_instances.federated_instances.allowed.map(
|
||||
(i) => i.domain
|
||||
(i) => i.domain,
|
||||
)
|
||||
|
||||
if (blocked) blockedInstances.push(instance)
|
||||
@@ -97,11 +97,11 @@
|
||||
|
||||
const blockedInstances =
|
||||
data.federated_instances.federated_instances.blocked.map(
|
||||
(i) => i.domain
|
||||
(i) => i.domain,
|
||||
)
|
||||
const allowedInstances =
|
||||
data.federated_instances.federated_instances.allowed.map(
|
||||
(i) => i.domain
|
||||
(i) => i.domain,
|
||||
)
|
||||
|
||||
return await getClient().editSite({
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
run(() => {
|
||||
if (csv) parseCsv(csv)
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -182,25 +182,24 @@
|
||||
{#if data.site && data.federated_instances?.federated_instances?.blocked}
|
||||
<FileInput preview={false} bind:files={csv}>
|
||||
{#snippet button()}
|
||||
<Button class="w-max" >
|
||||
<Button class="w-max">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="18" />
|
||||
{/snippet}
|
||||
<Icon src={Plus} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
{#snippet choose()}
|
||||
|
||||
{''}
|
||||
|
||||
{/snippet}
|
||||
{''}
|
||||
{/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
|
||||
onsubmit={preventDefault(() =>
|
||||
moderateInstance(blockInstance.instance, true))}
|
||||
moderateInstance(blockInstance.instance, true),
|
||||
)}
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
@@ -223,7 +222,7 @@
|
||||
: ''}"
|
||||
>
|
||||
{#if data.federated_instances.federated_instances.blocked.length > 0}
|
||||
{#each data.federated_instances.federated_instances.blocked.sort( (b, a) => b.domain.localeCompare(a.domain) ) as instance (instance.id)}
|
||||
{#each data.federated_instances.federated_instances.blocked.sort( (b, a) => b.domain.localeCompare(a.domain), ) as instance (instance.id)}
|
||||
<div
|
||||
animate:flip={{ duration: 300, easing: expoOut }}
|
||||
class="flex justify-between items-center first:pt-0 last:pb-0"
|
||||
@@ -246,13 +245,13 @@
|
||||
|
||||
data.federated_instances.federated_instances.blocked =
|
||||
data.federated_instances?.federated_instances?.blocked.filter(
|
||||
(i) => i.id != instance.id
|
||||
(i) => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -272,14 +271,13 @@
|
||||
{#if allowInstance.instance || !(data.federated_instances.federated_instances.allowed?.length == 0)}
|
||||
<Popover openOnHover placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Icon
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
solid
|
||||
class="text-yellow-500"
|
||||
|
||||
size="20"
|
||||
/>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<p class="font-normal">
|
||||
{$t('routes.admin.federation.emptyAllow.description')}
|
||||
</p>
|
||||
@@ -288,7 +286,8 @@
|
||||
</h2>
|
||||
<form
|
||||
onsubmit={preventDefault(() =>
|
||||
moderateInstance(allowInstance.instance, false))}
|
||||
moderateInstance(allowInstance.instance, false),
|
||||
)}
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
@@ -307,7 +306,7 @@
|
||||
<Material class="h-full overflow-auto" color="distinct">
|
||||
<EditableList class="[&>*]:py-3 dark:!divide-zinc-800 ">
|
||||
{#if data.federated_instances.federated_instances.allowed.length > 0}
|
||||
{#each data.federated_instances.federated_instances.allowed.sort( (b, a) => b.domain.localeCompare(a.domain) ) as instance (instance.id)}
|
||||
{#each data.federated_instances.federated_instances.allowed.sort( (b, a) => b.domain.localeCompare(a.domain), ) as instance (instance.id)}
|
||||
<div
|
||||
animate:flip={{ duration: 300, easing: expoOut }}
|
||||
class="flex justify-between items-center first:pt-0 last:pb-0"
|
||||
@@ -330,13 +329,13 @@
|
||||
|
||||
data.federated_instances.federated_instances.allowed =
|
||||
data.federated_instances?.federated_instances?.allowed.filter(
|
||||
(i) => i.id != instance.id
|
||||
(i) => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -346,7 +345,7 @@
|
||||
icon={Check}
|
||||
title={$t('routes.admin.federation.emptyAllow.title')}
|
||||
description={$t(
|
||||
'routes.admin.federation.emptyAllow.description'
|
||||
'routes.admin.federation.emptyAllow.description',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
@@ -14,9 +14,11 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
let taglines = $state([...(data.site?.taglines.map((t: Tagline) => t.content) ?? [])])
|
||||
let taglines = $state([
|
||||
...(data.site?.taglines.map((t: Tagline) => t.content) ?? []),
|
||||
])
|
||||
let newTagline = $state('')
|
||||
|
||||
let saving = $state(false)
|
||||
@@ -60,11 +62,10 @@
|
||||
</Header>
|
||||
|
||||
<EditableList
|
||||
|
||||
on:action={(e) => {
|
||||
taglines.splice(
|
||||
taglines.findIndex((i) => i == e.detail),
|
||||
1
|
||||
1,
|
||||
)
|
||||
|
||||
// hack for reactivity
|
||||
@@ -72,7 +73,7 @@
|
||||
}}
|
||||
>
|
||||
{#snippet children({ action })}
|
||||
{#each taglines as tagline}
|
||||
{#each taglines as tagline}
|
||||
<div class="flex py-3">
|
||||
<Markdown source={tagline} inline />
|
||||
|
||||
@@ -83,8 +84,8 @@
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
<form
|
||||
class="flex flex-col mt-auto gap-2 w-full"
|
||||
onsubmit={preventDefault(() => {
|
||||
@@ -99,8 +100,8 @@
|
||||
|
||||
<Button size="lg" submit>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -130,8 +131,8 @@
|
||||
|
||||
<Button size="lg" submit>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
@@ -9,13 +9,13 @@
|
||||
import { instance } from '$lib/instance.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { addAdmin } from '$lib/lemmy/user.js'
|
||||
import { removeItem, trycatch } from '$lib/util.js'
|
||||
import { removeItem, trycatch } from '$lib/util.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, Plus, QuestionMarkCircle, Trash } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let newAdmin: string = $state(''),
|
||||
adding: boolean = $state(false)
|
||||
@@ -33,7 +33,7 @@
|
||||
getClient().addAdmin({
|
||||
added: false,
|
||||
person_id: id,
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
if (result) {
|
||||
@@ -48,9 +48,9 @@
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.team.title')}</Header>
|
||||
{#if data.site}
|
||||
<EditableList on:action={(e) => removeAdmin(e.detail, false)}>
|
||||
<EditableList on:action={(e) => removeAdmin(e.detail, false)}>
|
||||
{#snippet children({ action })}
|
||||
{#if data.site.admins.length <= 0}
|
||||
{#if data.site.admins.length <= 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title={$t('routes.admin.team.empty.title')}
|
||||
@@ -66,8 +66,8 @@
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
<form
|
||||
class="flex flex-row items-center gap-2 mt-auto w-full"
|
||||
onsubmit={preventDefault(() => {
|
||||
@@ -98,8 +98,8 @@
|
||||
/>
|
||||
<Button loading={adding} disabled={adding} size="md" class="h-full" submit>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
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'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import { fullCommunityName, searchParam } from '$lib/util.js'
|
||||
import { fullCommunityName, searchParam } from '$lib/util.svelte.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
@@ -27,18 +27,13 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import { resumables } from '$lib/lemmy/item'
|
||||
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
|
||||
let community;
|
||||
run(() => {
|
||||
community = data.community.community_view
|
||||
});
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let sidebar: boolean = $state(false)
|
||||
|
||||
@@ -46,14 +41,14 @@
|
||||
if (browser)
|
||||
setSessionStorage(
|
||||
'lastSeenCommunity',
|
||||
data.community.community_view.community
|
||||
data.community.community_view.community,
|
||||
)
|
||||
|
||||
resumables.add({
|
||||
name: community.community.title,
|
||||
name: data.community.community_view.community.title,
|
||||
type: 'community',
|
||||
url: $page.url.toString(),
|
||||
avatar: community.community.icon,
|
||||
avatar: data.community.community_view.community.icon,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -68,12 +63,12 @@
|
||||
|
||||
{#if sidebar}
|
||||
<Modal bind:open={sidebar}>
|
||||
{#snippet title()}
|
||||
<span >About</span>
|
||||
{/snippet}
|
||||
{#snippet customTitle()}
|
||||
<span>About</span>
|
||||
{/snippet}
|
||||
<div>
|
||||
<CommunityCard
|
||||
bind:community_view={community}
|
||||
bind:community_view={data.community.community_view}
|
||||
moderators={data.community.moderators}
|
||||
/>
|
||||
</div>
|
||||
@@ -83,18 +78,18 @@
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<Header pageHeader>
|
||||
<CommunityHeader
|
||||
bind:community={community.community}
|
||||
bind:subscribed={community.subscribed}
|
||||
bind:blocked={community.blocked}
|
||||
bind:community={data.community.community_view.community}
|
||||
bind:subscribed={data.community.community_view.subscribed}
|
||||
blocked={data.community.community_view.blocked}
|
||||
moderators={data.community.moderators}
|
||||
counts={community.counts}
|
||||
counts={data.community.community_view.counts}
|
||||
class="w-full relative"
|
||||
/>
|
||||
{#snippet extended()}
|
||||
<Sort selected={data.sort} />
|
||||
{/snippet}
|
||||
<Sort selected={data.sort} />
|
||||
{/snippet}
|
||||
</Header>
|
||||
{#if community.blocked}
|
||||
{#if data.community.community_view.blocked}
|
||||
<Placeholder
|
||||
icon={XMark}
|
||||
title="Blocked"
|
||||
@@ -102,8 +97,8 @@
|
||||
>
|
||||
<Button href="/profile/blocks">
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
Blocked Communities
|
||||
</Button>
|
||||
</Placeholder>
|
||||
@@ -118,7 +113,7 @@
|
||||
{/if}
|
||||
|
||||
<svelte:element
|
||||
this={$userSettings.infiniteScroll ? 'noscript' : 'div'}
|
||||
this={settings.infiniteScroll ? 'noscript' : 'div'}
|
||||
class="mt-auto"
|
||||
>
|
||||
<Pageination
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { postFeed } from '$lib/lemmy/postfeed.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -11,7 +11,7 @@ export async function load({ params, fetch, url }) {
|
||||
|
||||
const sort: SortType =
|
||||
(url.searchParams.get('sort') as SortType) ||
|
||||
get(userSettings).defaultSort.sort
|
||||
settings.defaultSort.sort
|
||||
|
||||
return await postFeed({
|
||||
id: 'community',
|
||||
|
||||
@@ -5,20 +5,22 @@
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import { fullCommunityName } from '$lib/util.svelte.js'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
children?: import('svelte').Snippet;
|
||||
data: PageData
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
let { data, children }: Props = $props()
|
||||
|
||||
let communityUrl = $derived(`/c/${fullCommunityName(
|
||||
data.community.community_view.community.name,
|
||||
data.community.community_view.community.actor_id
|
||||
)}`)
|
||||
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">
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
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'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
import { flip } from 'svelte/animate'
|
||||
@@ -15,10 +15,10 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
data: PageData
|
||||
}
|
||||
|
||||
let { data = $bindable() }: Props = $props();
|
||||
let { data = $bindable() }: Props = $props()
|
||||
|
||||
let formData = $state({
|
||||
newModerator: '',
|
||||
@@ -109,7 +109,6 @@
|
||||
|
||||
<Header pageHeader>Moderators</Header>
|
||||
<EditableList
|
||||
|
||||
on:action={(e) => {
|
||||
toast({
|
||||
content: `Are you sure you want to remove ${e.detail.name} as a moderator?`,
|
||||
@@ -158,7 +157,7 @@
|
||||
submit
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet} Add moderator
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet} Add moderator
|
||||
</Button>
|
||||
</form>
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import {
|
||||
@@ -10,7 +10,7 @@
|
||||
QuestionMarkCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
Material,
|
||||
@@ -31,21 +31,18 @@
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
let search = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement = $state()
|
||||
let searchElement: HTMLInputElement | undefined = $state()
|
||||
let instance = ''
|
||||
|
||||
let virtualList: HTMLDivElement = $state()
|
||||
let offset: number = $state(0)
|
||||
|
||||
let showTop =
|
||||
$derived((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}
|
||||
onkeydown={(e) => {
|
||||
if (e.target == document.body) searchElement?.focus()
|
||||
}}
|
||||
@@ -65,7 +62,8 @@
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
||||
<form
|
||||
onsubmit={preventDefault(() =>
|
||||
searchParam($page.url, 'q', search, 'page'))}
|
||||
searchParam($page.url, 'q', search, 'page'),
|
||||
)}
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
@@ -86,8 +84,8 @@
|
||||
loading={$navigating != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
@@ -149,7 +147,7 @@
|
||||
{/if}
|
||||
{#if data.communities}
|
||||
{@const sliced = data.communities.slice(showTop ? 3 : 0)}
|
||||
<div class="-mx-4 sm:-mx-6 h-full" bind:this={virtualList}>
|
||||
<div class="-mx-4 sm:-mx-6 h-full">
|
||||
{#each sliced as community, index (community.community.id)}
|
||||
<div
|
||||
class="px-6 hover:bg-slate-50 hover:dark:bg-zinc-900 transition-colors @container
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
import {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommunityView, SubscribedType } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
|
||||
interface Props {
|
||||
community?: CommunityView | undefined;
|
||||
children?: import('svelte').Snippet<[any]>;
|
||||
community?: CommunityView | undefined
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
}
|
||||
|
||||
let { community = undefined, children }: Props = $props();
|
||||
let { community = undefined, children }: Props = $props()
|
||||
|
||||
let subscribing = $state(false)
|
||||
|
||||
@@ -38,4 +38,4 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{@render children?.({ subscribe, subscribing, })}
|
||||
{@render children?.({ subscribe, subscribing })}
|
||||
@@ -1,15 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let { data = {
|
||||
crosspost: false,
|
||||
} } = $props();
|
||||
let {
|
||||
data = {
|
||||
crosspost: false,
|
||||
},
|
||||
} = $props()
|
||||
|
||||
onMount(() => {
|
||||
if (!$profile?.jwt) {
|
||||
@@ -49,9 +51,9 @@
|
||||
on:submit={(e) => goto(`/post/${e.detail.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
{$t('routes.createPost')}
|
||||
</Header>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</PostForm>
|
||||
</div>
|
||||
@@ -13,10 +13,10 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { notifications, profile } from '$lib/auth.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Select } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { notifications, profile } from '$lib/auth.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import {
|
||||
ArrowUturnLeft,
|
||||
ArrowUturnUp,
|
||||
@@ -29,10 +29,10 @@
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
|
||||
interface Props {
|
||||
item: InboxItem;
|
||||
item: InboxItem
|
||||
}
|
||||
|
||||
let { item = $bindable() }: Props = $props();
|
||||
let { item = $bindable() }: Props = $props()
|
||||
|
||||
let replying = $state(false)
|
||||
let reply = ''
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<Expandable open icon={false}>
|
||||
{#snippet title()}
|
||||
<div class="flex flex-row gap-2 items-center w-full" >
|
||||
<div class="flex flex-row gap-2 items-center w-full">
|
||||
<Avatar
|
||||
url={item.creator.avatar}
|
||||
circle={false}
|
||||
@@ -141,8 +141,8 @@
|
||||
class="flex-shrink-0"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
@@ -161,7 +161,7 @@
|
||||
</div>
|
||||
{/snippet}
|
||||
{#snippet extended()}
|
||||
<div class="flex gap-2 w-full md:hidden mt-1">
|
||||
<div class="flex gap-2 w-full md:hidden mt-1">
|
||||
<Button
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
@@ -174,33 +174,35 @@
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
<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">
|
||||
<Button
|
||||
href="/comment/{item.item.comment.id}"
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
>
|
||||
{$t('common.jump')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{/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}
|
||||
|
||||
{#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>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
@@ -35,11 +35,11 @@
|
||||
}
|
||||
|
||||
function conversationPreviews(
|
||||
conversations: PrivateMessageView[]
|
||||
conversations: PrivateMessageView[],
|
||||
): ConversationPreview[] {
|
||||
const deduplicated = filterDuplicates(
|
||||
conversations.toReversed(),
|
||||
(i) => i.creator.id
|
||||
(i) => i.creator.id,
|
||||
)
|
||||
|
||||
return deduplicated.map((i) => ({
|
||||
@@ -51,7 +51,7 @@
|
||||
}))
|
||||
}
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
@@ -64,7 +64,7 @@
|
||||
{:then data}
|
||||
{@const conversations = data.private_messages}
|
||||
{@const previews = conversationPreviews(conversations).filter(
|
||||
(c) => c.user.id != $profile?.user?.local_user_view.person.id
|
||||
(c) => c.user.id != $profile?.user?.local_user_view.person.id,
|
||||
)}
|
||||
|
||||
<ul
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import { setUser } from '$lib/auth.svelte.js'
|
||||
import { Note, toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import {
|
||||
@@ -18,7 +18,7 @@
|
||||
QuestionMarkCircle,
|
||||
UserCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.js'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import { MINIMUM_VERSION } from '$lib/version.js'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
@@ -30,11 +30,11 @@
|
||||
import { page } from '$app/stores'
|
||||
|
||||
interface Props {
|
||||
ref?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
ref?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { ref = '/', children }: Props = $props();
|
||||
let { ref = '/', children }: Props = $props()
|
||||
|
||||
let data = $state({
|
||||
instance: DEFAULT_INSTANCE_URL,
|
||||
@@ -80,7 +80,7 @@
|
||||
'incorrect_login' +
|
||||
(data.attempts == 0 || data.attempts >= 12
|
||||
? ''
|
||||
: `_${data.attempts + 1}`)
|
||||
: `_${data.attempts + 1}`),
|
||||
)
|
||||
: errorMessage(error),
|
||||
scope: $page.route.id!,
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
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'
|
||||
import { mayBeIncompatible } from '$lib/lemmy'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util'
|
||||
import { profile, profileData, type Profile } from '$lib/auth'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte'
|
||||
import { profile, profileData, type Profile } from '$lib/auth.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
interface Props {
|
||||
ref?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
ref?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { ref = '/', children }: Props = $props();
|
||||
let { ref = '/', children }: Props = $props()
|
||||
|
||||
let form = $state({
|
||||
instance: '',
|
||||
|
||||
@@ -12,29 +12,29 @@
|
||||
Newspaper,
|
||||
} from 'svelte-hero-icons'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Material, Select } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
</script>
|
||||
|
||||
<div class="mb-4 flex flex-col gap-4">
|
||||
<Header pageHeader>
|
||||
{$t('routes.moderation.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex flex-row gap-2 flex-wrap items-end" >
|
||||
<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">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="all">{$t('filter.location.all')}</option>
|
||||
<option value="unread">{$t('filter.unread')}</option>
|
||||
</Select>
|
||||
@@ -43,7 +43,7 @@
|
||||
{$t('routes.modlog')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</Header>
|
||||
</div>
|
||||
{#if data.items && data.items.length > 0}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
PrivateMessageReportView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Check, CheckCircle, Icon } from 'svelte-hero-icons'
|
||||
import { notifications, profile } from '$lib/auth.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
@@ -19,10 +19,10 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
|
||||
interface Props {
|
||||
item: ReportView;
|
||||
item: ReportView
|
||||
}
|
||||
|
||||
let { item = $bindable() }: Props = $props();
|
||||
let { item = $bindable() }: Props = $props()
|
||||
|
||||
let resolving = $state(false)
|
||||
async function resolve() {
|
||||
@@ -140,8 +140,8 @@
|
||||
disabled={resolving}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={CheckCircle} micro={item.resolved} size="18" />
|
||||
{/snippet}
|
||||
<Icon src={CheckCircle} micro={item.resolved} size="18" />
|
||||
{/snippet}
|
||||
{!item.resolved
|
||||
? $t('routes.moderation.resolve')
|
||||
: $t('routes.moderation.resolved')}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { page } from '$app/stores'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||
import { Button, Select } from 'mono-svelte'
|
||||
@@ -22,18 +22,20 @@
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let view = $state(`${
|
||||
$userSettings.modlogCardView ?? browser
|
||||
? !window.matchMedia('(min-width: 1600px)').matches
|
||||
: false
|
||||
}`)
|
||||
let view = $state(
|
||||
`${
|
||||
(settings.modlogCardView ?? browser)
|
||||
? !window.matchMedia('(min-width: 1600px)').matches
|
||||
: false
|
||||
}`,
|
||||
)
|
||||
|
||||
run(() => {
|
||||
$userSettings.modlogCardView =
|
||||
settings.modlogCardView =
|
||||
view == 'true' ? true : view == 'false' ? false : undefined
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -49,11 +51,11 @@
|
||||
class="w-48"
|
||||
>
|
||||
{#snippet label()}
|
||||
<span class="flex gap-1 items-center">
|
||||
<span class="flex gap-1 items-center">
|
||||
<Icon src={Bars3BottomRight} size="15" mini />
|
||||
Type
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="All">All</option>
|
||||
<option value="ModRemovePost">Remove Post</option>
|
||||
<option value="ModLockPost">Lock Post</option>
|
||||
@@ -74,11 +76,11 @@
|
||||
|
||||
<Select bind:value={view} class="w-36">
|
||||
{#snippet label()}
|
||||
<span class="flex gap-1 items-center">
|
||||
<span class="flex gap-1 items-center">
|
||||
<Icon src={ViewColumns} size="15" mini />
|
||||
View
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="false">Table</option>
|
||||
<option value="true">Cards</option>
|
||||
<option value="undefined">Default</option>
|
||||
@@ -101,7 +103,7 @@
|
||||
'page',
|
||||
'community',
|
||||
'user',
|
||||
'mod_id'
|
||||
'mod_id',
|
||||
)}
|
||||
/>
|
||||
<ObjectAutocomplete
|
||||
@@ -117,7 +119,7 @@
|
||||
$page.url,
|
||||
'community',
|
||||
e.detail?.id.toString() ?? '',
|
||||
'page'
|
||||
'page',
|
||||
)}
|
||||
/>
|
||||
<UserAutocomplete
|
||||
@@ -129,7 +131,7 @@
|
||||
class="flex-1"
|
||||
label="User"
|
||||
q={$page.url.searchParams.get('user')
|
||||
? data.filters.user ?? 'Selected'
|
||||
? (data.filters.user ?? 'Selected')
|
||||
: ''}
|
||||
on:select={(e) =>
|
||||
searchParam($page.url, 'user', e.detail?.id.toString() ?? '', 'page')}
|
||||
@@ -143,14 +145,14 @@
|
||||
class="flex-1"
|
||||
label="Moderator"
|
||||
q={$page.url.searchParams.get('mod_id')
|
||||
? data.filters.moderator ?? 'Selected'
|
||||
? (data.filters.moderator ?? 'Selected')
|
||||
: ''}
|
||||
on:select={(e) =>
|
||||
searchParam(
|
||||
$page.url,
|
||||
'mod_id',
|
||||
e.detail?.id.toString() ?? '',
|
||||
'page'
|
||||
'page',
|
||||
)}
|
||||
/>
|
||||
{/if}
|
||||
@@ -163,7 +165,7 @@
|
||||
'user',
|
||||
'moderator',
|
||||
'community',
|
||||
'instance'
|
||||
'instance',
|
||||
)
|
||||
}}
|
||||
size="square-lg"
|
||||
@@ -174,7 +176,7 @@
|
||||
</Button>
|
||||
</div>
|
||||
{#if data.modlog && data.modlog.length > 0}
|
||||
{#if $userSettings.modlogCardView ?? !window.matchMedia('(min-width: 1600px)').matches}
|
||||
{#if settings.modlogCardView ?? !window.matchMedia('(min-width: 1600px)').matches}
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each data.modlog as modlog}
|
||||
<ModlogItemCard item={modlog} />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.js'
|
||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.svelte.js'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
import CommentForm from '$lib/components/lemmy/comment/CommentForm.svelte'
|
||||
@@ -28,13 +28,13 @@
|
||||
} from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Select, removeToast, toast } from 'mono-svelte'
|
||||
import type { CommentSortType } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { instance } from '$lib/instance.js'
|
||||
import { afterNavigate, goto } from '$app/navigation'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
@@ -48,7 +48,7 @@
|
||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let type = $derived(mediaType(data.post.post_view.post.url, 'cozy'))
|
||||
|
||||
@@ -100,15 +100,15 @@
|
||||
|
||||
run(() => {
|
||||
if (data.post) updateActions()
|
||||
});
|
||||
})
|
||||
|
||||
onMount(async () => {
|
||||
if (
|
||||
!(data.post.post_view.read && $userSettings.markPostsAsRead) &&
|
||||
!(data.post.post_view.read && settings.markPostsAsRead) &&
|
||||
$profile?.jwt
|
||||
) {
|
||||
getClient().markPostAsRead({
|
||||
read: $userSettings.markPostsAsRead,
|
||||
read: settings.markPostsAsRead,
|
||||
post_ids: [data.post.post_view.post.id],
|
||||
// @ts-ignore
|
||||
post_id: data.post.post_view.post.id,
|
||||
@@ -142,7 +142,7 @@
|
||||
if (res.post) {
|
||||
removeToast(id)
|
||||
goto(`/post/${$instance}/${res.post.post.id}`, {}).then(() =>
|
||||
removeToast(id)
|
||||
removeToast(id),
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -171,8 +171,9 @@
|
||||
|
||||
let commenting = $state(false)
|
||||
|
||||
let remoteView =
|
||||
$derived($page.params.instance?.toLowerCase() != $instance.toLowerCase())
|
||||
let remoteView = $derived(
|
||||
$page.params.instance?.toLowerCase() != $instance.toLowerCase(),
|
||||
)
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -220,14 +221,13 @@
|
||||
>
|
||||
<Popover openOnHover>
|
||||
{#snippet target()}
|
||||
<Icon
|
||||
<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}
|
||||
{/snippet}
|
||||
{$t('routes.post.instanceWarning')}
|
||||
</Popover>
|
||||
<span class="text-primary-900 dark:text-primary-100 font-bold">
|
||||
@@ -274,8 +274,8 @@
|
||||
/>
|
||||
<Button on:click={() => history.back()} size="square-md">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<h1 class="font-bold text-xl font-display leading-5">
|
||||
@@ -305,7 +305,6 @@
|
||||
content: 'The post was edited successfully.',
|
||||
type: 'success',
|
||||
})}
|
||||
{type}
|
||||
/>
|
||||
</div>
|
||||
{#if data.post.cross_posts?.length > 0}
|
||||
@@ -314,14 +313,11 @@
|
||||
open={data.post.cross_posts?.length <= 3}
|
||||
>
|
||||
{#snippet title()}
|
||||
<div
|
||||
|
||||
class="inline-block w-full text-left text-base font-normal"
|
||||
>
|
||||
<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}
|
||||
{/snippet}
|
||||
<div
|
||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
@@ -391,7 +387,7 @@
|
||||
</Button>
|
||||
|
||||
{#snippet action()}
|
||||
<div class="gap-2 flex items-center" >
|
||||
<div class="gap-2 flex items-center">
|
||||
<Select
|
||||
size="md"
|
||||
bind:value={commentSort}
|
||||
@@ -407,11 +403,11 @@
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
{:else}
|
||||
<CommentForm
|
||||
@@ -453,8 +449,8 @@
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -465,9 +461,9 @@
|
||||
undefined,
|
||||
(c) =>
|
||||
!(
|
||||
($userSettings.hidePosts.deleted && c.comment.deleted) ||
|
||||
($userSettings.hidePosts.removed && c.comment.removed)
|
||||
)
|
||||
(settings.hidePosts.deleted && c.comment.deleted) ||
|
||||
(settings.hidePosts.removed && c.comment.removed)
|
||||
),
|
||||
)}
|
||||
scrollTo={data.thread.focus}
|
||||
/>
|
||||
@@ -487,17 +483,16 @@
|
||||
{$t('routes.post.commentCount')}
|
||||
|
||||
{#snippet action()}
|
||||
<Button
|
||||
<Button
|
||||
color="tertiary"
|
||||
on:click={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDoubleUp} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={ChevronDoubleUp} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { awaitIfServer } from '$lib/promise.js'
|
||||
import { SSR_ENABLED, userSettings } from '$lib/settings.js'
|
||||
import { SSR_ENABLED, settings } from '$lib/settings.svelte'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import type { GetComments } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
@@ -35,7 +35,7 @@ export async function load({ params, url, fetch }) {
|
||||
max_depth = 10
|
||||
}
|
||||
|
||||
const sort = get(userSettings)?.defaultSort?.comments ?? 'Hot'
|
||||
const sort = settings?.defaultSort?.comments ?? 'Hot'
|
||||
|
||||
const commentParams: GetComments = {
|
||||
post_id: Number(params.id),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { Check, Icon, Trash, XMark } from 'svelte-hero-icons'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
@@ -22,23 +22,22 @@
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
|
||||
interface Props {
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
data: PageData & {
|
||||
person_blocks: PersonBlockView[]
|
||||
community_blocks: CommunityBlockView[]
|
||||
};
|
||||
person_blocks: PersonBlockView[]
|
||||
community_blocks: CommunityBlockView[]
|
||||
}
|
||||
}
|
||||
|
||||
let { data = $bindable() }: Props = $props();
|
||||
let { data = $bindable() }: Props = $props()
|
||||
|
||||
async function unblockUser(item: PersonBlockView) {
|
||||
if (!$profile?.jwt) return
|
||||
|
||||
data.person_blocks.splice(
|
||||
data.person_blocks.findIndex((i) => i.target.id == item.target.id),
|
||||
1
|
||||
1,
|
||||
)
|
||||
// hack to get reactivity working
|
||||
data.person_blocks = data.person_blocks
|
||||
@@ -54,9 +53,9 @@
|
||||
|
||||
data.community_blocks.splice(
|
||||
data.community_blocks.findIndex(
|
||||
(i) => i.community.id == item.community.id
|
||||
(i) => i.community.id == item.community.id,
|
||||
),
|
||||
1
|
||||
1,
|
||||
)
|
||||
|
||||
// hack to get reactivity working
|
||||
@@ -74,9 +73,9 @@
|
||||
|
||||
data.my_user.instance_blocks.splice(
|
||||
data.my_user.instance_blocks.findIndex(
|
||||
(i) => i.instance.id == item.instance.id
|
||||
(i) => i.instance.id == item.instance.id,
|
||||
),
|
||||
1
|
||||
1,
|
||||
)
|
||||
data.my_user.instance_blocks = data.my_user.instance_blocks
|
||||
|
||||
@@ -91,9 +90,9 @@
|
||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.instances')}</SectionTitle>
|
||||
<EditableList on:action={(i) => unblockInstances(i.detail)}>
|
||||
<EditableList on:action={(i) => unblockInstances(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||
{#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 }}
|
||||
@@ -106,8 +105,8 @@
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Entity
|
||||
icon={block.site?.icon}
|
||||
@@ -116,16 +115,16 @@
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.community_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
||||
<EditableList on:action={(i) => unblockCommunity(i.detail)}>
|
||||
<EditableList on:action={(i) => unblockCommunity(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#each data.community_blocks as block (block.community.id)}
|
||||
{#each data.community_blocks as block (block.community.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-2"
|
||||
animate:flip={{ duration: 250 }}
|
||||
@@ -138,22 +137,22 @@
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<CommunityLink community={block.community} avatar />
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.person_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>{$t('content.users')}</SectionTitle>
|
||||
<EditableList on:action={(i) => unblockUser(i.detail)}>
|
||||
<EditableList on:action={(i) => unblockUser(i.detail)}>
|
||||
{#snippet children({ action })}
|
||||
{#each data.person_blocks as block (block.target.id)}
|
||||
{#each data.person_blocks as block (block.target.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-2"
|
||||
animate:flip={{ duration: 250 }}
|
||||
@@ -166,14 +165,14 @@
|
||||
on:click={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<UserLink user={block.target} avatar badges />
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
{/snippet}
|
||||
</EditableList>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { deleteProfile, profile, setUser } from '$lib/auth'
|
||||
import { deleteProfile, profile, setUser } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/lemmy'
|
||||
import { instance as currentInstance } from '$lib/instance'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profileData, setUserID } from '$lib/auth'
|
||||
import { profileData, setUserID } from '$lib/auth.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { client } from '$lib/lemmy'
|
||||
import { t } from '$lib/translations'
|
||||
@@ -73,7 +73,7 @@
|
||||
profileData.update((pd) => {
|
||||
pd.profiles.splice(
|
||||
pd.profiles.findIndex((p) => pd.profile == p.id),
|
||||
1
|
||||
1,
|
||||
)
|
||||
|
||||
return pd
|
||||
@@ -102,8 +102,8 @@
|
||||
on:action={() => deleteAccount(4)}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span >{$t('form.profile.deleteAccount.label')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('form.profile.deleteAccount.label')}</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
@@ -112,10 +112,10 @@
|
||||
<Checkbox bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</Checkbox>
|
||||
</Modal>
|
||||
{/if}
|
||||
@@ -135,10 +135,10 @@
|
||||
<Switch bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</Switch>
|
||||
<Button size="lg" color="danger" on:click={() => deleteAccount(3)}>
|
||||
{$t('routes.profile.delete.title')}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile, profileData, setUserID } from '$lib/auth.js'
|
||||
import { profile, profileData, setUserID } from '$lib/auth.svelte.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { ImageInput, Material, removeToast, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import { Button, Switch, TextInput } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/util.js'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
interface Props {
|
||||
inline?: boolean;
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
inline?: boolean
|
||||
data: any
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { inline = false, data, children }: Props = $props();
|
||||
let { inline = false, data, children }: Props = $props()
|
||||
|
||||
let formData: Omit<SaveUserSettings, 'auth'> | undefined = $state({
|
||||
...data.my_user?.local_user_view?.local_user,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
@@ -10,7 +10,7 @@
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { t } from '$lib/translations'
|
||||
import { Spinner, Button, Menu, MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
@@ -21,7 +21,7 @@
|
||||
ShieldExclamation,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
let my_user = $derived(data.my_user!.local_user_view)
|
||||
</script>
|
||||
@@ -54,7 +54,7 @@
|
||||
]}
|
||||
>
|
||||
{#snippet nameDetail()}
|
||||
<span class="text-sm flex gap-0 items-center w-max" >
|
||||
<span class="text-sm flex gap-0 items-center w-max">
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
@@ -70,11 +70,11 @@
|
||||
dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text-zinc-300 transition-colors"
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates?.map((m) => ({
|
||||
id: m.community.id,
|
||||
@@ -88,7 +88,7 @@
|
||||
{/if}
|
||||
</EntityHeader>
|
||||
|
||||
{#if $userSettings.debugInfo}
|
||||
{#if settings.debugInfo}
|
||||
<pre>
|
||||
{JSON.stringify(my_user, undefined, 4)}
|
||||
</pre>
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { searchParam } from '$lib/util'
|
||||
import { searchParam } from '$lib/util.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import PictrsImage from './PictrsImage.svelte'
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.profile.media.title')}</Header>
|
||||
@@ -22,9 +22,9 @@
|
||||
data.images.findIndex(
|
||||
(i) =>
|
||||
i.local_image.pictrs_delete_token ==
|
||||
image.local_image.pictrs_delete_token
|
||||
image.local_image.pictrs_delete_token,
|
||||
),
|
||||
1
|
||||
1,
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { instance } from '$lib/instance'
|
||||
import { client } from '$lib/lemmy'
|
||||
import { t } from '$lib/translations'
|
||||
import { instanceToURL } from '$lib/util'
|
||||
import { instanceToURL } from '$lib/util.svelte'
|
||||
import type { LocalImage } from 'lemmy-js-client'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
@@ -33,10 +33,10 @@
|
||||
}
|
||||
|
||||
interface Props {
|
||||
image: LocalImage;
|
||||
image: LocalImage
|
||||
}
|
||||
|
||||
let { image }: Props = $props();
|
||||
let { image }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
@@ -59,8 +59,8 @@
|
||||
class="ml-auto"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
title={$t('post.actions.more.delete')}
|
||||
@@ -70,8 +70,8 @@
|
||||
disabled={loading}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini color="text-red-500" />
|
||||
{/snippet}
|
||||
<Icon src={Trash} size="16" mini color="text-red-500" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
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'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { page } from '$app/stores'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Bookmark } from 'svelte-hero-icons'
|
||||
@@ -24,13 +24,13 @@
|
||||
AdjustmentsHorizontal,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
// svelte being stupid
|
||||
let type;
|
||||
let type
|
||||
run(() => {
|
||||
type = data.type as any
|
||||
});
|
||||
})
|
||||
|
||||
const isComment = (item: CommentView | PostView): item is CommentView =>
|
||||
'comment' in item
|
||||
@@ -44,17 +44,17 @@
|
||||
{$t('routes.saved')}
|
||||
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center">
|
||||
<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" >
|
||||
<div class="flex items-center gap-0.5">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="all">
|
||||
<Icon src={Bars3} micro size="15" />
|
||||
{$t('content.all')}
|
||||
@@ -73,8 +73,8 @@
|
||||
</Header>
|
||||
<div
|
||||
class="flex flex-col list-none my-4 divide-slate-200 dark:divide-zinc-800"
|
||||
class:gap-4={$userSettings.view == 'card'}
|
||||
class:!divide-y={$userSettings.view != 'card'}
|
||||
class:gap-4={settings.view == 'card'}
|
||||
class:!divide-y={settings.view != 'card'}
|
||||
>
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type {
|
||||
CommentSortType,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
@@ -17,8 +17,8 @@
|
||||
isPostView,
|
||||
isUser,
|
||||
} from '$lib/lemmy/item.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import type {
|
||||
CommentView,
|
||||
CommunityView,
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
type Result = PostView | CommentView | PersonView | CommunityView
|
||||
|
||||
let { data = $bindable() } = $props();
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let query = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement = $state()
|
||||
@@ -72,7 +72,8 @@
|
||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||
<form
|
||||
onsubmit={preventDefault(() =>
|
||||
searchParam($page.url, 'q', query, 'page'))}
|
||||
searchParam($page.url, 'q', query, 'page'),
|
||||
)}
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
@@ -92,8 +93,8 @@
|
||||
loading={$navigating != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
@@ -104,11 +105,11 @@
|
||||
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="All">{$t('content.all')}</option>
|
||||
<option value="Posts">{$t('content.posts')}</option>
|
||||
<option value="Comments">{$t('content.comments')}</option>
|
||||
@@ -118,7 +119,6 @@
|
||||
<Sort navigate bind:selected={data.sort} />
|
||||
{#snippet summary()}
|
||||
<Button
|
||||
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
@@ -186,8 +186,8 @@
|
||||
{/await}
|
||||
<div
|
||||
class="flex flex-col mt-4 divide-slate-200 dark:divide-zinc-800"
|
||||
class:!divide-y={$userSettings.view != 'card'}
|
||||
class:gap-4={$userSettings.view == 'card'}
|
||||
class:!divide-y={settings.view != 'card'}
|
||||
class:gap-4={settings.view == 'card'}
|
||||
>
|
||||
{#each data.results as result}
|
||||
{#if isPostView(result)}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import type {
|
||||
|
||||
+146
-160
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { defaultSettings, userSettings } from '$lib/settings'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
@@ -39,13 +39,13 @@
|
||||
import { Button, Checkbox, Select, Spinner } from 'mono-svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
|
||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.svelte.js'
|
||||
import Section from './Section.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import { locale, locales, t } from '$lib/translations'
|
||||
import { getDefaultLinks, iconOfLink } from '$lib/components/ui/navbar/link'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { profile } from '$lib/auth'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import AccountPage from '../profile/(local_user)/settings/+page.svelte'
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
@@ -93,7 +93,7 @@
|
||||
const parsed = JSON.parse(importText)
|
||||
const merged = { ...defaultSettings, ...parsed }
|
||||
|
||||
$userSettings = merged
|
||||
// settings = merged
|
||||
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
@@ -123,13 +123,13 @@
|
||||
roundingSide="left"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
on:click={() => {
|
||||
const json = JSON.stringify($userSettings)
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
@@ -138,15 +138,15 @@
|
||||
rounding="none"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
on:click={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => ($userSettings = defaultSettings),
|
||||
action: () => {},
|
||||
})
|
||||
}}
|
||||
class="font-normal"
|
||||
@@ -154,8 +154,8 @@
|
||||
roundingSide="right"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Header>
|
||||
@@ -202,8 +202,8 @@
|
||||
>
|
||||
{$t('profile.profile')}
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} micro size="16" />
|
||||
{/snippet}
|
||||
<Icon src={ArrowRight} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Section>
|
||||
@@ -212,21 +212,21 @@
|
||||
<div class="flex flex-col gap-2">
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span class="inline-flex items-center gap-2">
|
||||
<span class="inline-flex items-center gap-2">
|
||||
{$t('settings.app.lang.title')}
|
||||
<Badge>{$t('settings.beta')}</Badge>
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p >
|
||||
<p>
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={$userSettings.language}>
|
||||
<Select bind:value={settings.language}>
|
||||
<option value={null}>
|
||||
<Icon src={Language} size="16" mini />
|
||||
{$t('settings.app.lang.auto')}
|
||||
@@ -246,52 +246,52 @@
|
||||
</Setting>
|
||||
{#if $locale == 'he'}
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.useRtl}
|
||||
bind:checked={settings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
</div>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
{#snippet description()}
|
||||
<p >
|
||||
{#if $userSettings.view == 'list'}
|
||||
<p>
|
||||
{#if settings.view == 'list'}
|
||||
{$t('settings.app.view.list')}
|
||||
{:else if $userSettings.view == 'cozy'}
|
||||
{:else if settings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
{:else if settings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{:else if $userSettings.view == 'card'}
|
||||
{:else if settings.view == 'card'}
|
||||
{$t('settings.app.view.legacy')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
{/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"
|
||||
>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<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}>
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="All">{$t('filter.location.all')}</option>
|
||||
<option value="Local">{$t('filter.location.local')}</option>
|
||||
<option value="Subscribed">
|
||||
@@ -303,19 +303,16 @@
|
||||
</Select>
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Sort
|
||||
bind:selected={$userSettings.defaultSort.sort}
|
||||
navigate={false}
|
||||
/>
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={$userSettings.defaultSort.comments}>
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
@@ -326,52 +323,52 @@
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
beta
|
||||
bind:checked={$userSettings.infiniteScroll}
|
||||
bind:checked={settings.infiniteScroll}
|
||||
title={$t('settings.app.infiniteScroll.title')}
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={$userSettings.leftAlign}
|
||||
bind:selected={settings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.reverseActions}
|
||||
bind:checked={settings.posts.reverseActions}
|
||||
title={$t('settings.app.reverseActions.title')}
|
||||
description={$t('settings.app.reverseActions.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
supportedPlatforms={{ desktop: true, tablet: false, mobile: false }}
|
||||
bind:checked={$userSettings.newWidth}
|
||||
bind:checked={settings.newWidth}
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.openLinksInNewTab}
|
||||
bind:checked={settings.openLinksInNewTab}
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={$userSettings.font}>
|
||||
<span>{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.font}>
|
||||
<option value="inter">Inter</option>
|
||||
<option value="satoshi/nunito">Satoshi + Nunito</option>
|
||||
<option value="system">System UI</option>
|
||||
@@ -380,68 +377,66 @@
|
||||
</Setting>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.theming.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.theming.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >{$t('settings.app.theming.description')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.theming.description')}</span>
|
||||
{/snippet}
|
||||
<Button href="/theme">
|
||||
{$t('settings.app.theming.link')}
|
||||
{#snippet suffix()}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={ArrowRight} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.randomPlaceholders}
|
||||
bind:checked={settings.randomPlaceholders}
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.expandImages}
|
||||
bind:checked={settings.expandImages}
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.deduplicateEmbed}
|
||||
bind:checked={settings.posts.deduplicateEmbed}
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.app.translation.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.app.translation.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.app.translation.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
bind:value={$userSettings.translator}
|
||||
{/snippet}
|
||||
<!-- <TextInput
|
||||
bind:value={settings.translator}
|
||||
label={$t('settings.app.translation.instance')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
/>
|
||||
/> -->
|
||||
</Setting>
|
||||
<div>
|
||||
<ToggleSetting
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
bind:checked={$userSettings.parseTags}
|
||||
bind:checked={settings.parseTags}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
|
||||
{$t('settings.app.titleTags.rules.title')}
|
||||
|
||||
{/snippet}
|
||||
{$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"
|
||||
>
|
||||
{#each Object.keys($userSettings.tagRules) as rule}
|
||||
{#each Object.keys(settings.tagRules) as rule}
|
||||
<div class="flex flex-row flex-wrap items-center gap-2">
|
||||
<span class="text-lg font-medium">{rule}</span>
|
||||
<MultiSelect
|
||||
bind:selected={$userSettings.tagRules[rule]}
|
||||
bind:selected={settings.tagRules[rule]}
|
||||
options={['blur', 'hide']}
|
||||
optionNames={[
|
||||
$t('settings.app.titleTags.rules.blur'),
|
||||
@@ -457,13 +452,13 @@
|
||||
<Section id="nav" title={$t('settings.navigation.title')}>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.dockPos.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.navigation.dockPos.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.navigation.dockPos.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={[
|
||||
@@ -471,18 +466,18 @@
|
||||
$t('settings.navigation.dockPos.bottom'),
|
||||
$t('settings.navigation.dockPos.adaptive'),
|
||||
]}
|
||||
bind:selected={$userSettings.dock.top}
|
||||
bind:selected={settings.dock.top}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.panel.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.navigation.panel.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.navigation.panel.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={[
|
||||
@@ -490,52 +485,44 @@
|
||||
$t('settings.navigation.panel.off'),
|
||||
$t('settings.navigation.panel.adaptive'),
|
||||
]}
|
||||
bind:selected={$userSettings.dock.noGap}
|
||||
bind:selected={settings.dock.noGap}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting
|
||||
supportedPlatforms={{ desktop: true, tablet: true, mobile: false }}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.navigation.pins.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.navigation.pins.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.navigation.pins.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<div class="flex items-center gap-1 flex-wrap">
|
||||
{#each getDefaultLinks() as pin}
|
||||
<Popover openOnHover placement="bottom">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
<Button
|
||||
size="square-md"
|
||||
|
||||
disabled={$userSettings.dock.pins
|
||||
disabled={settings.dock.pins
|
||||
?.map((p) => p.url)
|
||||
?.includes(pin.url)}
|
||||
on:click={() => {
|
||||
$userSettings.dock.pins = [
|
||||
...($userSettings.dock.pins ?? []),
|
||||
pin,
|
||||
]
|
||||
settings.dock.pins = [...(settings.dock.pins ?? []), pin]
|
||||
}}
|
||||
>
|
||||
<Icon src={iconOfLink(pin.url)} mini size="16" />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<Material
|
||||
|
||||
padding="none"
|
||||
class="px-4 py-2 flex flex-col"
|
||||
>
|
||||
<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}
|
||||
{/snippet}
|
||||
</Popover>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -546,54 +533,54 @@
|
||||
<ToggleSetting
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={$userSettings.embeds.clickToView}
|
||||
bind:checked={settings.embeds.clickToView}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >YouTube</span>
|
||||
{/snippet}
|
||||
<span>YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Select bind:value={$userSettings.embeds.youtube}>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.embeds.youtube}>
|
||||
<option value="youtube">YouTube</option>
|
||||
<option value="invidious">Invidious</option>
|
||||
<option value="piped">Piped</option>
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $userSettings.embeds.youtube == 'invidious'}
|
||||
{#if settings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={$userSettings.embeds.invidious}
|
||||
bind:value={settings.embeds.invidious}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
{#if $userSettings.embeds.youtube == 'piped'}
|
||||
{#if settings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={$userSettings.embeds.piped}
|
||||
bind:value={settings.embeds.piped}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
@@ -601,76 +588,76 @@
|
||||
|
||||
<Section id="lemmy" title={$t('settings.lemmy.title')}>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.showHidden}
|
||||
bind:checked={settings.posts.showHidden}
|
||||
title={$t('settings.lemmy.showHiddenPosts.title')}
|
||||
description={$t('settings.lemmy.showHiddenPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.compactFeatured}
|
||||
bind:checked={settings.posts.compactFeatured}
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.markPostsAsRead}
|
||||
bind:checked={settings.markPostsAsRead}
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.markReadPosts}
|
||||
bind:checked={settings.markReadPosts}
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.crosspostOriginalLink}
|
||||
bind:checked={settings.crosspostOriginalLink}
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={$userSettings.hidePosts.deleted}>
|
||||
<Switch bind:checked={settings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={$userSettings.hidePosts.removed}>
|
||||
<Switch bind:checked={settings.hidePosts.removed}>
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.nsfwBlur}
|
||||
bind:checked={settings.nsfwBlur}
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={$userSettings.showInstances.user}>
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={$userSettings.showInstances.comments}>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={$userSettings.showInstances.community}>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.displayNames}
|
||||
bind:checked={settings.displayNames}
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
@@ -679,10 +666,10 @@
|
||||
<Section id="moderation" title={$t('settings.moderation.title')}>
|
||||
<Setting itemsClass="!flex-col !items-start">
|
||||
{#snippet title()}
|
||||
<span >{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span >
|
||||
<span>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
@@ -700,8 +687,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#each $userSettings.moderation.presets as preset, index}
|
||||
{/snippet}
|
||||
{#each settings.moderation.presets as preset, index}
|
||||
<Material
|
||||
color="transparent"
|
||||
rounding="xl"
|
||||
@@ -719,9 +706,8 @@
|
||||
rounding="lg"
|
||||
class="ml-auto"
|
||||
on:click={() => {
|
||||
$userSettings.moderation.presets.splice(index, 1)
|
||||
$userSettings.moderation.presets =
|
||||
$userSettings.moderation.presets
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
@@ -755,10 +741,10 @@
|
||||
color="none"
|
||||
class="w-full"
|
||||
on:click={() => {
|
||||
$userSettings.moderation.presets = [
|
||||
...$userSettings.moderation.presets,
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${$userSettings.moderation.presets.length + 1}`,
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
@@ -766,8 +752,8 @@
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</Material>
|
||||
@@ -776,12 +762,12 @@
|
||||
|
||||
<Section id="other" title={$t('settings.other.title')}>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.debugInfo}
|
||||
bind:checked={settings.debugInfo}
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.noVirtualize}
|
||||
bind:checked={settings.posts.noVirtualize}
|
||||
title={$t('settings.other.virtualizeFeeds.title')}
|
||||
description={$t('settings.other.virtualizeFeeds.description')}
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import { setUser } from '$lib/auth.svelte.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
@@ -25,7 +25,7 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
const instance = $page.params.instance
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
run(() => {
|
||||
if (email == '') email = undefined
|
||||
});
|
||||
})
|
||||
|
||||
let username = $state(''),
|
||||
password = $state(''),
|
||||
@@ -50,9 +50,9 @@
|
||||
const getCaptcha = async () =>
|
||||
(captcha = await getClient(instance, fetch).getCaptcha())
|
||||
|
||||
let captchaAudio = $derived(captcha?.ok?.wav
|
||||
? `data:audio/wav;base64,${captcha.ok.wav}`
|
||||
: '')
|
||||
let captchaAudio = $derived(
|
||||
captcha?.ok?.wav ? `data:audio/wav;base64,${captcha.ok.wav}` : '',
|
||||
)
|
||||
|
||||
async function submit() {
|
||||
submitting = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import {
|
||||
@@ -24,10 +24,10 @@
|
||||
import { isBlocked } from '$lib/lemmy/user.js'
|
||||
import { Menu, MenuButton, removeToast, toast } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Button, Modal, Select } from 'mono-svelte'
|
||||
import PrivateMessageModal from '$lib/components/lemmy/modal/PrivateMessageModal.svelte'
|
||||
@@ -40,11 +40,11 @@
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
|
||||
interface Props {
|
||||
data: any;
|
||||
inline?: boolean;
|
||||
data: any
|
||||
inline?: boolean
|
||||
}
|
||||
|
||||
let { data = $bindable(), inline = false }: Props = $props();
|
||||
let { data = $bindable(), inline = false }: Props = $props()
|
||||
|
||||
let blocking = false
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
purgeEnabled = true
|
||||
}, 3000)
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
async function purgeUser() {
|
||||
purgingUser = false
|
||||
@@ -127,8 +127,8 @@
|
||||
{#if purgingUser}
|
||||
<Modal bind:open={purgingUser}>
|
||||
{#snippet title()}
|
||||
Purging User
|
||||
{/snippet}
|
||||
Purging User
|
||||
{/snippet}
|
||||
<p>
|
||||
Purging user <span class="font-bold">
|
||||
{data.person_view.person.name}
|
||||
@@ -176,14 +176,14 @@
|
||||
name: $t('stats.joined'),
|
||||
value: formatRelativeDate(
|
||||
publishedToDate(data.person_view.person.published),
|
||||
{ style: 'short' }
|
||||
{ style: 'short' },
|
||||
).toString(),
|
||||
format: false,
|
||||
},
|
||||
]}
|
||||
>
|
||||
{#snippet nameDetail()}
|
||||
<span class="text-sm flex gap-0 items-center w-max" >
|
||||
<span class="text-sm flex gap-0 items-center w-max">
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
@@ -192,18 +192,18 @@
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
{/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"
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates.map((m) => ({
|
||||
id: m.community.id,
|
||||
@@ -216,92 +216,85 @@
|
||||
</Expandable>
|
||||
{/if}
|
||||
{#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">
|
||||
{#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"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon solid size="16" src={Envelope} />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{#if data.person_view.person.matrix_user_id}
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="/inbox/messages/{data.person_view.person.id}"
|
||||
title="Message"
|
||||
href="https://matrix.to/#/{data.person_view.person
|
||||
.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon solid size="16" src={Envelope} />
|
||||
{/snippet}
|
||||
<Icon solid size="16" src={AtSymbol} />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{#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">
|
||||
{/if}
|
||||
{#if isAdmin($profile?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" >
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
<Button size="square-md">
|
||||
<ShieldIcon width={16} filled />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => blockUser(data.person_view.person.id)}
|
||||
on:click={() =>
|
||||
ban(
|
||||
data.person_view.person.banned,
|
||||
data.person_view.person,
|
||||
)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
{/snippet}
|
||||
{isBlocked($profile.user, data.person_view.person.id)
|
||||
? 'Unblock'
|
||||
: 'Block'}
|
||||
<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>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/snippet}
|
||||
{/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={() => blockUser(data.person_view.person.id)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
{/snippet}
|
||||
{isBlocked($profile.user, data.person_view.person.id)
|
||||
? 'Unblock'
|
||||
: 'Block'}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</EntityHeader>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -313,11 +306,11 @@
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<option value="all">{$t('content.all')}</option>
|
||||
<option value="posts">{$t('content.posts')}</option>
|
||||
<option value="comments">{$t('content.comments')}</option>
|
||||
@@ -327,11 +320,11 @@
|
||||
on:change={() => searchParam($page.url, 'sort', data.sort, 'page')}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-1">
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{/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>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte'
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Constants</h1>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { placeholders } from '$lib/util.js'
|
||||
import { placeholders } from '$lib/util.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
let post = $state(placeholders.get('post'))
|
||||
|
||||
Reference in new issue
Block a user