The owner found the menu empty and oddly broken into lines. It had three left edges: the playback device sat inside a padded card, the rows that are buttons began at their own padding, and the help heading had a margin of its own. Its gaps were uneven and the two forms of the room were a select. - One edge. The device group loses its padding here, and a row that is a button reaches past the edge so that its icon stands on it. - Groups parted by a rule: appearance (language, theme, the room's form), sound (playback device, feedback sounds), forwarding, then the build and its help. - The room's form is the shared sliding selection, as the handbook gives a short fixed mode, on one line with its name like the language and theme above it. - On a phone the header's own buttons give up their words, and what opens from the header keeps them.
51 lines
2.6 KiB
TypeScript
51 lines
2.6 KiB
TypeScript
import { useId } from "react";
|
|
import { Btn, Chip } from "../../components/living/primitives";
|
|
import { useCopy, type Copy } from "../../ui/copy";
|
|
import type { RoomLayout } from "../../lib/room-preferences";
|
|
import "./channel-interface-control.css";
|
|
|
|
const interfaceOptions = (t: Copy["t"]) => [
|
|
{ value: "full", label: t("channel.interfaceControl.full"),
|
|
description: t("channel.interfaceControl.fullDescription") },
|
|
{ value: "minimal", label: t("channel.interfaceControl.minimal"),
|
|
description: t("channel.interfaceControl.minimalDescription") },
|
|
] as const;
|
|
|
|
/** Presentation only; the caller owns whether this choice is saved or previewed. */
|
|
export function ChannelInterfaceControl({ value, onChange }: {
|
|
value: RoomLayout; onChange(value: RoomLayout): void;
|
|
}) {
|
|
const { t } = useCopy();
|
|
const labelId = useId();
|
|
return <div className="c3-interface-choice">
|
|
<span id={labelId}>{t("channel.interfaceControl.interface")}</span>
|
|
<div className="lr-toggle" role="group" aria-labelledby={labelId}>
|
|
{interfaceOptions(t).map(option => <button key={option.value} type="button" title={option.description}
|
|
className={value === option.value ? "is-selected" : undefined} aria-pressed={value === option.value}
|
|
onClick={() => onChange(option.value)}><span>{option.label}</span></button>)}
|
|
</div>
|
|
</div>;
|
|
}
|
|
|
|
/** An optional first-use choice; creation and personal preference stay with the page. */
|
|
export function ChannelInterfaceSuggestion({ value, onChange, onDismiss }: {
|
|
value: RoomLayout; onChange(value: RoomLayout): void; onDismiss(): void;
|
|
}) {
|
|
const { t } = useCopy();
|
|
const headingId = useId();
|
|
return <section className="c3-interface-suggestion" aria-labelledby={headingId}>
|
|
<h3 id={headingId}>{t("channel.interfaceControl.chooseYourView")}</h3>
|
|
<div className="c3-interface-options" role="group" aria-labelledby={headingId}>
|
|
{interfaceOptions(t).map(option => <Chip key={option.value} selected={value === option.value}
|
|
title={`${option.label}: ${option.description}`} onClick={() => onChange(option.value)}>
|
|
<span className="c3-interface-option-label">{option.label}{option.value === "full" && <small>{t("channel.interfaceControl.default")}</small>}</span>
|
|
<span className="c3-interface-option-description">{option.description}</span>
|
|
</Chip>)}
|
|
</div>
|
|
<footer><Btn icon="arrowRight" size="dense" quiet title={{ text: t("channel.interfaceControl.skip") }}
|
|
cap={{ text: t("channel.interfaceControl.skip") }} onClick={onDismiss} />
|
|
<span>{t("channel.interfaceControl.changeLater")}</span>
|
|
</footer>
|
|
</section>;
|
|
}
|