diff --git a/hifi-src/src/App.jsx b/hifi-src/src/App.jsx index df81db0..f580a70 100644 --- a/hifi-src/src/App.jsx +++ b/hifi-src/src/App.jsx @@ -39,6 +39,7 @@ import AdminUsers from './pages/admin/AdminUsers.jsx'; import PermissionGroups from './pages/admin/PermissionGroups.jsx'; import SettingsLayout from './pages/admin/settings/SettingsLayout.jsx'; import WebsiteSettings from './pages/admin/settings/WebsiteSettings.jsx'; +import LegalSettings from './pages/admin/settings/LegalSettings.jsx'; import EmailSettings from './pages/admin/settings/EmailSettings.jsx'; import DatabaseSettings from './pages/admin/settings/DatabaseSettings.jsx'; import ExportImportSettings from './pages/admin/settings/ExportImportSettings.jsx'; @@ -94,6 +95,7 @@ export default function App() { > } /> } /> + } /> } /> } /> } /> diff --git a/hifi-src/src/components/Footer.jsx b/hifi-src/src/components/Footer.jsx index 88f6eca..d9abe74 100644 --- a/hifi-src/src/components/Footer.jsx +++ b/hifi-src/src/components/Footer.jsx @@ -3,37 +3,33 @@ import DynamicIcon from './DynamicIcon.jsx'; import { useCookieConsent } from '../context/CookieConsentContext.jsx'; import { useSiteSettings } from '../context/SiteSettingsContext.jsx'; import { useLanguage } from '../context/LanguageContext.jsx'; +import { isOpenNow, formatBusinessHours } from '../utils/businessHours.js'; const digitsOnly = (value) => (value || '').replace(/[^\d+]/g, ''); -const SHOP_ADDRESS_ENCODED = encodeURIComponent('Boxbrunner Str. 20a, 63916 Amorbach'); -const DIRECTIONS_URL = `https://www.google.com/maps/dir/?api=1&destination=${SHOP_ADDRESS_ENCODED}`; - -function isOpenNow() { - const now = new Date(); - const minutes = now.getHours() * 60 + now.getMinutes(); - const day = now.getDay(); // 0 = Sonntag, 1-5 = Mo-Fr, 6 = Sa - if (day === 0) return false; - if (day === 6) return minutes >= 10 * 60 && minutes < 13 * 60; - return minutes >= 9 * 60 && minutes < 18 * 60; -} - export default function Footer() { - const open = isOpenNow(); + const { + phone, + contact_email: contactEmail, + address_street: addressStreet, + address_zip: addressZip, + address_city: addressCity, + business_hours: businessHours, + } = useSiteSettings(); + const open = isOpenNow(businessHours); const { openSettings } = useCookieConsent(); // Auf der Startseite blendet sich unten eine fixierte CTA-Leiste ein, die // sonst die letzte Footer-Zeile (Impressum-Links) verdeckt - deshalb dort // zusätzlichen Platz für sie freihalten. const { pathname } = useLocation(); const isHome = pathname === '/'; - const { phone, contact_email: contactEmail } = useSiteSettings(); const { t } = useLanguage(); - const HOURS = [ - { key: 'monFri', days: t('footer.days.monFri'), label: t('contactPage.hoursWeek') }, - { key: 'sat', days: t('footer.days.sat'), label: t('contactPage.hoursSat') }, - { key: 'sun', days: t('footer.days.sun'), label: t('footer.closed') }, - ]; + const shopAddress = [addressStreet, [addressZip, addressCity].filter(Boolean).join(' ')] + .filter(Boolean) + .join(', '); + const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(shopAddress)}`; + const HOURS = formatBusinessHours(businessHours, t('footer.closed')); return (