diff --git a/docs/standards/visual-language.md b/docs/standards/visual-language.md
index 954038145..f355fd363 100644
--- a/docs/standards/visual-language.md
+++ b/docs/standards/visual-language.md
@@ -101,8 +101,9 @@ of a circle. Header utilities share compact alignment and icon scale with the
language track. Low-frequency help stays unframed and quiet; it need not carry
the outline or shadow of direct settings. Narrow layouts shorten captions or
spacing before changing that hierarchy.
-Keep App, language, theme and help together; narrow room headers place connection
-status beside the brand above this utility group instead of wrapping each action.
+Keep desktop App, language, theme and help together on the right. Narrow headers
+retain one row with the brand/back action, signaling dots, App and More; language,
+theme and help share that attached disclosure without duplicating their controls.
`segmented-control.css` owns the sliding treatment for language, mode selection,
tabs and native radio groups. Consumers supply selection and layout; they must
not duplicate the selected colours or press animation. Language choices keep
diff --git a/src/client/components/living/Header.tsx b/src/client/components/living/Header.tsx
index 0867644e9..e94efcb1e 100644
--- a/src/client/components/living/Header.tsx
+++ b/src/client/components/living/Header.tsx
@@ -1,5 +1,5 @@
// App header: brand mark, LED connection state, language selection and theme.
-import { useId, useRef, useState, useSyncExternalStore, type ComponentProps } from "react";
+import { useId, useLayoutEffect, useRef, useState, useSyncExternalStore, type ComponentProps } from "react";
import { createPortal } from "react-dom";
import { browserDebugEnabled, debugError, downloadBrowserDebug, withBrowserDebug } from "../../lib/debug";
import { BrandMark } from "./BrandMark";
@@ -85,15 +85,35 @@ const webVersion = import.meta.env.VITE_PIIK_VERSION ?? "development";
const webRelease = /^v\d+\.\d+\.\d+$/.test(webVersion)
? `https://github.com/TNTcraftHIM/Piik/releases/tag/${webVersion}` : null;
-function BrowserHelpMenu() {
+function BrowserHelpContent({ active }: { active: boolean }) {
const { lang, vis, t } = useCopy();
+ const guide = useProjectLink(`/docs/${lang === "zh" ? "zh/" : ""}troubleshooting.html`,
+ `https://github.com/TNTcraftHIM/Piik/blob/main/docs/guide/troubleshooting${lang === "zh" ? ".zh-CN" : ""}.md`, active);
+ return
;
+}
+
+function BrowserHelpMenu() {
+ const { vis, t } = useCopy();
const id = useId();
const trigger = useRef(null);
const panel = useRef(null);
const [open, setOpen] = useState(false);
useAnchoredPopover(trigger, panel);
- const guide = useProjectLink(`/docs/${lang === "zh" ? "zh/" : ""}troubleshooting.html`,
- `https://github.com/TNTcraftHIM/Piik/blob/main/docs/guide/troubleshooting${lang === "zh" ? ".zh-CN" : ""}.md`, open);
return <>
{createPortal( {
+ className="lr-anchored-card lr-help-menu" onToggle={event => {
if (event.target === event.currentTarget) setOpen(event.newState === "open");
}}>
-
-
- {open && <>
-
-
- {!vis && {t("help.troubleshooting")} }
-
-
-
- >}
-
+
, document.body)}
>;
}
export function HeaderControls({ diagnosticControl, appControl }: { diagnosticControl?: React.ReactNode; appControl?: React.ReactNode } = {}) {
const { vis, t } = useCopy();
+ const controls = useRef(null), trigger = useRef(null), options = useRef(null);
+ const focusInline = useRef(false);
+ const id = useId();
+ const [compact, setCompact] = useState(false), [open, setOpen] = useState(false);
+ useAnchoredPopover(trigger, options, { enabled: compact });
+ useLayoutEffect(() => {
+ const header = controls.current?.closest(".lr-top") ?? controls.current;
+ if (!header) return;
+ const resize = () => {
+ const narrow = header.clientWidth <= 600;
+ if (!narrow && options.current?.hasAttribute("popover")) {
+ const focused = header.ownerDocument.activeElement;
+ focusInline.current = options.current.contains(focused) || Boolean(trigger.current?.contains(focused));
+ if (options.current.matches(":popover-open")) options.current.hidePopover();
+ }
+ if (!narrow) options.current?.removeAttribute("style");
+ setCompact(narrow);
+ };
+ const observer = new ResizeObserver(resize);
+ observer.observe(header); resize();
+ return () => observer.disconnect();
+ }, []);
+ useLayoutEffect(() => {
+ if (!compact && focusInline.current) {
+ focusInline.current = false;
+ (options.current?.querySelector('[aria-pressed="true"]') ?? options.current?.querySelector("button, a"))?.focus();
+ }
+ }, [compact]);
const theme = useSyncExternalStore(subscribeTheme, currentTheme);
const themeTitle = t(theme === "dark" ? "theme.light" : "theme.dark");
const themeButton = (
@@ -147,14 +182,25 @@ export function HeaderControls({ diagnosticControl, appControl }: { diagnosticCo
);
return (
-
+
{appControl}
-
-
- {themeButton}
-
- {diagnosticControl === undefined ?
: diagnosticControl}
-
+ {compact &&
+
+ }
+
{
+ if (event.target === event.currentTarget) setOpen(event.newState === "open");
+ }}>
+
+
+
+ {themeButton}
+
+
+ {diagnosticControl === undefined ? compact ?
:
: diagnosticControl}
+
+
);
}
@@ -183,11 +229,11 @@ export function AppHeader({
{!atHome && }
}
-
+
{led}
: undefined} />
-
+
);
}
diff --git a/src/client/locales/en.ts b/src/client/locales/en.ts
index 80e134b35..bd77250b8 100644
--- a/src/client/locales/en.ts
+++ b/src/client/locales/en.ts
@@ -794,6 +794,7 @@ export const en: Record = {
"mode.language": "Interface language",
"mode.more": "More languages",
+ "header.more": "More options",
"mode.vis": "Visual only",
"theme.dark": "Switch to dark mode",
"theme.light": "Switch to light mode",
diff --git a/src/client/locales/zh.ts b/src/client/locales/zh.ts
index 0210ada69..3057c3541 100644
--- a/src/client/locales/zh.ts
+++ b/src/client/locales/zh.ts
@@ -794,6 +794,7 @@ export const zh = {
"mode.language": "界面语言",
"mode.more": "更多语言",
+ "header.more": "更多选项",
"mode.vis": "纯视觉",
"theme.dark": "切换到暗色模式",
"theme.light": "切换到浅色模式",
diff --git a/src/client/styles.css b/src/client/styles.css
index 70bcd885f..769b89275 100644
--- a/src/client/styles.css
+++ b/src/client/styles.css
@@ -91,7 +91,7 @@ ul { margin: 0; padding: 0; list-style: none; }
.lr-top {
display: flex;
- flex-wrap: wrap;
+ flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
gap: 8px 12px;
@@ -116,7 +116,15 @@ ul { margin: 0; padding: 0; list-style: none; }
.lr-home-arrow { transform: rotate(90deg); color: var(--muted); }
.lr-top-right { display: inline-flex; gap: 10px; align-items: center; }
-.lr-top > .lr-top-right { margin-left: auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
+.lr-top > .lr-top-right { margin-left: auto; min-width: 0; flex: none; justify-content: flex-end; }
+.lr-header-controls { flex: none; }
+.lr-header-options:not([popover]), .lr-header-options:not([popover]) > .lr-header-settings { display: contents; }
+.lr-header-more { display: inline-flex; }
+.lr-header-options:is(:popover-open, .\:popover-open) { display: grid; gap: 16px; }
+.lr-header-settings { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
+.lr-header-options .lr-help-content { padding-top: 14px; border-top: 1px solid var(--control-edge); }
+.lr-top:has(.lr-header-controls.is-overflow) .lr-leds { width: 44px; height: 44px; padding: 0; justify-content: center; }
+.lr-top:has(.lr-header-controls.is-overflow) .lr-leds-label { display: none; }
/* Discrete signaling state, independent of picture quality. */
.lr-leds {
@@ -935,14 +943,14 @@ body.lr-theater-open .lr-top { visibility: hidden; }
.lr-app-connect-help .lr-app-connect-optional { color: var(--muted); font-size: 12px; margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .lr-anchored-card:is(:popover-open, .\:popover-open) { animation: none; } }
.lr-help-menu { width: min(260px, calc(100vw - 16px)); }
-.lr-help-menu header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 2px 14px; }
-.lr-help-menu header strong { font-size: 14px; }
-.lr-help-menu header :is(a, span) { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
-.lr-help-menu header a { text-underline-offset: 3px; }
-.lr-help-menu nav { display: grid; gap: 4px; }
-.lr-help-menu nav .lr-btn { width: 100%; justify-content: flex-start; }
-.lr-help-menu.is-visual nav { display: flex; justify-content: center; gap: 12px; }
-.lr-help-menu.is-visual nav .lr-btn { width: var(--control-compact-size); justify-content: center; }
+.lr-help-content header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 2px 14px; }
+.lr-help-content header strong { font-size: 14px; }
+.lr-help-content header :is(a, span) { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
+.lr-help-content header a { text-underline-offset: 3px; }
+.lr-help-content nav { display: grid; gap: 4px; }
+.lr-help-content nav .lr-btn { width: 100%; justify-content: flex-start; }
+.lr-help-content.is-visual nav { display: flex; justify-content: center; gap: 12px; }
+.lr-help-content.is-visual nav .lr-btn { width: var(--control-compact-size); justify-content: center; }
.lr-cap { font-size: var(--control-label-size); font-weight: 600; color: inherit; white-space: nowrap; }
.lr-chip {
@@ -1800,6 +1808,10 @@ body.lr-theater-open .lr-top { visibility: hidden; }
.lr-leds { gap: 4px; padding: 6px; }
.lr-top .lr-btn.is-compact { width: var(--control-compact-size); padding: 0; }
.lr-top .lr-btn.is-compact .lr-cap { display: none; }
+ .lr-top .lr-header-options[popover] .lr-btn.is-compact { width: auto; padding-inline: 12px; }
+ .lr-top .lr-header-options[popover] .lr-cap { display: inline; }
+ .lr-top .lr-header-options[popover] .lr-help-content nav .lr-btn { width: 100%; }
+ .lr-top .lr-header-options[popover] .lr-help-content.is-visual nav .lr-btn { width: var(--control-compact-size); padding: 0; }
}
@media (orientation: landscape) and (max-height: 500px) {
@@ -1942,12 +1954,6 @@ details[open] > summary > .lr-sharing-chevron { transform: rotate(180deg); }
/* Theatre keeps ordinary feedback with the surrounding room controls.
Missing pictures and required playback actions retain their stage overlay. */
.lr-room.is-theater .lr-stage-notices { display: none; }
-@media (max-width: 480px) {
- .lr-top:has(.lr-leds) { display: grid; grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; }
- .lr-top:has(.lr-leds) > .lr-top-right { display: contents; }
- .lr-top:has(.lr-leds) > .lr-top-right > [role="status"] { justify-self: end; }
- .lr-top:has(.lr-leds) .lr-header-controls { grid-column: 1 / -1; justify-self: end; }
-}
@media (max-width: 360px) {
.lr-client-modes { grid-template-columns: 1fr; }
.lr-lcd { gap: 4px; padding-inline: 6px; font-size: 18px; }