fixed errors in branding and invite page, added an error route for better react error display
This commit is contained in:
@@ -33,6 +33,8 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/component
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ensureFontLoaded, useTenantFonts } from '../../lib/fonts';
|
||||
|
||||
const DEFAULT_FONT_VALUE = '__default';
|
||||
|
||||
import type { EventQrInvite, EventQrInviteLayout } from '../../api';
|
||||
import { authorizedFetch } from '../../auth/tokens';
|
||||
|
||||
@@ -271,19 +273,6 @@ export function InviteLayoutCustomizerPanel({
|
||||
const appliedLayoutRef = React.useRef<string | null>(null);
|
||||
const appliedInviteRef = React.useRef<number | string | null>(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({
|
||||
<div className="space-y-2">
|
||||
<Label>{t('invites.customizer.elements.fontFamily', 'Schriftart')}</Label>
|
||||
<Select
|
||||
value={availableFonts.some((font) => font.family === element.fontFamily) ? element.fontFamily ?? '' : ''}
|
||||
onValueChange={(value) => handleElementFontChange(element.id, value)}
|
||||
value={availableFonts.some((font) => font.family === element.fontFamily) ? element.fontFamily ?? DEFAULT_FONT_VALUE : DEFAULT_FONT_VALUE}
|
||||
onValueChange={(value) => handleElementFontChange(element.id, value === DEFAULT_FONT_VALUE ? '' : value)}
|
||||
disabled={fontsLoading}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder={t('invites.customizer.elements.fontPlaceholder', 'Standard')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="">{t('invites.customizer.elements.fontPlaceholder', 'Standard')}</SelectItem>
|
||||
<SelectItem value={DEFAULT_FONT_VALUE}>{t('invites.customizer.elements.fontPlaceholder', 'Standard')}</SelectItem>
|
||||
{availableFonts.map((font) => (
|
||||
<SelectItem key={font.family} value={font.family}>{font.family}</SelectItem>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user