Files
Jyotisha/frontend/src/components/secondary-header.tsx
T
jesse-ux ab6c55f822 feat: keep up to five chart subjects on typed columns
Chart, ephemeris, reports, daily language, consult, and synastry read birth data only through resolveSubjectBirth. The current person is a request parameter outside Home(). /people replaces the settings chart pane, and deleting someone removes that person's chats and reports.
2026-09-25 04:19:05 +08:00

52 lines
2.0 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { SidebarTrigger } from "@/components/ui/sidebar";
/**
* The 46px header every secondary page carries.
*
* It used to be `SecondaryShell`, which also mounted a `SidebarProvider` and a
* sidebar of its own. Four routes rendering that shell meant four shells: every
* arrival remounted the nav and re-issued `GET /api/sessions` and
* `GET /api/account`, even when the reader had only stepped from `/chart` to
* `/ephemeris`. The provider, the sidebar and the inset now live once, in
* `app/(secondary)/layout.tsx`; what is left here is the header itself, which is
* genuinely per page because only the page knows its name and its actions.
*
* The trigger still sits in this row — the provider is above it in the tree, so
* `useSidebar()` resolves exactly as before.
*/
export type SecondaryHeaderProps = {
/** Shown in the header. Pass a falsy value for pages that carry their own. */
readonly title: string;
/** Right-aligned header controls: the one primary action, at most two. */
readonly actions?: ReactNode;
/** A quiet chip beside the title — birth line, report date. */
readonly note?: ReactNode;
/** Person switcher beside the title. Not the birth-line note. */
readonly besideTitle?: ReactNode;
/** Keep the note slot so a late birth line cannot collapse the 46px row. */
readonly reserveNote?: boolean;
};
export function SecondaryHeader({ title, actions, note, besideTitle, reserveNote = false }: SecondaryHeaderProps) {
const showNote = Boolean(note) || reserveNote;
return (
<header className="chat-header has-title">
<SidebarTrigger placement="inset" />
<div className="chat-header-title">
<strong>{title}</strong>
{besideTitle}
{showNote ? (
<span className="chat-header-chart" aria-hidden={note ? undefined : true}>
{note ?? "\u00a0"}
</span>
) : null}
</div>
{actions ? <div className="chat-header-actions">{actions}</div> : null}
</header>
);
}