From ff168834b41ea37c11e50050fdabdbfa9e884e9e Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Tue, 25 Nov 2025 20:15:17 +0100 Subject: [PATCH] fixed errors in branding and invite page, added an error route for better react error display --- .gitignore | 1 + .../js/admin/pages/EventBrandingPage.tsx | 17 ++++--- .../InviteLayoutCustomizerPanel.tsx | 34 +++++++------ resources/js/admin/router.tsx | 3 ++ resources/js/components/RouteErrorElement.tsx | 50 +++++++++++++++++++ resources/js/guest/router.tsx | 21 ++++---- 6 files changed, 94 insertions(+), 32 deletions(-) create mode 100644 resources/js/components/RouteErrorElement.tsx diff --git a/.gitignore b/.gitignore index 14a6e94..c657b21 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ fotospiel-tenant-app /public/build /public/hot /public/storage +/public/fonts/google /resources/js/actions /resources/js/routes /resources/js/wayfinder diff --git a/resources/js/admin/pages/EventBrandingPage.tsx b/resources/js/admin/pages/EventBrandingPage.tsx index afae40b..163d5d8 100644 --- a/resources/js/admin/pages/EventBrandingPage.tsx +++ b/resources/js/admin/pages/EventBrandingPage.tsx @@ -21,6 +21,9 @@ import { getContrastingTextColor } from '../../guest/lib/color'; import { buildEventTabs } from '../lib/eventTabs'; import { ensureFontLoaded, useTenantFonts } from '../lib/fonts'; +const DEFAULT_FONT_VALUE = '__default'; +const CUSTOM_FONT_VALUE = '__custom'; + type BrandingForm = { useDefault: boolean; palette: { @@ -318,12 +321,12 @@ export default function EventBrandingPage(): React.ReactElement { } const resolveFontSelectValue = (current: string): string => { - if (!current) return ''; - return availableFonts.some((font) => font.family === current) ? current : '__custom'; + if (!current) return DEFAULT_FONT_VALUE; + return availableFonts.some((font) => font.family === current) ? current : CUSTOM_FONT_VALUE; }; const handleFontSelect = (key: 'heading' | 'body', value: string) => { - const resolved = value === '__custom' ? '' : value; + const resolved = value === CUSTOM_FONT_VALUE || value === DEFAULT_FONT_VALUE ? '' : value; setForm((prev) => ({ ...prev, typography: { ...prev.typography, [key]: resolved } })); const font = availableFonts.find((entry) => entry.family === resolved); if (font) { @@ -446,11 +449,11 @@ export default function EventBrandingPage(): React.ReactElement { - {t('branding.fontDefault', 'Standard (Tenant)')} + {t('branding.fontDefault', 'Standard (Tenant)')} {availableFonts.map((font) => ( {font.family} ))} - {t('branding.fontCustom', 'Eigene Schrift eingeben')} + {t('branding.fontCustom', 'Eigene Schrift eingeben')} - {t('branding.fontDefault', 'Standard (Tenant)')} + {t('branding.fontDefault', 'Standard (Tenant)')} {availableFonts.map((font) => ( {font.family} ))} - {t('branding.fontCustom', 'Eigene Schrift eingeben')} + {t('branding.fontCustom', 'Eigene Schrift eingeben')} (null); const appliedInviteRef = React.useRef(null); - const handleElementFontChange = React.useCallback( - (id: string, family: string) => { - updateElement(id, { fontFamily: family || null }); - const font = availableFonts.find((entry) => entry.family === family); - if (font) { - void ensureFontLoaded(font).then(() => { - fabricCanvasRef.current?.requestRenderAll(); - }); - } - }, - [availableFonts, updateElement] - ); - React.useEffect(() => { if (!availableFonts.length || !elements.length) { return; @@ -609,6 +598,19 @@ export function InviteLayoutCustomizerPanel({ [commitElements] ); + const handleElementFontChange = React.useCallback( + (id: string, family: string) => { + updateElement(id, { fontFamily: family || null }); + const font = availableFonts.find((entry) => entry.family === family); + if (font) { + void ensureFontLoaded(font).then(() => { + fabricCanvasRef.current?.requestRenderAll(); + }); + } + }, + [availableFonts, updateElement] + ); + React.useEffect(() => { if (!invite) { setAvailableLayouts([]); @@ -1340,15 +1342,15 @@ export function InviteLayoutCustomizerPanel({