import React from 'react'; import { Link } from 'react-router-dom'; import { Calendar, Clock, Download, LogOut } from 'lucide-react'; import { parseISO } from 'date-fns'; import { useTranslation } from 'react-i18next'; import { useLocalizedDate } from '../../hooks/useLocalizedDate'; import { Button } from '../common'; import { DynamicFavicon } from '../common/DynamicFavicon'; import { useTheme } from '../../contexts/ThemeContext'; import { buildResourceUrl } from '../../utils/url'; interface GalleryLayoutProps { event: { event_name: string; event_type?: string; event_date?: string; expires_at?: string; }; brandingSettings?: { company_name?: string; company_tagline?: string; support_email?: string; footer_text?: string; favicon_url?: string; logo_url?: string; }; showLogout?: boolean; onLogout?: () => void; showDownloadAll?: boolean; onDownloadAll?: () => void; isDownloading?: boolean; headerExtra?: React.ReactNode; menuButton?: React.ReactNode; children: React.ReactNode; } export const GalleryLayout: React.FC = ({ event, brandingSettings, showLogout = false, onLogout, showDownloadAll = false, onDownloadAll, isDownloading = false, headerExtra, menuButton, children, }) => { const { t } = useTranslation(); const { format } = useLocalizedDate(); const { theme } = useTheme(); const isNonGridLayout = theme.galleryLayout && theme.galleryLayout !== 'grid' && theme.galleryLayout !== 'hero'; const fontFamily = theme.fontFamily || 'Inter, sans-serif'; const headingFontFamily = theme.headingFontFamily || fontFamily; return (
{/* Dynamic Favicon */} {/* Header structure */}
{/* For non-grid layouts (excluding hero) - keep the current structure */} {isNonGridLayout && (
{/* Left side - Menu button and other header extras */}
{menuButton} {headerExtra}
{/* Right side - Download and Logout */}
{/* Download all button */} {showDownloadAll && onDownloadAll && ( )} {/* Logout button */} {showLogout && onLogout && ( )}
)} {/* For grid layout - everything in one bar */} {!isNonGridLayout && theme.galleryLayout !== 'hero' && (
{/* Left side - Menu button, Logo */}
{/* Menu button */} {menuButton && (
{menuButton}
)} {/* Logo - Show custom logo or fallback to PicPeak logo */}
{brandingSettings?.company_name
{/* Center - Event info */}

{event.event_name}

{(event.event_date || event.expires_at) && (
{event.event_date && ( {format(parseISO(event.event_date), 'PP')} )} {event.expires_at && ( {t('gallery.expires')} {format(parseISO(event.expires_at), 'PP')} )}
)}
{/* Right side - Action buttons */}
{/* Extra header items (upload button, etc.) */} {headerExtra && (
{headerExtra}
)} {/* Download all button - hidden on mobile when sidebar is shown */} {showDownloadAll && onDownloadAll && ( )} {/* Logout button */} {showLogout && onLogout && ( )}
{/* Mobile dates row */} {(event.event_date || event.expires_at) && (
{event.event_date && ( {format(parseISO(event.event_date), 'PP')} )} {event.expires_at && ( {t('gallery.expires')} {format(parseISO(event.expires_at), 'PP')} )}
)}
)} {/* For hero layout - minimal header with just menu and logout */} {theme.galleryLayout === 'hero' && (
{/* Left side - Menu button */}
{menuButton} {headerExtra}
{/* Right side - Action buttons */}
{/* Download all button */} {showDownloadAll && onDownloadAll && ( )} {/* Logout button */} {showLogout && onLogout && ( )}
)}
{/* Hero Header for non-grid layouts (excluding hero layout which has its own) */} {isNonGridLayout && (
{/* Logo - Show custom logo or fallback to PicPeak logo */}
{brandingSettings?.company_name
{/* Event Name */}

{event.event_name}

{/* Event Details */} {(event.event_date || event.expires_at) && (
{event.event_date && ( {format(parseISO(event.event_date), 'PP')} )} {event.expires_at && ( {t('gallery.expires')} {format(parseISO(event.expires_at), 'PP')} )}
)}
{/* Decorative bottom wave */}
)} {/* Main Content */}
{children}
{/* Footer */}
); }; GalleryLayout.displayName = 'GalleryLayout';