design: switch to checkboxes in settings menu
This commit is contained in:
1 parent
adfe8a6e7d
commit
8f58a9a181
3 files changed
+48
-64
No files matched your search
@@ -20,6 +20,7 @@ interface Settings {
|
|||||||
hidePosts: {
|
hidePosts: {
|
||||||
deleted: boolean
|
deleted: boolean
|
||||||
removed: boolean
|
removed: boolean
|
||||||
|
read: boolean
|
||||||
}
|
}
|
||||||
fullWidthLayout: boolean
|
fullWidthLayout: boolean
|
||||||
expandSidebar: boolean
|
expandSidebar: boolean
|
||||||
@@ -49,6 +50,7 @@ const defaultSettings: Settings = {
|
|||||||
hidePosts: {
|
hidePosts: {
|
||||||
deleted: true,
|
deleted: true,
|
||||||
removed: false,
|
removed: false,
|
||||||
|
read: false,
|
||||||
},
|
},
|
||||||
fullWidthLayout: false,
|
fullWidthLayout: false,
|
||||||
expandSidebar: true,
|
expandSidebar: true,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import { getInboxNotifications } from '$lib/auth.js'
|
import { getInboxNotifications } from '$lib/auth.js'
|
||||||
|
import Checkbox from '$lib/components/input/Checkbox.svelte'
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -37,81 +38,60 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Setting>
|
</Setting>
|
||||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">UI</h2>
|
|
||||||
<Setting>
|
|
||||||
<span slot="title">Mark read posts</span>
|
|
||||||
<span slot="description">Fade the title of posts you've already read.</span>
|
|
||||||
<Switch bind:enabled={$userSettings.markReadPosts} />
|
|
||||||
</Setting>
|
|
||||||
<Setting>
|
|
||||||
<span slot="title">Revert vote colors</span>
|
|
||||||
<span slot="description">
|
|
||||||
Make upvotes orange and downvotes blue, like Reddit used to do.
|
|
||||||
</span>
|
|
||||||
<Switch bind:enabled={$userSettings.revertColors} />
|
|
||||||
</Setting>
|
|
||||||
<Setting>
|
|
||||||
<span slot="title">Show compact posts</span>
|
|
||||||
<span slot="description">
|
|
||||||
Show posts with smaller thumbnails and without text bodies.
|
|
||||||
</span>
|
|
||||||
<Switch bind:enabled={$userSettings.showCompactPosts} />
|
|
||||||
</Setting>
|
|
||||||
<Setting>
|
<Setting>
|
||||||
<span slot="title">Hide Posts</span>
|
<span slot="title">Hide Posts</span>
|
||||||
<span slot="description">Hide certain types of posts.</span>
|
<span slot="description">Hide certain types of posts.</span>
|
||||||
<div class="flex flex-row items-center gap-4">
|
<div class="flex flex-row items-center gap-4 flex-wrap">
|
||||||
<div class="flex items-center gap-1 font-bold">
|
<Checkbox bind:checked={$userSettings.hidePosts.deleted}>
|
||||||
Deleted Posts
|
Deleted
|
||||||
<Switch bind:enabled={$userSettings.hidePosts.deleted} />
|
</Checkbox>
|
||||||
</div>
|
<Checkbox bind:checked={$userSettings.hidePosts.removed}>
|
||||||
<div class="flex items-center gap-1 font-bold">
|
Removed
|
||||||
Removed Posts
|
</Checkbox>
|
||||||
<Switch bind:enabled={$userSettings.hidePosts.removed} />
|
<Checkbox bind:checked={$userSettings.hidePosts.read}>Read</Checkbox>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">UI</h2>
|
||||||
|
<Setting>
|
||||||
|
<Checkbox bind:checked={$userSettings.markReadPosts} slot="title">
|
||||||
|
Mark read posts
|
||||||
|
</Checkbox>
|
||||||
|
<span slot="description">Fade the title of posts you've already read.</span>
|
||||||
|
</Setting>
|
||||||
|
<Setting>
|
||||||
|
<Checkbox bind:checked={$userSettings.revertColors} slot="title">
|
||||||
|
Revert vote colors
|
||||||
|
</Checkbox>
|
||||||
|
<span slot="description">
|
||||||
|
Make upvotes orange and downvotes blue, like Reddit used to do.
|
||||||
|
</span>
|
||||||
|
</Setting>
|
||||||
|
<Setting>
|
||||||
|
<span slot="title">Post style</span>
|
||||||
|
<MultiSelect
|
||||||
|
options={[false, true]}
|
||||||
|
optionNames={['Cards', 'Compact']}
|
||||||
|
bind:selected={$userSettings.showCompactPosts}
|
||||||
|
/>
|
||||||
|
</Setting>
|
||||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">Instances</h2>
|
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">Instances</h2>
|
||||||
<Setting>
|
<Setting>
|
||||||
<span slot="title">Show instances</span>
|
<span slot="title">Show instances</span>
|
||||||
<span slot="description">Show items' 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">
|
<span
|
||||||
|
class="flex gap-0 px-3 py-2 bg-slate-100 dark:bg-zinc-800 rounded-md w-max"
|
||||||
|
>
|
||||||
Xylight
|
Xylight
|
||||||
<span class="opacity-50">@example.com</span>
|
<span class="opacity-50">@example.com</span>
|
||||||
</span>
|
</span>
|
||||||
<div class="flex flex-row items-center gap-4">
|
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||||
<div class="flex items-center gap-1 font-bold">
|
<Checkbox bind:checked={$userSettings.showInstances.user}>Users</Checkbox>
|
||||||
Users
|
<Checkbox bind:checked={$userSettings.showInstances.comments}>
|
||||||
<Switch bind:enabled={$userSettings.showInstances.user} />
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-1 font-bold">
|
|
||||||
Comments
|
Comments
|
||||||
<Switch bind:enabled={$userSettings.showInstances.comments} />
|
</Checkbox>
|
||||||
</div>
|
<Checkbox bind:checked={$userSettings.showInstances.community}>
|
||||||
<div class="flex items-center gap-1 font-bold">
|
|
||||||
Communities
|
Communities
|
||||||
<Switch bind:enabled={$userSettings.showInstances.community} />
|
</Checkbox>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Setting>
|
</Setting>
|
||||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">Notifications</h2>
|
|
||||||
<Setting>
|
|
||||||
<span slot="title">Push notifications</span>
|
|
||||||
<span slot="description">Get notified for new items in your inbox.</span>
|
|
||||||
<Switch
|
|
||||||
bind:enabled={$userSettings.notifications.enabled}
|
|
||||||
on:change={async (e) => {
|
|
||||||
if (e.detail == false) return
|
|
||||||
const res = await Notification.requestPermission()
|
|
||||||
if (res != 'granted') {
|
|
||||||
$userSettings.notifications.enabled = false
|
|
||||||
toast({
|
|
||||||
content: 'Notification permission denied',
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Setting>
|
|
||||||
</div>
|
</div>
|
||||||
@@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
||||||
<h1 class="font-bold"><slot name="title" /></h1>
|
<h1 class="font-bold"><slot name="title" /></h1>
|
||||||
<p class="text-slate-700 dark:text-zinc-300">
|
{#if $$slots.description}
|
||||||
<slot name="description" />
|
<p class="text-slate-700 dark:text-zinc-300">
|
||||||
</p>
|
<slot name="description" />
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
<slot />
|
<slot />
|
||||||
</Card>
|
</Card>
|
||||||
Reference in new issue
Block a user