import React from 'react'; import { Palette, Type, Grid3X3, Layers, Play, Clock, Image, LayoutGrid, Layout } from 'lucide-react'; import { ThemeConfig, GalleryLayoutType, GALLERY_THEME_PRESETS } from '../../types/theme.types'; import { useTranslation } from 'react-i18next'; interface ThemeDisplayProps { theme: ThemeConfig | string; presetName?: string; className?: string; showDetails?: boolean; } const layoutIcons: Record = { grid: , masonry: , carousel: , timeline: , hero: , mosaic: }; export const ThemeDisplay: React.FC = ({ theme, presetName, className = '', showDetails = true }) => { const { t } = useTranslation(); // Parse theme if it's a string let themeConfig: ThemeConfig | null = null; let themeName = t('branding.theme'); if (typeof theme === 'string') { try { if (theme.startsWith('{')) { themeConfig = JSON.parse(theme); } else { // Legacy theme name - find matching preset const preset = Object.entries(GALLERY_THEME_PRESETS).find(([key]) => key === theme); if (preset) { themeConfig = preset[1].config; themeName = preset[1].name; } } } catch (e) { console.error('Failed to parse theme:', e); } } else { themeConfig = theme; } // If we have a preset name, use its display name if (presetName && GALLERY_THEME_PRESETS[presetName]) { themeName = GALLERY_THEME_PRESETS[presetName].name; } if (!themeConfig) { return (
{t('events.noThemeSet')}
); } const galleryLayout = themeConfig.galleryLayout || 'grid'; return (
{/* Theme Name & Layout */}
{themeName}
{layoutIcons[galleryLayout]} {t(`branding.layoutDescriptions.${galleryLayout}`)}
{showDetails && ( <> {/* Color Palette */}
{t('branding.colors')}:
{themeConfig.primaryColor && (
)} {themeConfig.accentColor && (
)} {themeConfig.backgroundColor && (
)}
{/* Typography */} {themeConfig.fontFamily && (
{t('branding.bodyFont')}: {themeConfig.fontFamily}
)} {/* Layout Settings */} {themeConfig.gallerySettings && (
{themeConfig.gallerySettings.spacing && ( {t('branding.photoSpacing')}: {t(`branding.spacing.${themeConfig.gallerySettings.spacing}`)} )} {themeConfig.gallerySettings.photoAnimation && themeConfig.gallerySettings.photoAnimation !== 'none' && ( {t('branding.photoAnimation')}: {t(`branding.animation.${themeConfig.gallerySettings.photoAnimation}`)} )}
)} )}
); }; ThemeDisplay.displayName = 'ThemeDisplay';