fix: profile color scheme button is inaccessible
This commit is contained in:
3 files changed
+55
-45
No files matched your search
@@ -16,6 +16,7 @@
|
||||
Button,
|
||||
MenuButton,
|
||||
MenuDivider,
|
||||
modal,
|
||||
Modal,
|
||||
Option,
|
||||
Select,
|
||||
@@ -44,21 +45,18 @@
|
||||
let showInstance = $state(false)
|
||||
</script>
|
||||
|
||||
{#if showInstance}
|
||||
<Modal bind:open={showInstance} title="Instance">
|
||||
{#if site.data}
|
||||
<SiteCard
|
||||
site={site.data.site_view}
|
||||
admins={site.data.admins}
|
||||
taglines={site.data.taglines}
|
||||
version={site.data.version}
|
||||
/>
|
||||
{:else}
|
||||
<Spinner />
|
||||
{/if}
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
{#snippet siteSnippet()}
|
||||
{#if site.data}
|
||||
<SiteCard
|
||||
site={site.data.site_view}
|
||||
admins={site.data.admins}
|
||||
taglines={site.data.taglines}
|
||||
version={site.data.version}
|
||||
/>
|
||||
{:else}
|
||||
<Spinner />
|
||||
{/if}
|
||||
{/snippet}
|
||||
{#snippet notifBadge(number: number)}
|
||||
{#if number > 0}
|
||||
<Badge
|
||||
@@ -138,33 +136,33 @@
|
||||
{/snippet}
|
||||
{$t('nav.menu.settings')}
|
||||
</MenuButton>
|
||||
<MenuButton class="py-0!" onclick={e => e.stopPropagation()}>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: theme.colorScheme == 'dark'
|
||||
? Moon
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
<!--svelte-ignore a11y_no_static_element_interactions-->
|
||||
<div onclick={e => e.stopPropagation()}>
|
||||
<Select bind:value={theme.colorScheme} size="sm">
|
||||
{#snippet target()}
|
||||
<MenuButton
|
||||
icon={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: Moon}
|
||||
micro
|
||||
size="16"
|
||||
/>
|
||||
{/snippet}
|
||||
<span>{$t('nav.menu.colorscheme.label')}</span>
|
||||
<Select bind:value={theme.colorScheme} class="ml-auto my-auto w-24" size="sm">
|
||||
<Option value="system" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</Option>
|
||||
<Option value="light" icon={Sun}>
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</Option>
|
||||
<Option value="dark" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
class=" w-full"
|
||||
>
|
||||
{$t('nav.menu.colorscheme.label')}
|
||||
</MenuButton>
|
||||
<Option value="system" class="hidden" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</Option>
|
||||
<Option value="light" class="hidden" icon={Sun}>
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</Option>
|
||||
<Option value="dark" class="hidden" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
{/snippet}
|
||||
</Select>
|
||||
</MenuButton>
|
||||
</div>
|
||||
<MenuButton href="/theme">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Swatch} size="16" micro />
|
||||
@@ -193,9 +191,12 @@
|
||||
</button>
|
||||
</div>
|
||||
<Button
|
||||
onclick={e => {
|
||||
e.stopPropagation()
|
||||
showInstance = !showInstance
|
||||
onclick={() => {
|
||||
modal({
|
||||
title: $t('nav.menu.instance'),
|
||||
snippet: siteSnippet,
|
||||
body: '',
|
||||
})
|
||||
}}
|
||||
color="tertiary"
|
||||
title={$t('nav.menu.instance')}
|
||||
|
||||
@@ -21,7 +21,12 @@
|
||||
ondismissed={() => shownModal.set(undefined)}
|
||||
bind:open
|
||||
>
|
||||
<p>{$shownModal.body}</p>
|
||||
{#if $shownModal.snippet}
|
||||
{@render $shownModal.snippet()}
|
||||
{/if}
|
||||
{#if $shownModal.body}
|
||||
<p>{$shownModal.body}</p>
|
||||
{/if}
|
||||
{#if $shownModal.actions}
|
||||
<div
|
||||
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 { writable } from 'svelte/store'
|
||||
|
||||
@@ -11,6 +12,7 @@ interface Modal {
|
||||
* Whether the modal has a close button or not
|
||||
*/
|
||||
dismissable: boolean
|
||||
snippet?: Snippet
|
||||
type: 'error' | 'info' | 'success'
|
||||
}
|
||||
|
||||
@@ -46,11 +48,12 @@ export const action = (action?: {
|
||||
export function modal(inputModal: {
|
||||
actions?: Action[]
|
||||
title: string
|
||||
body: string
|
||||
body?: string
|
||||
/**
|
||||
* Whether the modal has a close button or not
|
||||
*/
|
||||
dismissable?: boolean
|
||||
snippet?: Snippet
|
||||
type?: 'error' | 'info' | 'success'
|
||||
}) {
|
||||
const modal: Modal = {
|
||||
@@ -59,6 +62,7 @@ export function modal(inputModal: {
|
||||
title: inputModal.title,
|
||||
body: inputModal.body,
|
||||
type: inputModal.type ?? 'info',
|
||||
snippet: inputModal.snippet,
|
||||
}
|
||||
|
||||
shownModal.set(modal)
|
||||
|
||||
Reference in new issue
Block a user