mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 10:44:23 +00:00
d1b8cb20a3
- Found places: the strip shows only when the answer names one of them, the named ones first. A click on a card, or "Add to trip", opens the planner's place form filled in with the place on the day in focus, its Google details (photos, hours, description) loading beside it; "+ Day" and the day grid are gone. - Trip notes: remember_for_trip runs at once without a card. The assistant keeps lasting facts the user mentions (who travels, needs, likes, budget, pace) on its own and offers the unsure ones as a follow-up; the chat shows "Noted for this trip: ..." with the notes a tap away, and reads them again so the dialog never saves over the new note. - City walks: set_city_walk_visit checks a station off on its day (visited, skipped, or the mark taken back), with day_edit as in the day plan, a change card naming the station and its walk, and an undo that restores the status before while the station is as the change left it. - Card heads are a step smaller (32px tile, smaller title and count), and the dot beside "Working on it" in the header is gone.
95 lines
3.0 KiB
TypeScript
95 lines
3.0 KiB
TypeScript
import type { LucideIcon } from 'lucide-react';
|
|
import type { ReactNode } from 'react';
|
|
|
|
import { fs, NEUTRAL_TINT } from '../../../shared/DialogShell';
|
|
import type { Tone } from './assistantTones';
|
|
|
|
/**
|
|
* The head band of an answer card, as the trip's dialogs and booking cards
|
|
* wear it: a tinted band across the card's top, a raised white tile with the
|
|
* icon of what the card is about in its tone, an eyebrow naming the kind,
|
|
* the title, one quiet line under it, a count, and the card's actions at the
|
|
* end. It reaches the card's edges, so a card that opens with it needs no
|
|
* other head.
|
|
*/
|
|
|
|
/** The icon's colour on the white tile, per tone. */
|
|
const GLYPH: Record<Tone, string> = {
|
|
success: 'text-success',
|
|
info: 'text-info',
|
|
warning: 'text-warning',
|
|
danger: 'text-danger',
|
|
};
|
|
|
|
export default function CardHeader({
|
|
icon: Icon,
|
|
tone,
|
|
title,
|
|
eyebrow,
|
|
count,
|
|
meta,
|
|
actions,
|
|
tile,
|
|
tint = NEUTRAL_TINT,
|
|
children,
|
|
}: {
|
|
icon: LucideIcon;
|
|
tone: Tone;
|
|
title: string;
|
|
/** The kind above the title ("PACKING LIST"); none when the title says it. */
|
|
eyebrow?: string;
|
|
count?: number;
|
|
meta?: ReactNode;
|
|
actions?: ReactNode;
|
|
/** In place of the icon tile: a drawing of what the card shows (a route's sketch). */
|
|
tile?: ReactNode;
|
|
tint?: string;
|
|
/** Under the title row, on the band: a progress bar, a row of pills. */
|
|
children?: ReactNode;
|
|
}) {
|
|
return (
|
|
<div className="-mx-3.5 -mt-3 mb-3 px-3.5 pb-2.5 pt-2.5" style={{ background: tint }}>
|
|
<div className={`flex gap-2.5 ${meta ? 'items-start' : 'items-center'}`}>
|
|
{tile ?? (
|
|
<span
|
|
aria-hidden="true"
|
|
className={`grid h-8 w-8 flex-none place-items-center rounded-[10px] bg-surface-card shadow-sm ${GLYPH[tone]}`}
|
|
>
|
|
<Icon size={15} strokeWidth={2} />
|
|
</span>
|
|
)}
|
|
<div className="min-w-0 flex-1">
|
|
{eyebrow && (
|
|
<div
|
|
className="truncate font-geist font-bold uppercase tracking-[.08em] text-content-muted"
|
|
style={fs(9.5)}
|
|
>
|
|
{eyebrow}
|
|
</div>
|
|
)}
|
|
<div className="flex min-w-0 items-center gap-2">
|
|
<bdi
|
|
title={title}
|
|
className="line-clamp-2 min-w-0 font-bold leading-tight tracking-[-0.01em] text-content"
|
|
style={fs(13.5, 'body')}
|
|
>
|
|
{title}
|
|
</bdi>
|
|
{count !== undefined && (
|
|
<span
|
|
className="inline-flex h-[18px] flex-none items-center rounded-full bg-surface-card px-1.5 font-semibold tabular-nums text-content-secondary shadow-sm"
|
|
style={fs(10.5)}
|
|
>
|
|
{count}
|
|
</span>
|
|
)}
|
|
</div>
|
|
{meta && <div className="mt-0.5 font-geist text-caption text-content-muted">{meta}</div>}
|
|
</div>
|
|
{actions && <div className="flex flex-none items-center gap-1">{actions}</div>}
|
|
</div>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|