fixed errors in branding and invite page, added an error route for better react error display
This commit is contained in:
@@ -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 {
|
||||
<SelectValue placeholder={t('branding.fontDefault', 'Standard (Tenant)')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="">{t('branding.fontDefault', 'Standard (Tenant)')}</SelectItem>
|
||||
<SelectItem value={DEFAULT_FONT_VALUE}>{t('branding.fontDefault', 'Standard (Tenant)')}</SelectItem>
|
||||
{availableFonts.map((font) => (
|
||||
<SelectItem key={font.family} value={font.family}>{font.family}</SelectItem>
|
||||
))}
|
||||
<SelectItem value="__custom">{t('branding.fontCustom', 'Eigene Schrift eingeben')}</SelectItem>
|
||||
<SelectItem value={CUSTOM_FONT_VALUE}>{t('branding.fontCustom', 'Eigene Schrift eingeben')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input
|
||||
@@ -471,11 +474,11 @@ export default function EventBrandingPage(): React.ReactElement {
|
||||
<SelectValue placeholder={t('branding.fontDefault', 'Standard (Tenant)')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="">{t('branding.fontDefault', 'Standard (Tenant)')}</SelectItem>
|
||||
<SelectItem value={DEFAULT_FONT_VALUE}>{t('branding.fontDefault', 'Standard (Tenant)')}</SelectItem>
|
||||
{availableFonts.map((font) => (
|
||||
<SelectItem key={font.family} value={font.family}>{font.family}</SelectItem>
|
||||
))}
|
||||
<SelectItem value="__custom">{t('branding.fontCustom', 'Eigene Schrift eingeben')}</SelectItem>
|
||||
<SelectItem value={CUSTOM_FONT_VALUE}>{t('branding.fontCustom', 'Eigene Schrift eingeben')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input
|
||||
|
||||
Reference in New Issue
Block a user