fix: profile color scheme button is inaccessible
This commit is contained in:
3 files changed
+35
-25
No files matched your search
@@ -16,6 +16,7 @@
|
|||||||
Button,
|
Button,
|
||||||
MenuButton,
|
MenuButton,
|
||||||
MenuDivider,
|
MenuDivider,
|
||||||
|
modal,
|
||||||
Modal,
|
Modal,
|
||||||
Option,
|
Option,
|
||||||
Select,
|
Select,
|
||||||
@@ -44,8 +45,7 @@
|
|||||||
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}
|
||||||
@@ -56,9 +56,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<Spinner />
|
<Spinner />
|
||||||
{/if}
|
{/if}
|
||||||
</Modal>
|
{/snippet}
|
||||||
{/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">
|
||||||
|
{#snippet target()}
|
||||||
|
<MenuButton
|
||||||
|
icon={theme.colorScheme == 'system'
|
||||||
? ComputerDesktop
|
? ComputerDesktop
|
||||||
: theme.colorScheme == 'light'
|
: theme.colorScheme == 'light'
|
||||||
? Sun
|
? Sun
|
||||||
: theme.colorScheme == 'dark'
|
|
||||||
? Moon
|
|
||||||
: 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">
|
|
||||||
<Option value="system" icon={ComputerDesktop}>
|
|
||||||
{$t('nav.menu.colorscheme.system')}
|
{$t('nav.menu.colorscheme.system')}
|
||||||
</Option>
|
</Option>
|
||||||
<Option value="light" icon={Sun}>
|
<Option value="light" class="hidden" icon={Sun}>
|
||||||
{$t('nav.menu.colorscheme.light')}
|
{$t('nav.menu.colorscheme.light')}
|
||||||
</Option>
|
</Option>
|
||||||
<Option value="dark" icon={Moon}>
|
<Option value="dark" class="hidden" icon={Moon}>
|
||||||
{$t('nav.menu.colorscheme.dark')}
|
{$t('nav.menu.colorscheme.dark')}
|
||||||
</Option>
|
</Option>
|
||||||
|
{/snippet}
|
||||||
</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')}
|
||||||
|
|||||||
@@ -21,7 +21,12 @@
|
|||||||
ondismissed={() => shownModal.set(undefined)}
|
ondismissed={() => shownModal.set(undefined)}
|
||||||
bind:open
|
bind:open
|
||||||
>
|
>
|
||||||
|
{#if $shownModal.snippet}
|
||||||
|
{@render $shownModal.snippet()}
|
||||||
|
{/if}
|
||||||
|
{#if $shownModal.body}
|
||||||
<p>{$shownModal.body}</p>
|
<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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in new issue
Block a user