feat: add option to reset settings

This commit is contained in:
Xyphyn committed 2023-08-12 19:07:42 -07:00
1 parent ac9421e8c7
commit 147349d0c2
2 files changed
+18 -3

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ interface Settings {
nsfwBlur: boolean
}
const defaultSettings: Settings = {
export const defaultSettings: Settings = {
newComments: true,
expandableImages: true,
markReadPosts: true,
+17 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import Switch from '$lib/components/input/Switch.svelte'
import { userSettings } from '$lib/settings'
import { defaultSettings, userSettings } from '$lib/settings'
import Setting from './Setting.svelte'
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import Sort from '$lib/components/lemmy/Sort.svelte'
@@ -10,6 +10,7 @@
import Checkbox from '$lib/components/input/Checkbox.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import Link from '$lib/components/input/Link.svelte'
import { ArrowLeftCircle, ArrowPath, Icon } from 'svelte-hero-icons'
let data = {
loading: false,
@@ -21,7 +22,21 @@
</svelte:head>
<div class="flex flex-col">
<h1 class="text-3xl font-bold">Settings</h1>
<h1 class="text-3xl font-bold flex justify-between">
Settings <Button
on:click={() => {
toast({
content:
'Are you sure you want to reset your settings to the default?',
action: () => ($userSettings = defaultSettings),
})
}}
class="font-normal"
>
<Icon src={ArrowPath} mini size="16" slot="icon" />
Reset to default
</Button>
</h1>
<SectionTitle class="mt-4">General</SectionTitle>
<Setting>
<span slot="title">Default sort</span>