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">
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 { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { Button, removeToast, Switch, TextInput, toast } from 'mono-svelte'
let deletion = $state({
modal: false,
@@ -70,9 +60,7 @@
delete_content: deletion.deleteContent,
})
profile.meta.profiles.splice(
profile.meta.profiles.findIndex(p => profile.meta.profile == p.id),
)
profile.remove(profile.current.id)
profile.meta.profile = -1
toast({
@@ -90,43 +78,18 @@
}
</script>
{#if deletion.modal}
<Modal
bind:open={deletion.modal}
action="Submit"
onaction={() => deleteAccount(4)}
>
{#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"
<form
onsubmit={e => {
e.preventDefault()
deleteAccount(4)
}}
class="w-full flex flex-col gap-4 max-w-xl"
>
<Header class="mx-auto w-max font-bold!">
{$t('routes.profile.delete.title')}
</Header>
<p class="text-base">
{$t('routes.profile.delete.warning')}
</p>
<TextInput
label={$t('form.password')}
type="password"
bind:value={deletion.password}
/>
<Switch bind:checked={deletion.deleteContent}>
{$t('form.profile.deleteAccount.deleteContent')}
{#snippet description()}
@@ -135,7 +98,7 @@
</span>
{/snippet}
</Switch>
<Button size="lg" color="danger" onclick={() => deleteAccount(3)}>
{$t('routes.profile.delete.title')}
<Button submit color="danger" size="lg">
{$t('form.submit')}
</Button>
</Material>
</form>