import React from 'react' import { MapPin, Star } from 'lucide-react' import { getCategoryIcon } from '../shared/categoryIcons' import { fs } from '../shared/DialogShell' import { tintOf } from '../Planner/planParts' /** * What a place is, shown at the cursor while the pointer rests on its marker. * * One card for every map. It was written twice, once in each renderer, and the two * had already drifted in how they resolved the category icon; a third copy for the * collections map was not going to end better. Collections is also why it carries a * rating: on a wall of round photos, "which of these did I like" is the question the * picture cannot answer. * * Follows the cursor rather than anchoring to the marker, and never takes the * pointer: it is a label on the map, not something to aim at. */ export interface PlaceHoverCardProps { x: number y: number name: string | null | undefined categoryName?: string | null categoryIcon?: string | null categoryColor?: string | null address?: string | null /** Average across everyone who rated it, when the surface tracks ratings. */ rating?: number | null /** The picture its marker wears; the card shows it in place of the category tile. */ photo?: string | null } export default function PlaceHoverCard({ x, y, name, categoryName, categoryIcon, categoryColor, address, rating, photo }: PlaceHoverCardProps): React.ReactElement { // The tile wears the category the way the planner's rows do; without one it is a quiet pin. const CatIcon = categoryName ? getCategoryIcon(categoryIcon) : MapPin const tone = categoryName ? categoryColor || 'var(--text-muted)' : null return (