Files
TREK/client/src/components/Map/categoryIconSvg.ts
T
Maurice 214984f398 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-21 22:29:56 +02:00

21 lines
861 B
TypeScript

import { createElement } from 'react';
import { renderIconMarkup } from '../../utils/iconMarkup';
import { CATEGORY_ICON_MAP } from '../shared/categoryIcons';
/**
* A category's icon as markup for a hand-built map pin, the same on the
* Leaflet and the GL map. The name only picks from the app's own icon table
* (an unknown one falls back to the pin), so nothing it carries reaches the
* markup. Every icon in that table is rendered by iconMarkup.parity.test.ts,
* so a failure here is a bug to surface, not a case to hide.
*/
export function categoryIconSvg(
iconName: string | null | undefined,
size: number,
color = 'white',
strokeWidth = 2.5
): string {
const IconComponent = (iconName && CATEGORY_ICON_MAP[iconName]) || CATEGORY_ICON_MAP['MapPin'];
return renderIconMarkup(createElement(IconComponent, { size, color, strokeWidth }));
}