fixed issues namely reveloved around chat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { enhance } from '$app/forms';
|
||||
import { enhance, applyAction } from '$app/forms';
|
||||
import { ViewHeader, CardGrid, Card, Button } from '$lib/components';
|
||||
|
||||
let { data, form } = $props();
|
||||
@@ -24,7 +24,20 @@
|
||||
{:else}
|
||||
<CardGrid>
|
||||
<Card cols={2} title="Appearance">
|
||||
<form method="POST" action="?/update" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/update"
|
||||
use:enhance={() => {
|
||||
return async ({ result }) => {
|
||||
// Apply the action result (so the success/error message
|
||||
// shows) WITHOUT resetting the form — the default enhance
|
||||
// clears name/email inputs on a successful submit.
|
||||
if (result.type === 'success' || result.type === 'failure') {
|
||||
await applyAction(result);
|
||||
}
|
||||
};
|
||||
}}
|
||||
>
|
||||
<div style="margin-bottom:1rem">
|
||||
<label style="display:block;font-size:0.85rem;color:#374151;margin-bottom:0.25rem">
|
||||
Display Name
|
||||
@@ -83,7 +96,9 @@
|
||||
<p style="color:#059669;font-size:0.85rem;margin-bottom:0.5rem">Saved!</p>
|
||||
{/if}
|
||||
|
||||
<Button type="submit" variant="primary">Save</Button>
|
||||
<div class="form-actions">
|
||||
<Button type="submit" variant="primary">Update preferences</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
@@ -97,3 +112,11 @@
|
||||
</Card>
|
||||
</CardGrid>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.form-actions {
|
||||
margin-top: 1.25rem;
|
||||
padding-top: 1.25rem;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user