Files
TREK/client/src/components/shared/Kbd.tsx
T
Maurice b64da26651 feat(assistant): trip assistant chat with your own AI connection
Adds an in-app assistant that reads and plans the open trip. Users connect
their own provider (Sign in with ChatGPT, or an Anthropic, OpenAI, Gemini or
OpenRouter key) or use the one the admin set up, including a custom
OpenAI-compatible server. It is an addon and only shows while a connection
is usable.

The chat runs on the existing MCP tools, pinned to the trip. Every change is
held as a change card the user applies or discards, and applied changes can
be undone. On the desktop it is a floating window that can be moved and
resized; on the phone it is fullscreen. Search results show as place cards
that can go onto a day, weather lookups as a strip, proposed places as
ghost markers on the map with a before/after switch, and an answer can be
shared into the trip chat. Booking files can be dropped in and are read
into change cards.
2026-10-22 21:30:12 +00:00

26 lines
992 B
TypeScript

/**
* A keyboard shortcut as the keys to press, one quiet chip per key: ["⌘", "K"]
* reads as two keys, not as the text "⌘K". The chips take the colour of the
* text around them, so the same shortcut sits in a tooltip, a menu row or a
* button without a palette of its own.
*/
export default function Kbd({ keys, className = '' }: { keys: readonly string[]; className?: string }) {
return (
<kbd className={`inline-flex items-center gap-0.5 font-[inherit] ${className}`}>
{keys.map((key, i) => (
<span
key={`${key}-${i}`}
className="inline-flex min-w-[1.5em] items-center justify-center rounded border border-edge-secondary px-1 text-caption leading-[1.5] opacity-80"
>
{key}
</span>
))}
</kbd>
);
}
/** Whether shortcuts here read with ⌘ rather than Ctrl. */
export function isApplePlatform(): boolean {
return typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
}