fix(webui): stop menus locking the page, and make tooltips optional
Two things reported from use. The topbar dropdowns shifted the whole page on click. reka's DropdownMenu is modal by default, which locks body scroll; losing the scrollbar widens the layout by its width (measured: 15px at 1440), so everything moved sideways. It also blocked clicking the page while a menu was open. Non-modal is now the default for every dropdown, not just the nav's: a menu is not a dialog. Hover descriptions became a preference on /system/appearance, applied in the Tooltip primitive so a tooltip added later honours it without each call site remembering. On by default; nothing depends on a tooltip to be usable. Appearance also lost its duplicated copy: the page, its first card, and that card's field each said "Appearance" or "Theme" in turn.
This commit is contained in:
1 parent
8346103200
commit
aaa1e0d8c8
7 files changed
+68
-26
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import type { DropdownMenuRootEmits, DropdownMenuRootProps } from 'reka-ui'
|
||||
import { DropdownMenuRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
|
||||
const props = defineProps<DropdownMenuRootProps>()
|
||||
const props = withDefaults(defineProps<DropdownMenuRootProps>(), { modal: false })
|
||||
const emits = defineEmits<DropdownMenuRootEmits>()
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { TooltipRootEmits, TooltipRootProps } from 'reka-ui'
|
||||
import { TooltipRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { tooltipsEnabled } from '@/lib/preferences'
|
||||
|
||||
const props = defineProps<TooltipRootProps>()
|
||||
const emits = defineEmits<TooltipRootEmits>()
|
||||
@@ -13,6 +14,7 @@ const forwarded = useForwardPropsEmits(props, emits)
|
||||
v-slot="slotProps"
|
||||
data-slot="tooltip"
|
||||
v-bind="forwarded"
|
||||
:disabled="props.disabled || !tooltipsEnabled"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</TooltipRoot>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { ref, type Ref } from "vue";
|
||||
|
||||
export const TOOLTIPS_KEY = "archie.tooltips";
|
||||
export function storedTooltips(): boolean {
|
||||
try {
|
||||
return localStorage.getItem(TOOLTIPS_KEY) !== "off";
|
||||
} catch {
|
||||
// Private windows and blocked site data throw on access. On is the
|
||||
// default, so this is not worth surfacing.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const current = ref<boolean>(storedTooltips());
|
||||
|
||||
/** The live preference, shared app-wide. Change it through `setTooltips`. */
|
||||
export const tooltipsEnabled: Ref<boolean> = current;
|
||||
|
||||
export function setTooltips(enabled: boolean): void {
|
||||
current.value = enabled;
|
||||
try {
|
||||
localStorage.setItem(TOOLTIPS_KEY, enabled ? "on" : "off");
|
||||
} catch {
|
||||
// Still applies for this page view; only persistence is lost.
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import ThemeCard from "./ThemeCard.vue";
|
||||
import TooltipCard from "./TooltipCard.vue";
|
||||
|
||||
/**
|
||||
* Appearance: how the dashboard looks, on this browser.
|
||||
*
|
||||
* The theme control moved here out of the topbar icon, and nothing else has
|
||||
* followed it yet (docs/prds/dashboard-navigation-groups.md).
|
||||
* The theme control moved here out of the topbar icon
|
||||
* (docs/prds/dashboard-navigation-groups.md). These are all browser-local:
|
||||
* there is no daemon-side appearance, so nothing on this page is submitted.
|
||||
* The density and motion preferences the design names are still to come.
|
||||
*/
|
||||
</script>
|
||||
|
||||
@@ -14,5 +17,6 @@ import ThemeCard from "./ThemeCard.vue";
|
||||
<div>
|
||||
<PageHeader title="Appearance" subtitle="How the dashboard looks." />
|
||||
<ThemeCard />
|
||||
<TooltipCard />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { Field, FieldGroup, FieldTitle } from "@/components/ui/field";
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { setTheme, theme, type Theme } from "@/lib/theme";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
@@ -20,15 +19,12 @@ function apply(value: unknown): void {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard title="Appearance" description="How this browser renders the dashboard.">
|
||||
<FieldGroup>
|
||||
<Field orientation="horizontal">
|
||||
<FieldTitle id="theme-label">Theme</FieldTitle>
|
||||
<ToggleGroup :model-value="theme" aria-labelledby="theme-label" @update:model-value="apply">
|
||||
<ToggleGroupItem value="dark">Dark</ToggleGroupItem>
|
||||
<ToggleGroupItem value="light">Light</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
<ConfigCard title="Theme" description="The palette this browser renders the dashboard in.">
|
||||
<div class="flex justify-end">
|
||||
<ToggleGroup :model-value="theme" aria-label="Theme" @update:model-value="apply">
|
||||
<ToggleGroupItem value="dark">Dark</ToggleGroupItem>
|
||||
<ToggleGroupItem value="light">Light</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</div>
|
||||
</ConfigCard>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { setTooltips, tooltipsEnabled } from "@/lib/preferences";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard title="Tooltips" description="Shown on hover, and the only place a clamped cell's full text lives.">
|
||||
<div class="flex justify-end">
|
||||
<Switch aria-label="Tooltips" :model-value="tooltipsEnabled" @update:model-value="setTooltips" />
|
||||
</div>
|
||||
</ConfigCard>
|
||||
</template>
|
||||
Reference in new issue
Block a user