feat(shell): run the docked strips the full height and make them the only fold

The docked panels' strips now run from the top edge of the window to the
bottom, and the top bar ends left of them. The panel header no longer
carries a fold button in docked mode: the strip opens and closes the day
and, on /coach, the conversations; opening moves focus to the panel's
heading and closing returns it to the strip. The sheets keep a close
button, the day's now an X at the end of its header.

The command palette's door is a magnifier at every width, named Search,
with the shortcut in its tooltip. g p opens or closes the day like a
click on its strip, and below the docking width opens the sheet on the
last day or closes it; the shortcuts list shows it under Day.
This commit is contained in:
Marc-André Bombeck committed 2026-10-10 20:04:19 +02:00
1 parent 023115b05c
commit 39fc4e4da2
26 files changed
+561 -229

No files matched your search

@@ -243,16 +243,19 @@ describe("<DayView>", () => {
expect(leave).not.toContain("FAMILY");
});
it("collapses the docked day and closes a sheet, and says which", async () => {
it("has no close button docked, where the strip folds it, and a clear one in a sheet", async () => {
const docked = await render();
const hide = docked.match(/<button[^>]*data-slot="day-close"[^>]*>/)?.[0];
expect(hide).toContain('aria-label="Hide day"');
expect(hide).toContain('aria-expanded="true"');
expect(docked).not.toContain('data-slot="day-close"');
for (const shell of ["sheet", "bottom"] as const) {
const sheet = await render({ shell });
const close = sheet.match(/<button[^>]*data-slot="day-close"[^>]*>/)?.[0];
expect(close).toContain('aria-label="Close day"');
expect(close).not.toContain("aria-expanded");
// An X, at the end of the header row, after the next-day arrow.
expect(sheet.indexOf('data-slot="day-close"')).toBeGreaterThan(
sheet.indexOf('data-slot="day-next"'),
);
expect(sheet).toContain("lucide-x");
}
});
@@ -185,6 +185,27 @@ export function jumpDay(next: DateKey): void {
* Coach's conversations below 1600 px): focus then stays with the control
* that asked for the room instead of moving to the day's edge.
*/
let dayToggle: (() => void) | null = null;
/**
* The mounted layer's open-or-close, the same as a click on the day's strip
* (a sheet with the strip's day below the docking width). The layer
* registers it; `g p` calls it through `toggleDay`.
*/
export function registerDayToggle(toggle: () => void): () => void {
dayToggle = toggle;
return () => {
if (dayToggle === toggle) dayToggle = null;
};
}
/** Open or close the day. False when no day layer is mounted. */
export function toggleDay(): boolean {
if (dayToggle === null) return false;
dayToggle();
return true;
}
let yielding = false;
/** Collapse the docked day to its edge for a neighbouring panel. */
+33 -13
View File
@@ -50,6 +50,7 @@ import {
openDay,
peekDayTriggerAt,
publishOpenDay,
registerDayToggle,
stepDay,
takeDayTrigger,
takeDayYield,
@@ -255,8 +256,8 @@ function DayLayer() {
}, []);
const panelRef = useRef<HTMLElement>(null);
const stripRef = useRef<HTMLButtonElement>(null);
// Set by a fold (the header's control, the strip): focus then lands on the
// strip, which brings the day back from the same place.
// Set by a fold (the strip, its shortcut): focus then lands on the strip,
// which brings the day back from the same place.
const collapsing = useRef(false);
// The remembered day, while the docked day is shut, if it is still a day
@@ -353,6 +354,33 @@ function DayLayer() {
[date, today],
);
// What the strip holds: the open day, else the remembered one, else today.
// Below the docking width the same day is the one `g p` opens.
const stripDay = stripDayOf(date, lastDay, today);
const dockedOpen = dockedDay !== null;
// The strip's click, and `g p` at every width: docked, the column opens
// or folds; below, the sheet opens on the strip's day or closes.
const toggle = useCallback(() => {
if (shell === "docked") {
if (dockedOpen) {
collapse();
return;
}
openDay(stripDay, { trigger: stripRef.current ?? undefined });
return;
}
if (date !== null) {
closeByPerson();
return;
}
openDay(stripDay);
}, [shell, dockedOpen, collapse, stripDay, date, closeByPerson]);
const latestToggle = useRef(toggle);
useEffect(() => {
latestToggle.current = toggle;
});
useEffect(() => registerDayToggle(() => latestToggle.current()), []);
const onPick = useCallback(
(next: DateKey) => {
if (next > today) return;
@@ -418,7 +446,8 @@ function DayLayer() {
today={today}
focus={focus}
shell={shell}
onClose={shell === "docked" ? collapse : closeByPerson}
// Only the sheets show a close button; docked, the strip folds the day.
onClose={closeByPerson}
onStep={onStep}
onPick={onPick}
Title={Title}
@@ -429,16 +458,7 @@ function DayLayer() {
);
if (shell === "docked") {
// What the strip holds: the open day, else the remembered one, else today.
const stripDay = stripDayOf(date, railDay, today);
const open = dockedDay !== null;
const toggle = () => {
if (open) {
collapse();
return;
}
openDay(stripDay, { trigger: stripRef.current ?? undefined });
};
const open = dockedOpen;
return (
<>
{live}
+25 -37
View File
@@ -8,9 +8,8 @@ import {
ChevronRight,
History,
MessageCircle,
PanelBottomClose,
PanelRightClose,
Plus,
X,
} from "lucide-react";
import {
@@ -84,15 +83,12 @@ const ICON_BUTTON =
"text-muted-foreground hover:text-foreground size-11 shrink-0 pointer-fine:size-9";
/**
* The collapse control is the Coach panel's own toggle, in the same place:
* the panel's top-left corner, the panel icon mirrored so it points the way
* the panel goes. Same size and glyph as `PANEL_HEADER_BUTTON` there (kept as
* a copy so the day layer does not pull the Coach's panel into the shell).
* The collapsed edge's control in `day-layer.tsx` takes the same pair.
* The sheets' close control, at the trailing end of the header like the
* Coach sheet's own. The docked day has none: its strip at the right edge of
* the window (`shell-dock.tsx`) is the one control that opens and closes it.
*/
export const PANEL_TOGGLE =
const CLOSE_BUTTON =
"text-muted-foreground hover:text-foreground size-11 shrink-0 pointer-fine:size-7";
export const PANEL_TOGGLE_ICON = "size-5 pointer-fine:size-4";
export function DayView({
date,
@@ -157,7 +153,7 @@ export function DayView({
? Object.values(data.sections).some((s) => s?.reason === "not_shared")
: false;
const compact = shell === "bottom";
const closeLabel = shell === "docked" ? t("day.hidePanel") : t("day.close");
const docked = shell === "docked";
return (
<div
@@ -170,41 +166,19 @@ export function DayView({
data-slot="day-header"
className={cn(
"flex shrink-0 items-center gap-1",
compact ? "pt-0.5 pr-2 pb-2 pl-2" : "border-border border-b px-3",
// The date starts on the body's reading edge (`px-4` / `px-6`).
compact
? "pt-0.5 pr-2 pb-2 pl-4"
: "border-border border-b pr-3 pl-6",
headerClassName,
)}
>
{/* Top left, where the Coach panel keeps its toggle: the way out.
Docked, it collapses the day to the edge; a sheet closes. */}
<Button
type="button"
variant="ghost"
size="icon"
data-slot="day-close"
aria-label={closeLabel}
aria-expanded={shell === "docked" ? true : undefined}
title={closeLabel}
onClick={onClose}
className={PANEL_TOGGLE}
>
{compact ? (
<PanelBottomClose
className={PANEL_TOGGLE_ICON}
aria-hidden="true"
/>
) : (
<PanelRightClose
className={cn(PANEL_TOGGLE_ICON, "-scale-x-100")}
aria-hidden="true"
/>
)}
</Button>
{/* One line, centred in the band: the date and nothing under it. */}
<Title
id={titleId}
ref={titleRef}
tabIndex={-1}
className="min-w-0 flex-1 truncate px-1 text-base leading-snug font-semibold focus-visible:outline-none"
className="min-w-0 flex-1 truncate pr-1 text-base leading-snug font-semibold focus-visible:outline-none"
>
{/* The date is the way to any other day: a calendar opens from
it, so the header needs no icon of its own. */}
@@ -262,6 +236,20 @@ export function DayView({
aria-hidden="true"
/>
</Button>
{docked ? null : (
<Button
type="button"
variant="ghost"
size="icon"
data-slot="day-close"
aria-label={t("day.close")}
title={t("day.close")}
onClick={onClose}
className={CLOSE_BUTTON}
>
<X className="size-5 pointer-fine:size-4" aria-hidden="true" />
</Button>
)}
</div>
<div