feat(webui): refine system navigation and appearance
This commit is contained in:
1 parent
569d01c151
commit
fffa6bc528
21 files changed
+433
-169
No files matched your search
@@ -1,22 +1,115 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import ThemeCard from "./ThemeCard.vue";
|
||||
import TooltipCard from "./TooltipCard.vue";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import {
|
||||
type Density,
|
||||
type Motion,
|
||||
type Theme,
|
||||
useAppearanceStore,
|
||||
} from "@/stores/appearance";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
|
||||
const appearance = useAppearanceStore();
|
||||
const { density, motion, theme, tooltipsEnabled } = storeToRefs(appearance);
|
||||
const { setDensity, setMotion, setTheme, setTooltips } = appearance;
|
||||
|
||||
/**
|
||||
* Appearance: how the dashboard looks, on this browser.
|
||||
*
|
||||
* 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.
|
||||
* These preferences are browser-local and apply immediately. They are grouped
|
||||
* into one bounded surface so labels and controls can be read together instead
|
||||
* of making the operator scan opposite edges of several full-width cards.
|
||||
*/
|
||||
function chooseTheme(value: unknown): void {
|
||||
if (value === "system" || value === "light" || value === "dark") setTheme(value as Theme);
|
||||
}
|
||||
|
||||
function chooseDensity(value: unknown): void {
|
||||
if (value === "comfortable" || value === "compact") setDensity(value as Density);
|
||||
}
|
||||
|
||||
function chooseMotion(value: unknown): void {
|
||||
if (value === "system" || value === "reduced") setMotion(value as Motion);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Appearance" />
|
||||
<ThemeCard />
|
||||
<TooltipCard />
|
||||
<div class="max-w-4xl">
|
||||
<PageHeader title="Appearance" subtitle="How this dashboard looks and responds in this browser." />
|
||||
|
||||
<ConfigCard title="Dashboard preferences" description="Saved only in this browser and applied immediately.">
|
||||
<div class="grid gap-8 min-[700px]:grid-cols-2">
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-theme" class="text-sm font-medium">Theme</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Follow your device, or keep Archie light or dark.</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
variant="outline"
|
||||
:model-value="theme"
|
||||
class="mt-4"
|
||||
aria-labelledby="appearance-theme"
|
||||
@update:model-value="chooseTheme"
|
||||
>
|
||||
<ToggleGroupItem value="system">System</ToggleGroupItem>
|
||||
<ToggleGroupItem value="light">Light</ToggleGroupItem>
|
||||
<ToggleGroupItem value="dark">Dark</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</section>
|
||||
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-density" class="text-sm font-medium">Density</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Use relaxed spacing, or fit more work on screen.</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
variant="outline"
|
||||
:model-value="density"
|
||||
class="mt-4"
|
||||
aria-labelledby="appearance-density"
|
||||
@update:model-value="chooseDensity"
|
||||
>
|
||||
<ToggleGroupItem value="comfortable">Comfortable</ToggleGroupItem>
|
||||
<ToggleGroupItem value="compact">Compact</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</section>
|
||||
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-motion" class="text-sm font-medium">Motion</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Follow your device, or reduce interface animation here.</p>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
variant="outline"
|
||||
:model-value="motion"
|
||||
class="mt-4"
|
||||
aria-labelledby="appearance-motion"
|
||||
@update:model-value="chooseMotion"
|
||||
>
|
||||
<ToggleGroupItem value="system">System</ToggleGroupItem>
|
||||
<ToggleGroupItem value="reduced">Reduced</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</section>
|
||||
|
||||
<section class="flex min-w-0 flex-col items-start">
|
||||
<div>
|
||||
<h2 id="appearance-tooltips" class="text-sm font-medium">Tooltips</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Show extra context when controls are hovered or focused.</p>
|
||||
</div>
|
||||
<Switch
|
||||
:model-value="tooltipsEnabled"
|
||||
class="mt-4"
|
||||
aria-labelledby="appearance-tooltips"
|
||||
@update:model-value="setTooltips"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</ConfigCard>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,30 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { setTheme, theme, type Theme } from "@/lib/theme";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
|
||||
/**
|
||||
* The theme control, moved off the topbar icon and onto a page of its own so
|
||||
* the chrome carries no preference.
|
||||
*
|
||||
* It writes through lib/theme, which sets the attribute index.html reads before
|
||||
* the first paint and stores the choice in this browser: there is no
|
||||
* server-side appearance to save, and nothing here to submit. The density and
|
||||
* motion preferences this page exists for are not built yet
|
||||
* (docs/prds/dashboard-navigation-groups.md).
|
||||
*/
|
||||
function apply(value: unknown): void {
|
||||
if (value === "light" || value === "dark") setTheme(value as Theme);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard title="Theme">
|
||||
<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>
|
||||
@@ -1,14 +0,0 @@
|
||||
<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">
|
||||
<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