import { useTranslation } from 'react-i18next'; import { SUPPORTED_LOCALES, LOCALE_META, type SupportedLocale, type LocaleDict, } from '../../api/landings'; import { cn } from '../../lib/utils'; interface LocaleTabsProps { activeLocale: SupportedLocale; onChange: (locale: SupportedLocale) => void; /** Pass locale dicts to show a green dot indicator when content exists */ contentIndicators?: LocaleDict[]; className?: string; } /** * Horizontal locale tab bar for the admin landing editor. * Shows a green dot on tabs that have content filled in. */ export function LocaleTabs({ activeLocale, onChange, contentIndicators, className, }: LocaleTabsProps) { const { t } = useTranslation(); const hasContent = (locale: SupportedLocale): boolean => { if (!contentIndicators || contentIndicators.length === 0) return false; return contentIndicators.some((dict) => { const value = dict[locale]; return typeof value === 'string' && value.trim().length > 0; }); }; return (
{t('admin.landings.localeHint')}