fix: profile color scheme button is inaccessible

This commit is contained in:
James Xylight committed 2025-08-27 17:53:37 -07:00
1 parent 6f2e3c53f9
commit 078fdc2c71
3 files changed
+55 -45

No files matched your search

+44 -43
View File
@@ -16,6 +16,7 @@
Button, Button,
MenuButton, MenuButton,
MenuDivider, MenuDivider,
modal,
Modal, Modal,
Option, Option,
Select, Select,
@@ -44,21 +45,18 @@
let showInstance = $state(false) let showInstance = $state(false)
</script> </script>
{#if showInstance} {#snippet siteSnippet()}
<Modal bind:open={showInstance} title="Instance"> {#if site.data}
{#if site.data} <SiteCard
<SiteCard site={site.data.site_view}
site={site.data.site_view} admins={site.data.admins}
admins={site.data.admins} taglines={site.data.taglines}
taglines={site.data.taglines} version={site.data.version}
version={site.data.version} />
/> {:else}
{:else} <Spinner />
<Spinner /> {/if}
{/if} {/snippet}
</Modal>
{/if}
{#snippet notifBadge(number: number)} {#snippet notifBadge(number: number)}
{#if number > 0} {#if number > 0}
<Badge <Badge
@@ -138,33 +136,33 @@
{/snippet} {/snippet}
{$t('nav.menu.settings')} {$t('nav.menu.settings')}
</MenuButton> </MenuButton>
<MenuButton class="py-0!" onclick={e => e.stopPropagation()}> <!--svelte-ignore a11y_click_events_have_key_events-->
{#snippet prefix()} <!--svelte-ignore a11y_no_static_element_interactions-->
<Icon <div onclick={e => e.stopPropagation()}>
src={theme.colorScheme == 'system' <Select bind:value={theme.colorScheme} size="sm">
? ComputerDesktop {#snippet target()}
: theme.colorScheme == 'light' <MenuButton
? Sun icon={theme.colorScheme == 'system'
: theme.colorScheme == 'dark' ? ComputerDesktop
? Moon : theme.colorScheme == 'light'
? Sun
: Moon} : Moon}
micro class=" w-full"
size="16" >
/> {$t('nav.menu.colorscheme.label')}
{/snippet} </MenuButton>
<span>{$t('nav.menu.colorscheme.label')}</span> <Option value="system" class="hidden" icon={ComputerDesktop}>
<Select bind:value={theme.colorScheme} class="ml-auto my-auto w-24" size="sm"> {$t('nav.menu.colorscheme.system')}
<Option value="system" icon={ComputerDesktop}> </Option>
{$t('nav.menu.colorscheme.system')} <Option value="light" class="hidden" icon={Sun}>
</Option> {$t('nav.menu.colorscheme.light')}
<Option value="light" icon={Sun}> </Option>
{$t('nav.menu.colorscheme.light')} <Option value="dark" class="hidden" icon={Moon}>
</Option> {$t('nav.menu.colorscheme.dark')}
<Option value="dark" icon={Moon}> </Option>
{$t('nav.menu.colorscheme.dark')} {/snippet}
</Option>
</Select> </Select>
</MenuButton> </div>
<MenuButton href="/theme"> <MenuButton href="/theme">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Swatch} size="16" micro /> <Icon src={Swatch} size="16" micro />
@@ -193,9 +191,12 @@
</button> </button>
</div> </div>
<Button <Button
onclick={e => { onclick={() => {
e.stopPropagation() modal({
showInstance = !showInstance title: $t('nav.menu.instance'),
snippet: siteSnippet,
body: '',
})
}} }}
color="tertiary" color="tertiary"
title={$t('nav.menu.instance')} title={$t('nav.menu.instance')}
+6 -1
View File
@@ -21,7 +21,12 @@
ondismissed={() => shownModal.set(undefined)} ondismissed={() => shownModal.set(undefined)}
bind:open bind:open
> >
<p>{$shownModal.body}</p> {#if $shownModal.snippet}
{@render $shownModal.snippet()}
{/if}
{#if $shownModal.body}
<p>{$shownModal.body}</p>
{/if}
{#if $shownModal.actions} {#if $shownModal.actions}
<div <div
class="flex items-center gap-2 {$shownModal.actions.length >= 3 class="flex items-center gap-2 {$shownModal.actions.length >= 3
+5 -1
View File
@@ -1,3 +1,4 @@
import type { Snippet } from 'svelte'
import type { IconSource } from 'svelte-hero-icons' import type { IconSource } from 'svelte-hero-icons'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
@@ -11,6 +12,7 @@ interface Modal {
* Whether the modal has a close button or not * Whether the modal has a close button or not
*/ */
dismissable: boolean dismissable: boolean
snippet?: Snippet
type: 'error' | 'info' | 'success' type: 'error' | 'info' | 'success'
} }
@@ -46,11 +48,12 @@ export const action = (action?: {
export function modal(inputModal: { export function modal(inputModal: {
actions?: Action[] actions?: Action[]
title: string title: string
body: string body?: string
/** /**
* Whether the modal has a close button or not * Whether the modal has a close button or not
*/ */
dismissable?: boolean dismissable?: boolean
snippet?: Snippet
type?: 'error' | 'info' | 'success' type?: 'error' | 'info' | 'success'
}) { }) {
const modal: Modal = { const modal: Modal = {
@@ -59,6 +62,7 @@ export function modal(inputModal: {
title: inputModal.title, title: inputModal.title,
body: inputModal.body, body: inputModal.body,
type: inputModal.type ?? 'info', type: inputModal.type ?? 'info',
snippet: inputModal.snippet,
} }
shownModal.set(modal) shownModal.set(modal)