Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 86 additions & 17 deletions src/lib/components/settings.svelte
Original file line number Diff line number Diff line change
@@ -1,32 +1,101 @@
<script lang="ts">
import * as Dialog from '$lib/components/ui/dialog/index.js';
import * as Select from '$lib/components/ui/select/index.js';
import { Checkbox } from '$lib/components/ui/checkbox/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
import Input from './ui/input/input.svelte';
import { buttonVariants } from './ui/button';
import * as Tabs from '$lib/components/ui/tabs/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
import CircleAlertIcon from '@lucide/svelte/icons/circle-alert';

import { settingsOpen } from '$lib/state.svelte';
import { preferencesStore } from '$lib/stores';
import { themes } from '$lib/theme';
import clsx from 'clsx';

const triggerContent = $derived(
const themeTriggerContent = $derived(
themes.find((theme) => theme.value === $preferencesStore.theme)?.label ?? 'No theme :D'
);
</script>

<Dialog.Root bind:open={settingsOpen.current}>
<Dialog.Content>
<Dialog.Header>
<Dialog.Title>Settings</Dialog.Title>
</Dialog.Header>
Appearence
<Dialog.Description>Most of these themes haven't been implemented yet.</Dialog.Description>
<Select.Root type="single" bind:value={$preferencesStore.theme}>
<Select.Trigger>
{triggerContent}
</Select.Trigger>
<Select.Content>
{#each themes as theme}
<Select.Item value={theme.value}>{theme.label}</Select.Item>
{/each}
</Select.Content>
</Select.Root>
<Dialog.Content class="p-0">
<div class="flex max-h-[80vh] flex-col gap-4 overflow-auto p-6">
<Dialog.Header>
<Dialog.Title>Settings</Dialog.Title>
</Dialog.Header>
<Alert.Root variant="destructive">
<CircleAlertIcon class="size-4" />
<Alert.Title>Notice</Alert.Title>
<Alert.Description>These settings basically do nothing</Alert.Description>
</Alert.Root>
Comment on lines +30 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update or remove the placeholder alert message.

The current alert message "These settings basically do nothing" appears to be placeholder text that should be updated with meaningful information or removed entirely before deployment.

🤖 Prompt for AI Agents
In src/lib/components/settings.svelte around lines 30 to 34, the Alert component
contains a placeholder message "These settings basically do nothing." Replace
this placeholder text with a meaningful, user-relevant message that accurately
describes the alert's purpose, or remove the entire Alert component if it is not
needed before deployment.

Open in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Wrap section titles in semantic heading elements.

The section titles ("Open in", "Themes", "Panic key", "Cloak", "Privacy") are currently plain text nodes. For better accessibility and semantic structure, wrap them in heading elements.

Example for line 35:

-			Open in
+			<h3 class="text-sm font-medium">Open in</h3>

Apply similar changes to lines 46, 65, 78, and 90.

Also applies to: 46-46, 65-65, 78-78, 90-90

🤖 Prompt for AI Agents
In src/lib/components/settings.svelte at lines 35, 46, 65, 78, and 90, the
section titles are plain text and should be wrapped in appropriate semantic
heading elements (like h2 or h3) to improve accessibility and document
structure. Replace the plain text nodes with heading tags enclosing the same
text content for each specified line.

<RadioGroup.Root bind:value={$preferencesStore.open}>
<div class="flex items-center space-x-2">
<RadioGroup.Item value="tab" id="tab" />
<Label for="tab">Tab</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroup.Item value="window" id="window" />
<Label for="window">Window</Label>
</div>
</RadioGroup.Root>
Themes
<Dialog.Root>
<Dialog.Trigger class={clsx(buttonVariants({ variant: 'outline' }), 'w-fit justify-start')}>
{themeTriggerContent}
<ChevronDownIcon class="opacity-50" />
</Dialog.Trigger>
<Dialog.Content class="p-0">
<div class="max-h-[80vh] overflow-auto p-6">
<RadioGroup.Root bind:value={$preferencesStore.theme}>
{#each themes as theme}
<div class="flex items-center space-x-2">
<RadioGroup.Item value={theme.value} id={theme.value} />
<Label for={theme.value}>{theme.label}</Label>
</div>
{/each}
</RadioGroup.Root>
</div>
</Dialog.Content>
</Dialog.Root>
Panic key
<div class="flex items-center gap-3">
<Checkbox id="panic" bind:checked={$preferencesStore.panic.enabled} />
<Label for="panic">Enable Panic Key</Label>
</div>
<div class="flex items-center gap-3">
<Checkbox id="panic-disable-experimental" bind:checked={$preferencesStore.panic.enabled} />
<Label for="panic-disable-experimental">Disable Experimental Mode when triggered</Label>
</div>
<div class="flex flex-row gap-3">
<Input bind:value={$preferencesStore.panic.key} placeholder="Key" maxlength={1} />
<Input bind:value={$preferencesStore.panic.url} placeholder="URL" type="url" />
</div>
Cloak
<Tabs.Root bind:value={$preferencesStore.cloak.mode}>
<Tabs.List class="w-full">
<Tabs.Trigger value="off">Off</Tabs.Trigger>
<Tabs.Trigger value="blur">When not focused</Tabs.Trigger>
<Tabs.Trigger value="on">On</Tabs.Trigger>
</Tabs.List>
</Tabs.Root>
<div class="flex flex-row gap-3">
<Input bind:value={$preferencesStore.cloak.name} placeholder="Page Name" />
<Input bind:value={$preferencesStore.cloak.icon} placeholder="Icon URL" />
</div>
Privacy
<div class="flex items-center gap-3">
<Checkbox id="analytics" bind:checked={$preferencesStore.analytics} />
<Label for="analytics">Enable Analytics</Label>
</div>
<div class="flex items-center gap-3">
<Checkbox id="history" bind:checked={$preferencesStore.history} />
<Label for="history">Enable History</Label>
</div>
</div>
</Dialog.Content>
</Dialog.Root>