impr: separate settings pages
This commit is contained in:
11 files changed
+739
-720
No files matched your search
@@ -21,10 +21,10 @@
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'button'}
|
||||
class={[
|
||||
'px-2.5 py-1 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer',
|
||||
'px-2.5 py-1 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer border',
|
||||
selected
|
||||
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||
: ' border dark:bg-zinc-900/50 bg-white border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800 active:bg-slate-200 active:dark:bg-zinc-900',
|
||||
? 'border-transparent bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||
: ' dark:bg-zinc-900/50 bg-white border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800 active:bg-slate-200 active:dark:bg-zinc-900',
|
||||
]}
|
||||
onclick={href ? undefined : onselect}
|
||||
{disabled}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
@@ -8,6 +9,7 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Button, Modal, toast } from 'mono-svelte'
|
||||
import {
|
||||
Bookmark,
|
||||
@@ -24,8 +26,6 @@
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import CommentForm from './CommentForm.svelte'
|
||||
import type { CommentNodeI } from './comments.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
|
||||
interface Props {
|
||||
node: CommentNodeI
|
||||
@@ -208,7 +208,7 @@
|
||||
source={node.comment_view.comment.content}
|
||||
noStyle
|
||||
class={[
|
||||
'text-[14px] sm:text-base text-slate-700 dark:text-zinc-300 *:leading-[1.6] break-words space-y-3',
|
||||
'text-[15px] sm:text-base text-slate-700 dark:text-zinc-300 *:leading-[1.6] break-words space-y-3',
|
||||
node.comment_view.comment.distinguished
|
||||
? 'bg-green-400/10 p-2 rounded-xl max-w-max font-medium'
|
||||
: page.url.hash.slice(1) ==
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { Button, toast, Modal } from 'mono-svelte'
|
||||
import TextArea from 'mono-svelte/forms/TextArea.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowUpTray,
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { children } = $props()
|
||||
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
</script>
|
||||
|
||||
{#if importing}
|
||||
<Modal
|
||||
bind:open={importing}
|
||||
onaction={() => {
|
||||
try {
|
||||
if (importText == '') {
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
const parsed = JSON.parse(importText)
|
||||
const merged = { ...defaultSettings, ...parsed }
|
||||
|
||||
Object.assign(settings, merged)
|
||||
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
action={$t('routes.theme.import')}
|
||||
>
|
||||
<TextArea bind:value={importText} style="font-family: monospace;" />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => {
|
||||
Object.assign(settings, defaultSettings)
|
||||
},
|
||||
})
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/settings/app',
|
||||
name: $t('settings.app.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/lemmy',
|
||||
name: $t('settings.lemmy.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/embeds',
|
||||
name: $t('settings.embeds.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/moderation',
|
||||
name: $t('settings.moderation.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/other',
|
||||
name: $t('settings.other.title'),
|
||||
},
|
||||
]}
|
||||
style="subpage"
|
||||
></Tabs>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -1,677 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Modal,
|
||||
Select,
|
||||
Switch,
|
||||
TextArea,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowsPointingOut,
|
||||
ArrowsRightLeft,
|
||||
ArrowsUpDown,
|
||||
ArrowTopRightOnSquare,
|
||||
ArrowTrendingDown,
|
||||
ArrowUpTray,
|
||||
Bars2,
|
||||
Bars3,
|
||||
BarsArrowDown,
|
||||
BookOpen,
|
||||
BugAnt,
|
||||
Calendar,
|
||||
ChartBar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Clock,
|
||||
CubeTransparent,
|
||||
CursorArrowRays,
|
||||
DocumentText,
|
||||
ExclamationTriangle,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Fire,
|
||||
GlobeAmericas,
|
||||
Heart,
|
||||
Icon,
|
||||
Language,
|
||||
Photo,
|
||||
Plus,
|
||||
ServerStack,
|
||||
Share,
|
||||
Star,
|
||||
TableCells,
|
||||
Tag,
|
||||
Trash,
|
||||
Trophy,
|
||||
User,
|
||||
VideoCamera,
|
||||
ViewColumns,
|
||||
} from 'svelte-hero-icons'
|
||||
import Section from './Section.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
let localeMap: Map<
|
||||
string,
|
||||
{
|
||||
name: string
|
||||
translated: number
|
||||
flag: string
|
||||
}
|
||||
> = new Map([
|
||||
['en', { name: 'English', translated: -1, flag: '🇬🇧' }],
|
||||
['ar', { name: 'العربية', translated: 0.3, flag: '🟩' }],
|
||||
['he', { name: 'עברית', translated: -1, flag: '🇮🇱' }],
|
||||
['bg', { name: 'български', translated: 0.67, flag: '🇧🇬' }],
|
||||
['de', { name: 'Deutsch', translated: 0.7, flag: '🇩🇪' }],
|
||||
['es', { name: 'Español', translated: 0.89, flag: '🇪🇸' }],
|
||||
['et', { name: 'eesti keel', translated: 0.23, flag: '🇪🇪' }],
|
||||
['fi', { name: 'suomi', translated: 0.98, flag: '🇫🇮' }],
|
||||
['fr', { name: 'Français', translated: 0.93, flag: '🇫🇷' }],
|
||||
['hu', { name: 'Magyar', translated: 0.51, flag: '🇭🇺' }],
|
||||
['ja', { name: '日本語', translated: 0.93, flag: '🇯🇵' }],
|
||||
['nl', { name: 'Nederlands', translated: 0.89, flag: '🇳🇱' }],
|
||||
['pl', { name: 'Polski', translated: 0.91, flag: '🇵🇱' }],
|
||||
['pt', { name: 'Português (PT)', translated: 0.86, flag: '🇵🇹' }],
|
||||
['pt-BR', { name: 'Português (BR)', translated: 0.86, flag: '🇧🇷' }],
|
||||
['tr', { name: 'Türkçe', translated: 0.99, flag: '🇹🇷' }],
|
||||
['ru', { name: 'Русский', translated: 0.88, flag: '🇷🇺' }],
|
||||
['zh-Hans', { name: '简体中文', translated: 0.83, flag: '🇨🇳' }],
|
||||
['zh-Hant', { name: '繁體中文', translated: 0.23, flag: '🇹🇼' }],
|
||||
])
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$t('settings.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
{#if importing}
|
||||
<Modal
|
||||
bind:open={importing}
|
||||
onaction={() => {
|
||||
try {
|
||||
if (importText == '') {
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
const parsed = JSON.parse(importText)
|
||||
const merged = { ...defaultSettings, ...parsed }
|
||||
|
||||
Object.assign(settings, merged)
|
||||
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
action={$t('routes.theme.import')}
|
||||
>
|
||||
<TextArea bind:value={importText} style="font-family: monospace;" />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => {
|
||||
Object.assign(settings, defaultSettings)
|
||||
},
|
||||
})
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div
|
||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
style="scroll-behavior: smooth;"
|
||||
>
|
||||
<Section id="app" title={$t('settings.app.title')}>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE}
|
||||
<Setting icon={Heart}>
|
||||
{#snippet title()}
|
||||
<span class="dark:text-pink-400 text-pink-600">
|
||||
{$t('nav.menu.donate')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
{$t('settings.donate.description')}
|
||||
{/snippet}
|
||||
<Button
|
||||
color="none"
|
||||
class="bg-gradient-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Heart} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.menu.donate')}
|
||||
</Button>
|
||||
</Setting>
|
||||
{/if}
|
||||
<Setting icon={Language}>
|
||||
{#snippet title()}
|
||||
{$t('settings.app.lang.title')}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={settings.language}>
|
||||
<Option icon={Language} value={null}>
|
||||
{$t('settings.app.lang.auto')}
|
||||
</Option>
|
||||
{#each $locales as locale (locale)}
|
||||
{@const mapped = localeMap.get(locale) ?? {
|
||||
flag: '',
|
||||
translated: 1,
|
||||
name: locale,
|
||||
}}
|
||||
<Option value={locale}>
|
||||
{mapped?.flag}
|
||||
{mapped?.name}
|
||||
</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $locale == 'he' || $locale == 'ar'}
|
||||
<ToggleSetting
|
||||
bind:checked={settings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
<Setting icon={ViewColumns}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{#if settings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if settings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
<Setting optionClass="flex-2 max-w-full flex-wrap min-w-0 " icon={ChartBar}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('filter.location.all')}</Option>
|
||||
<Option value="Local">{$t('filter.location.local')}</Option>
|
||||
<Option value="Subscribed">
|
||||
{$t('filter.location.subscribed')}
|
||||
</Option>
|
||||
<Option value="Moderator">
|
||||
{$t('filter.location.moderator')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={BarsArrowDown}
|
||||
bind:checked={settings.infiniteScroll}
|
||||
title={$t('settings.app.infiniteScroll.title')}
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting icon={Photo}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={settings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowsRightLeft}
|
||||
bind:checked={settings.posts.reverseActions}
|
||||
title={$t('settings.app.reverseActions.title')}
|
||||
description={$t('settings.app.reverseActions.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={TableCells}
|
||||
supportedPlatforms={{ desktop: true, tablet: false, mobile: false }}
|
||||
bind:checked={settings.newWidth}
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Calendar}
|
||||
bind:checked={settings.absoluteDates}
|
||||
title={$t('settings.app.absoluteDates.title')}
|
||||
description={$t('settings.app.absoluteDates.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsUpDown}
|
||||
bind:checked={settings.voteRatioBar}
|
||||
title={$t('settings.app.voteRatioBar.title')}
|
||||
description={$t('settings.app.voteRatioBar.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||
bind:checked={settings.dock.autoHide}
|
||||
title={$t('settings.navigation.autoHide.title')}
|
||||
description={$t('settings.navigation.autoHide.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.openLinksInNewTab}
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting icon={DocumentText}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.font}>
|
||||
<Option value="inter">Inter</Option>
|
||||
<Option value="system">System UI</Option>
|
||||
<Option value="browser">Browser</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowPath}
|
||||
bind:checked={settings.randomPlaceholders}
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsPointingOut}
|
||||
bind:checked={settings.expandImages}
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars2}
|
||||
bind:checked={settings.posts.deduplicateEmbed}
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.posts.titleOpensUrl}
|
||||
title={$t('settings.app.titleOpensUrl.title')}
|
||||
description={$t('settings.app.titleOpensUrl.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Tag}
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
bind:checked={settings.parseTags}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section id="embeds" title={$t('settings.embeds.title')}>
|
||||
<ToggleSetting
|
||||
icon={CursorArrowRays}
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={settings.embeds.clickToView}
|
||||
/>
|
||||
<Setting icon={VideoCamera}>
|
||||
{#snippet title()}
|
||||
<span>YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/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 settings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.invidious}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
{#if settings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.piped}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
</Section>
|
||||
|
||||
<Section id="lemmy" title={$t('settings.lemmy.title')}>
|
||||
<ToggleSetting
|
||||
icon={Eye}
|
||||
bind:checked={settings.posts.showHidden}
|
||||
title={$t('settings.lemmy.showHiddenPosts.title')}
|
||||
description={$t('settings.lemmy.showHiddenPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.compactFeatured}
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={BookOpen}
|
||||
bind:checked={settings.markPostsAsRead}
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
bind:checked={settings.markReadPosts}
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Share}
|
||||
bind:checked={settings.crosspostOriginalLink}
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting icon={EyeSlash}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={settings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.hidePosts.removed}>
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ExclamationTriangle}
|
||||
bind:checked={settings.nsfwBlur}
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting icon={ServerStack}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={User}
|
||||
bind:checked={settings.displayNames}
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section id="moderation" title={$t('settings.moderation.title')}>
|
||||
<Setting icon={Trash} adaptive={false}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<li>
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{preset.title}
|
||||
{/snippet}
|
||||
<div class="flex flex-col gap-3">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="danger"
|
||||
rounding="pill"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
class="w-max"
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
</Expandable>
|
||||
</li>
|
||||
{/each}
|
||||
<li>
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full p-2"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
</Section>
|
||||
|
||||
<Section id="other" title={$t('settings.other.title')}>
|
||||
<ToggleSetting
|
||||
icon={BugAnt}
|
||||
bind:checked={settings.debugInfo}
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.noVirtualize}
|
||||
title={$t('settings.other.virtualizeFeeds.title')}
|
||||
description={$t('settings.other.virtualizeFeeds.description')}
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
[data-hide-selected]::before {
|
||||
content: attr(data-label);
|
||||
font-size: small;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/settings/app')
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { Button, Option, Select } from 'mono-svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import {
|
||||
ArrowPath,
|
||||
ArrowsPointingOut,
|
||||
ArrowsRightLeft,
|
||||
ArrowsUpDown,
|
||||
ArrowTopRightOnSquare,
|
||||
ArrowTrendingDown,
|
||||
Bars2,
|
||||
BarsArrowDown,
|
||||
Calendar,
|
||||
ChartBar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Clock,
|
||||
CubeTransparent,
|
||||
DocumentText,
|
||||
Fire,
|
||||
GlobeAmericas,
|
||||
Heart,
|
||||
Icon,
|
||||
Language,
|
||||
Photo,
|
||||
Star,
|
||||
TableCells,
|
||||
Tag,
|
||||
Trophy,
|
||||
ViewColumns,
|
||||
} from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
|
||||
let localeMap: Map<
|
||||
string,
|
||||
{
|
||||
name: string
|
||||
translated: number
|
||||
flag: string
|
||||
}
|
||||
> = new Map([
|
||||
['en', { name: 'English', translated: -1, flag: '🇬🇧' }],
|
||||
['ar', { name: 'العربية', translated: 0.3, flag: '🟩' }],
|
||||
['he', { name: 'עברית', translated: -1, flag: '🇮🇱' }],
|
||||
['bg', { name: 'български', translated: 0.67, flag: '🇧🇬' }],
|
||||
['de', { name: 'Deutsch', translated: 0.7, flag: '🇩🇪' }],
|
||||
['es', { name: 'Español', translated: 0.89, flag: '🇪🇸' }],
|
||||
['et', { name: 'eesti keel', translated: 0.23, flag: '🇪🇪' }],
|
||||
['fi', { name: 'suomi', translated: 0.98, flag: '🇫🇮' }],
|
||||
['fr', { name: 'Français', translated: 0.93, flag: '🇫🇷' }],
|
||||
['hu', { name: 'Magyar', translated: 0.51, flag: '🇭🇺' }],
|
||||
['ja', { name: '日本語', translated: 0.93, flag: '🇯🇵' }],
|
||||
['nl', { name: 'Nederlands', translated: 0.89, flag: '🇳🇱' }],
|
||||
['pl', { name: 'Polski', translated: 0.91, flag: '🇵🇱' }],
|
||||
['pt', { name: 'Português (PT)', translated: 0.86, flag: '🇵🇹' }],
|
||||
['pt-BR', { name: 'Português (BR)', translated: 0.86, flag: '🇧🇷' }],
|
||||
['tr', { name: 'Türkçe', translated: 0.99, flag: '🇹🇷' }],
|
||||
['ru', { name: 'Русский', translated: 0.88, flag: '🇷🇺' }],
|
||||
['zh-Hans', { name: '简体中文', translated: 0.83, flag: '🇨🇳' }],
|
||||
['zh-Hant', { name: '繁體中文', translated: 0.23, flag: '🇹🇼' }],
|
||||
])
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE}
|
||||
<Setting icon={Heart}>
|
||||
{#snippet title()}
|
||||
<span class="dark:text-pink-400 text-pink-600">
|
||||
{$t('nav.menu.donate')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
{$t('settings.donate.description')}
|
||||
{/snippet}
|
||||
<Button
|
||||
color="none"
|
||||
class="bg-gradient-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Heart} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.menu.donate')}
|
||||
</Button>
|
||||
</Setting>
|
||||
{/if}
|
||||
<Setting icon={Language}>
|
||||
{#snippet title()}
|
||||
{$t('settings.app.lang.title')}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={settings.language}>
|
||||
<Option icon={Language} value={null}>
|
||||
{$t('settings.app.lang.auto')}
|
||||
</Option>
|
||||
{#each $locales as locale (locale)}
|
||||
{@const mapped = localeMap.get(locale) ?? {
|
||||
flag: '',
|
||||
translated: 1,
|
||||
name: locale,
|
||||
}}
|
||||
<Option value={locale}>
|
||||
{mapped?.flag}
|
||||
{mapped?.name}
|
||||
</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $locale == 'he' || $locale == 'ar'}
|
||||
<ToggleSetting
|
||||
bind:checked={settings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
<Setting icon={ViewColumns}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{#if settings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if settings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
<Setting optionClass="flex-2 max-w-full flex-wrap min-w-0 " icon={ChartBar}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('filter.location.all')}</Option>
|
||||
<Option value="Local">{$t('filter.location.local')}</Option>
|
||||
<Option value="Subscribed">
|
||||
{$t('filter.location.subscribed')}
|
||||
</Option>
|
||||
<Option value="Moderator">
|
||||
{$t('filter.location.moderator')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={BarsArrowDown}
|
||||
bind:checked={settings.infiniteScroll}
|
||||
title={$t('settings.app.infiniteScroll.title')}
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting icon={Photo}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Switch
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={settings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowsRightLeft}
|
||||
bind:checked={settings.posts.reverseActions}
|
||||
title={$t('settings.app.reverseActions.title')}
|
||||
description={$t('settings.app.reverseActions.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={TableCells}
|
||||
supportedPlatforms={{ desktop: true, tablet: false, mobile: false }}
|
||||
bind:checked={settings.newWidth}
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Calendar}
|
||||
bind:checked={settings.absoluteDates}
|
||||
title={$t('settings.app.absoluteDates.title')}
|
||||
description={$t('settings.app.absoluteDates.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsUpDown}
|
||||
bind:checked={settings.voteRatioBar}
|
||||
title={$t('settings.app.voteRatioBar.title')}
|
||||
description={$t('settings.app.voteRatioBar.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||
bind:checked={settings.dock.autoHide}
|
||||
title={$t('settings.navigation.autoHide.title')}
|
||||
description={$t('settings.navigation.autoHide.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.openLinksInNewTab}
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting icon={DocumentText}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.font}>
|
||||
<Option value="inter">Inter</Option>
|
||||
<Option value="system">System UI</Option>
|
||||
<Option value="browser">Browser</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowPath}
|
||||
bind:checked={settings.randomPlaceholders}
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsPointingOut}
|
||||
bind:checked={settings.expandImages}
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars2}
|
||||
bind:checked={settings.posts.deduplicateEmbed}
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.posts.titleOpensUrl}
|
||||
title={$t('settings.app.titleOpensUrl.title')}
|
||||
description={$t('settings.app.titleOpensUrl.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Tag}
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
bind:checked={settings.parseTags}
|
||||
/>
|
||||
</CommonList>
|
||||
@@ -0,0 +1,69 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import { Select, TextInput } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { CursorArrowRays, VideoCamera } from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={CursorArrowRays}
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={settings.embeds.clickToView}
|
||||
/>
|
||||
<Setting icon={VideoCamera}>
|
||||
{#snippet title()}
|
||||
<span>YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/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 settings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.invidious}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
{#if settings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.piped}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
</CommonList>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Checkbox, Switch } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
BookOpen,
|
||||
CubeTransparent,
|
||||
ExclamationTriangle,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
ServerStack,
|
||||
Share,
|
||||
User,
|
||||
} from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={Eye}
|
||||
bind:checked={settings.posts.showHidden}
|
||||
title={$t('settings.lemmy.showHiddenPosts.title')}
|
||||
description={$t('settings.lemmy.showHiddenPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.compactFeatured}
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={BookOpen}
|
||||
bind:checked={settings.markPostsAsRead}
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
bind:checked={settings.markReadPosts}
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Share}
|
||||
bind:checked={settings.crosspostOriginalLink}
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting icon={EyeSlash}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={settings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.hidePosts.removed}>
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ExclamationTriangle}
|
||||
bind:checked={settings.nsfwBlur}
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting icon={ServerStack}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={User}
|
||||
bind:checked={settings.displayNames}
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
</CommonList>
|
||||
@@ -0,0 +1,102 @@
|
||||
<script lang="ts">
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<Setting icon={Trash} adaptive={false}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<li>
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{preset.title}
|
||||
{/snippet}
|
||||
<div class="flex flex-col gap-3">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="danger"
|
||||
rounding="pill"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
class="w-max"
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
</Expandable>
|
||||
</li>
|
||||
{/each}
|
||||
<li>
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full p-2"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
</CommonList>
|
||||
@@ -1,37 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
|
||||
interface Props {
|
||||
href: string
|
||||
size?: keyof typeof sizes
|
||||
title?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { href, size = 'medium', title = '', children }: Props = $props()
|
||||
|
||||
const sizes = {
|
||||
large: 'h-24',
|
||||
medium: 'h-16',
|
||||
small: 'h-8',
|
||||
}
|
||||
</script>
|
||||
|
||||
<Popover openOnHover placement="right">
|
||||
{#snippet target()}
|
||||
<a {href}>
|
||||
{@render children?.()}
|
||||
</a>
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<Material
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
elevation="medium"
|
||||
class="px-3 py-2 font-medium"
|
||||
>
|
||||
{title}
|
||||
</Material>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
<div class="{sizes[size]} border-l self-center"></div>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Bars3, BugAnt } from 'svelte-hero-icons'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={BugAnt}
|
||||
bind:checked={settings.debugInfo}
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.noVirtualize}
|
||||
title={$t('settings.other.virtualizeFeeds.title')}
|
||||
description={$t('settings.other.virtualizeFeeds.description')}
|
||||
/>
|
||||
</CommonList>
|
||||
Reference in new issue
Block a user