import { SPOT_TYPE_LABELS } from '@/lib/types'; import { SPOT_TYPE_KEYS } from '@/lib/labelKeys'; type Translate = (key: string, params?: Record) => string; /** * Localised label for a spot type/category key. Every key with a * `labelsUi.spotType.*` translation is translated; anything else (legacy values) * falls back to the English `SPOT_TYPE_LABELS` label, or the key itself as a * last resort, so map popups never show a raw tag string. */ export function spotTypeLabel(t: Translate, key: string): string { const labelKey = SPOT_TYPE_KEYS[key]; if (labelKey) return t(labelKey); return SPOT_TYPE_LABELS[key] ?? key; }