feat: revamp settings page
This commit is contained in:
1 parent
d788b17f72
commit
4af32dc3f0
6 files changed
+100
-129
No files matched your search
+1
-1
@@ -44,7 +44,7 @@
|
||||
"@dicebear/core": "^6.0.4",
|
||||
"@dicebear/initials": "^6.0.4",
|
||||
"markdown-it": "^13.0.1",
|
||||
"mono-svelte": "^1.3.3"
|
||||
"mono-svelte": "^1.4.2"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
@@ -2,13 +2,19 @@
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { Select } from 'mono-svelte'
|
||||
import { Icon, ViewColumns } from 'svelte-hero-icons'
|
||||
|
||||
export let showLabel = true
|
||||
</script>
|
||||
|
||||
<Select bind:value={$userSettings.view}>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ViewColumns} size="14" mini />
|
||||
View
|
||||
</span>
|
||||
<svelte:fragment slot="label">
|
||||
{#if showLabel}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ViewColumns} size="14" mini />
|
||||
View
|
||||
</span>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<option value="card">Cards</option>
|
||||
<option value="cozy">Cozy</option>
|
||||
<option value="list">List</option>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Setting from './Setting.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/Sort.svelte'
|
||||
import { Disclosure, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { Disclosure, Material, Switch, TextInput, toast } from 'mono-svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import {
|
||||
@@ -22,6 +22,7 @@
|
||||
import ViewSelect from '$lib/components/lemmy/ViewSelect.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { removeItem } from '$lib/util.js'
|
||||
import Section from './Section.svelte'
|
||||
|
||||
let data = {
|
||||
loading: false,
|
||||
@@ -47,24 +48,11 @@
|
||||
</Button>
|
||||
</h1>
|
||||
|
||||
<div
|
||||
class="flex flex-row md:divide-x divide-slate-200 dark:divide-zinc-800"
|
||||
style="scroll-behavior: smooth;"
|
||||
>
|
||||
<nav class="hidden md:flex flex-col gap-2 w-64 pr-4 pt-4 sticky top-16 h-max">
|
||||
<SectionTitle>Navigation</SectionTitle>
|
||||
<Button href="#ui" alignment="left" color="tertiary">UI</Button>
|
||||
<Button href="#posts" alignment="left" color="tertiary">Posts</Button>
|
||||
<Button href="#instances" alignment="left" color="tertiary">
|
||||
Instances
|
||||
</Button>
|
||||
<Button href="#other" alignment="left" color="tertiary">Other</Button>
|
||||
</nav>
|
||||
<div class="flex flex-col md:flex-1 md:pl-4 min-w-0">
|
||||
<SectionTitle id="ui" class="mt-4">UI</SectionTitle>
|
||||
<div class="flex flex-col gap-4" style="scroll-behavior: smooth;">
|
||||
<Section title="UI">
|
||||
<Setting>
|
||||
<span slot="title">Post style</span>
|
||||
<ViewSelect />
|
||||
<ViewSelect showLabel={false} />
|
||||
<p slot="description">
|
||||
{#if $userSettings.view == 'list'}
|
||||
Show posts in a list, with post bodies and compact images.
|
||||
@@ -82,24 +70,19 @@
|
||||
<span slot="description">
|
||||
Show a random placeholder for forms for comments, posts, etc.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.randomPlaceholders}>
|
||||
{$userSettings.randomPlaceholders ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
<Switch bind:checked={$userSettings.randomPlaceholders} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Limit Layout Width</span>
|
||||
<span slot="description">
|
||||
Improve readability by limiting main content width.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.newWidth}>
|
||||
{$userSettings.newWidth ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
<Switch bind:checked={$userSettings.newWidth} />
|
||||
</Setting>
|
||||
|
||||
<Setting>
|
||||
<Setting optionClass="flex-[2]">
|
||||
<span slot="title">Default sort</span>
|
||||
<span slot="description">The default sort to use for feeds.</span>
|
||||
<div class="flex flex-wrap flex-row gap-4 w-full">
|
||||
<div class="flex flex-wrap flex-row gap-4 w-max">
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={$userSettings.defaultSort.feed} class="w-28">
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
@@ -137,27 +120,7 @@
|
||||
Show a user's display name instead of their account username.
|
||||
</span>
|
||||
|
||||
<Checkbox bind:checked={$userSettings.displayNames}>
|
||||
{$userSettings.displayNames ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
|
||||
<SectionTitle class="mt-4" id="posts">Posts</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Mark read posts</span>
|
||||
<span slot="description">Mark a post as read when you click on it.</span>
|
||||
<Checkbox bind:checked={$userSettings.markPostsAsRead}>
|
||||
{$userSettings.markPostsAsRead ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Fade read posts</span>
|
||||
<span slot="description">
|
||||
Fade the title of posts you've already read.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.markReadPosts}>
|
||||
{$userSettings.markReadPosts ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
<Switch bind:checked={$userSettings.displayNames} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Vote style</span>
|
||||
@@ -167,24 +130,55 @@
|
||||
bind:selected={$userSettings.separateVotes}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Expand Images</span>
|
||||
<span slot="description">
|
||||
Clicking on a post's image brings you to an expanded view rather than
|
||||
sending you to the post page.
|
||||
</span>
|
||||
<Switch bind:checked={$userSettings.expandImages} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Thumbnail Alignment</span>
|
||||
<span slot="description">
|
||||
Where thumbnails should be on the post in list/compact view.
|
||||
</span>
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={['Left', 'Right']}
|
||||
bind:selected={$userSettings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
{#if LINKED_INSTANCE_URL}
|
||||
<Setting>
|
||||
<span slot="title">Remove "Powered by Photon"</span>
|
||||
<span slot="description">
|
||||
Remove the massive 120x16 div in the top left corner.
|
||||
</span>
|
||||
<Switch bind:checked={$userSettings.hidePhoton} />
|
||||
</Setting>
|
||||
{/if}
|
||||
</Section>
|
||||
|
||||
<Section title="Lemmy">
|
||||
<Setting>
|
||||
<span slot="title">Mark read posts</span>
|
||||
<span slot="description">Mark a post as read when you click on it.</span>
|
||||
<Switch bind:checked={$userSettings.markPostsAsRead} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Fade read posts</span>
|
||||
<span slot="description">
|
||||
Fade the title of posts you've already read.
|
||||
</span>
|
||||
<Switch bind:checked={$userSettings.markReadPosts} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">NSFW blur</span>
|
||||
<span slot="description">
|
||||
Blur images and remove post bodies of NSFW content.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.nsfwBlur}>
|
||||
{$userSettings.nsfwBlur ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Expand Images</span>
|
||||
<span slot="description">
|
||||
Clicking on an image brings you to an expanded view rather than sending
|
||||
you to the post page.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.expandImages}>
|
||||
{$userSettings.expandImages ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
<Switch bind:checked={$userSettings.nsfwBlur} />
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Hide Posts</span>
|
||||
@@ -209,45 +203,17 @@
|
||||
</div>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Thumbnail Alignment</span>
|
||||
<span slot="description">
|
||||
Where thumbnails should be on the post in list/compact view.
|
||||
</span>
|
||||
<span slot="title">Font</span>
|
||||
<span slot="description">What font Photon should use.</span>
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={['Left', 'Right']}
|
||||
bind:selected={$userSettings.leftAlign}
|
||||
options={['inter', 'system', 'browser']}
|
||||
optionNames={['Inter', 'System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.font}
|
||||
/>
|
||||
</Setting>
|
||||
{#if LINKED_INSTANCE_URL}
|
||||
<Setting>
|
||||
<span slot="title">
|
||||
Remove original project's credit because you don't like the creator as
|
||||
a person
|
||||
</span>
|
||||
<span slot="description">
|
||||
Disable the "Powered by Photon" in the top left corner, thus
|
||||
decreasing visibility of the original project and limiting discovery.
|
||||
The creator of Photon intentionally made it unobtrusive, but if you
|
||||
want to remove it because a 120x16 div bothers you so much, you have
|
||||
that option.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.hidePhoton}>
|
||||
{$userSettings.hidePhoton ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
{/if}
|
||||
|
||||
<SectionTitle class="mt-4" id="instances">Instances</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Show instances</span>
|
||||
<span slot="description">Show items' instances.</span>
|
||||
<span
|
||||
class="flex gap-0 px-3 py-2 bg-slate-100 dark:bg-zinc-800 rounded-md w-max"
|
||||
>
|
||||
Xylight
|
||||
<span class="opacity-50">@example.com</span>
|
||||
</span>
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={$userSettings.showInstances.user}>
|
||||
Users
|
||||
@@ -260,8 +226,9 @@
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<SectionTitle class="mt-4" id="moderation">Moderation</SectionTitle>
|
||||
<Section title="Moderation">
|
||||
<Setting>
|
||||
<span slot="title">Removal reply presets</span>
|
||||
<span slot="description">
|
||||
@@ -287,7 +254,7 @@
|
||||
</ul>
|
||||
</span>
|
||||
{#each $userSettings.moderation.presets as preset, index}
|
||||
<Material color="distinct" padding="md" class="py-3">
|
||||
<Material color="distinct" padding="md" class="py-3 w-full">
|
||||
<details>
|
||||
<summary
|
||||
class="cursor-pointer inline-flex flex-row items-center w-full gap-1"
|
||||
@@ -345,26 +312,16 @@
|
||||
Add Preset
|
||||
</Button>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<SectionTitle class="mt-4" id="other">Other</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Font</span>
|
||||
<span slot="description">What font Photon should use.</span>
|
||||
<MultiSelect
|
||||
options={['inter', 'system', 'browser']}
|
||||
optionNames={['Inter', 'System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.font}
|
||||
/>
|
||||
</Setting>
|
||||
<Section title="Other">
|
||||
<Setting>
|
||||
<span slot="title">Debug Info</span>
|
||||
<span slot="description">
|
||||
Show an option to show debug information. (in posts and such)
|
||||
</span>
|
||||
|
||||
<Checkbox bind:checked={$userSettings.debugInfo}>
|
||||
{$userSettings.debugInfo ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
<Switch bind:checked={$userSettings.debugInfo} />
|
||||
</Setting>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script lang="ts">
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
|
||||
export let title: string
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex flex-col min-w-0 divide-y divide-slate-200 dark:divide-zinc-800
|
||||
[&>*]:py-4"
|
||||
>
|
||||
<SectionTitle class="text-xl text-inherit">{title}</SectionTitle>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -1,22 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { Material } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
<Material color="distinct" padding="none" class="my-2">
|
||||
<div class="px-5 pt-5 flex flex-col gap-3" class:pb-5={!$$slots.default}>
|
||||
<h1 class="font-bold text-lg"><slot name="title" /></h1>
|
||||
<div class="flex flex-row items-center w-full justify-between gap-4">
|
||||
<div class="flex flex-col gap-0.5 flex-1 {$$props.class}">
|
||||
<h1 class="font-medium text-base"><slot name="title" /></h1>
|
||||
{#if $$slots.description}
|
||||
<p class="text-slate-800 dark:text-zinc-200">
|
||||
<p class="text-slate-800 dark:text-zinc-200 text-sm">
|
||||
<slot name="description" />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $$slots.default}
|
||||
<div
|
||||
class="w-full px-5 py-3 bg-slate-50 dark:bg-zinc-950 border-t dark:border-zinc-800 mt-4
|
||||
flex flex-col gap-2"
|
||||
class="w-full flex flex-col gap-2 flex-1 items-end {$$props.optionClass}"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
{/if}
|
||||
</Material>
|
||||
</div>
|
||||
@@ -3043,10 +3043,10 @@ mlly@^1.2.0, mlly@^1.4.0:
|
||||
pkg-types "^1.0.3"
|
||||
ufo "^1.1.2"
|
||||
|
||||
mono-svelte@^1.3.3:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-1.3.3.tgz#07d62be73442978813c0383395802ee58c3db1e6"
|
||||
integrity sha512-ZEG404o7bS/lKfVicO1Vqbl4tnj26Q8Vr9s4DfwTWwjhO6jq7CJMHXJYfjk0865vr6f2SLs3dSmApYlQlamXZw==
|
||||
mono-svelte@^1.4.2:
|
||||
version "1.4.2"
|
||||
resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-1.4.2.tgz#c66520ac9f56e964656228fad34149d5e85d3813"
|
||||
integrity sha512-iAqtHfJBAoBNiE/WSRPEyU/MWTMgLLTbNYhVKq+U2+ktJ9/wC9rhTgbq7CuCzfWBWKFJgtqsZNS/w0TBtIhgXA==
|
||||
dependencies:
|
||||
"@floating-ui/core" "^1.5.0"
|
||||
svelte-floating-ui "^1.5.3"
|
||||
|
||||
Reference in new issue
Block a user