-
Notifications
You must be signed in to change notification settings - Fork 1
add settings #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add settings #370
Changes from all commits
1809931
3a98281
41a4311
ca8cb15
8828ea1
4d32369
6ed9cc3
5fd8afd
6963d14
95a3d2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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> | ||
| Open in | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| <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> | ||
There was a problem hiding this comment.
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