import { useId } from 'react' import { MapPin, Tag } from 'lucide-react' import { getCategoryIcon } from '../shared/categoryIcons' import { DialogButton, DialogFooter, DialogHeader, DialogShell, DialogTile, FooterSpacer, NEUTRAL_TINT, fs } from '../shared/DialogShell' import { useTranslation } from '../../i18n' import { tintOf } from './planParts' import type { Category } from '../../types' interface PlacesBulkCategoryModalProps { count: number categories: Category[] onPick: (categoryId: number | null) => void onClose: () => void } /** * A category's icon on a wash of its colour, the square the category lists of the * places column are made of. Without a category it is the neutral pin. */ export function CategoryTile({ category, size = 24 }: { category?: Pick | null; size?: number }) { if (!category) { return ( ) } const Icon = getCategoryIcon(category.icon) const color = category.color || 'var(--text-muted)' return ( ) } const ROW = 'flex w-full items-center gap-2.5 rounded-[10px] px-2 py-1.5 text-start hover:bg-surface-hover' /** * Popup for the Places selection toolbar: pick one category to apply to every * currently-selected place. Clicking a row applies it at once and closes. */ export function PlacesBulkCategoryModal({ count, categories, onPick, onClose }: PlacesBulkCategoryModalProps) { const { t } = useTranslation() const titleId = useId() return ( } tint={NEUTRAL_TINT} labelId={titleId} onClose={onClose} title={t('places.changeCategory')} sub={t('places.selectionCount', { count })} /> )} footer={( {t('common.cancel')} )} >
{categories.map(c => ( ))} {categories.length > 0 &&
}
) }