design: redesign credentials page

This commit is contained in:
James Xylight committed 2025-08-24 11:00:08 -07:00
1 parent e5896505d2
commit a50e3f0625
1 file changed
+18 -55
@@ -1,19 +1,9 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { client } from '$lib/lemmy.svelte'
import { t } from '$lib/i18n/translations'
import {
Button,
Checkbox,
Material,
Modal,
removeToast,
Switch,
TextInput,
toast,
} from 'mono-svelte'
import { profile } from '$lib/auth.svelte' import { profile } from '$lib/auth.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { Button, removeToast, Switch, TextInput, toast } from 'mono-svelte'
let deletion = $state({ let deletion = $state({
modal: false, modal: false,
@@ -70,9 +60,7 @@
delete_content: deletion.deleteContent, delete_content: deletion.deleteContent,
}) })
profile.meta.profiles.splice( profile.remove(profile.current.id)
profile.meta.profiles.findIndex(p => profile.meta.profile == p.id),
)
profile.meta.profile = -1 profile.meta.profile = -1
toast({ toast({
@@ -90,43 +78,18 @@
} }
</script> </script>
{#if deletion.modal} <form
<Modal onsubmit={e => {
bind:open={deletion.modal} e.preventDefault()
action="Submit" deleteAccount(4)
onaction={() => deleteAccount(4)} }}
> class="w-full flex flex-col gap-4 max-w-xl"
{#snippet customTitle()}
<span>{$t('form.profile.deleteAccount.label')}</span>
{/snippet}
<TextInput
label={$t('form.password')}
type="password"
bind:value={deletion.password}
/>
<Checkbox bind:checked={deletion.deleteContent}>
{$t('form.profile.deleteAccount.deleteContent')}
{#snippet description()}
<span>
{$t('form.profile.deleteAccount.warning')}
</span>
{/snippet}
</Checkbox>
</Modal>
{/if}
<Material
color="distinct"
class="border-2 border-red-500! text-red-600 dark:text-red-400 flex flex-col gap-4"
padding="xl"
rounding="2xl"
> >
<Header class="mx-auto w-max font-bold!"> <TextInput
{$t('routes.profile.delete.title')} label={$t('form.password')}
</Header> type="password"
<p class="text-base"> bind:value={deletion.password}
{$t('routes.profile.delete.warning')} />
</p>
<Switch bind:checked={deletion.deleteContent}> <Switch bind:checked={deletion.deleteContent}>
{$t('form.profile.deleteAccount.deleteContent')} {$t('form.profile.deleteAccount.deleteContent')}
{#snippet description()} {#snippet description()}
@@ -135,7 +98,7 @@
</span> </span>
{/snippet} {/snippet}
</Switch> </Switch>
<Button size="lg" color="danger" onclick={() => deleteAccount(3)}> <Button submit color="danger" size="lg">
{$t('routes.profile.delete.title')} {$t('form.submit')}
</Button> </Button>
</Material> </form>