Skip to content

Commit 058828b

Browse files
committed
feat: Add settings reset to default confirmation
1 parent 0842cba commit 058828b

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { Button } from '$lib/components/ui/button';
3+
import * as AlertDialog from '$lib/components/ui/alert-dialog';
34
45
interface Props {
56
onReset?: () => void;
@@ -8,8 +9,15 @@
89
910
let { onReset, onSave }: Props = $props();
1011
11-
function handleReset() {
12+
let showResetDialog = $state(false);
13+
14+
function handleResetClick() {
15+
showResetDialog = true;
16+
}
17+
18+
function handleConfirmReset() {
1219
onReset?.();
20+
showResetDialog = false;
1321
}
1422
1523
function handleSave() {
@@ -18,7 +26,23 @@
1826
</script>
1927

2028
<div class="flex justify-between border-t border-border/30 p-6">
21-
<Button variant="outline" onclick={handleReset}>Reset to default</Button>
29+
<Button variant="outline" onclick={handleResetClick}>Reset to default</Button>
2230

2331
<Button onclick={handleSave}>Save settings</Button>
2432
</div>
33+
34+
<AlertDialog.Root bind:open={showResetDialog}>
35+
<AlertDialog.Content>
36+
<AlertDialog.Header>
37+
<AlertDialog.Title>Reset Settings to Default</AlertDialog.Title>
38+
<AlertDialog.Description>
39+
Are you sure you want to reset all settings to their default values? This action cannot be
40+
undone and will permanently remove all your custom configurations.
41+
</AlertDialog.Description>
42+
</AlertDialog.Header>
43+
<AlertDialog.Footer>
44+
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
45+
<AlertDialog.Action onclick={handleConfirmReset}>Reset to Default</AlertDialog.Action>
46+
</AlertDialog.Footer>
47+
</AlertDialog.Content>
48+
</AlertDialog.Root>

tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarConversationItem.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
>
9090
<!-- svelte-ignore a11y_click_events_have_key_events -->
9191
<!-- svelte-ignore a11y_no_static_element_interactions -->
92-
<div class="text flex min-w-0 flex-1 items-center space-x-3" onclick={handleMobileSidebarItemClick}>
92+
<div
93+
class="text flex min-w-0 flex-1 items-center space-x-3"
94+
onclick={handleMobileSidebarItemClick}
95+
>
9396
<div class="min-w-0 flex-1">
9497
<p class="truncate text-sm font-medium">{conversation.name}</p>
9598

0 commit comments

Comments
 (0)