fix: resolve typescript and build errors across admin and guest apps
This commit is contained in:
@@ -69,7 +69,7 @@ export default function MobileQrLayoutCustomizePage() {
|
||||
const layoutParam = searchParams.get('layout');
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation('management');
|
||||
const { textStrong, danger } = useAdminTheme();
|
||||
const { textStrong, danger, muted, border, primary, surface, surfaceMuted, overlay, shadow } = useAdminTheme();
|
||||
|
||||
const [event, setEvent] = React.useState<TenantEvent | null>(null);
|
||||
const [invite, setInvite] = React.useState<EventQrInvite | null>(null);
|
||||
@@ -420,9 +420,9 @@ function renderEventName(name: TenantEvent['name'] | null | undefined): string |
|
||||
|
||||
function getDefaultSlots(): Record<string, SlotDefinition> {
|
||||
return {
|
||||
headline: { x: 0.08, y: 0.12, w: 0.84, fontSize: 90, fontWeight: 800, fontFamily: DEFAULT_DISPLAY_FONT, align: 'center' },
|
||||
subtitle: { x: 0.1, y: 0.21, w: 0.8, fontSize: 37, fontWeight: 600, fontFamily: DEFAULT_BODY_FONT, align: 'center' },
|
||||
description: { x: 0.1, y: 0.66, w: 0.8, fontSize: 26, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.4, align: 'center' },
|
||||
headline: { x: 0.08, y: 0.12, w: 0.84, fontSize: 90, fontWeight: 800, fontFamily: DEFAULT_DISPLAY_FONT, align: 'center' as const },
|
||||
subtitle: { x: 0.1, y: 0.21, w: 0.8, fontSize: 37, fontWeight: 600, fontFamily: DEFAULT_BODY_FONT, align: 'center' as const },
|
||||
description: { x: 0.1, y: 0.66, w: 0.8, fontSize: 26, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.4, align: 'center' as const },
|
||||
instructions: { x: 0.1, y: 0.7, w: 0.8, fontSize: 24, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.5 },
|
||||
qr: { x: 0.39, y: 0.37, w: 0.27 },
|
||||
};
|
||||
@@ -453,9 +453,9 @@ function resolveSlots(layout: EventQrInviteLayout | null, isFoldable: boolean, o
|
||||
|
||||
const baseSlots = isFoldable
|
||||
? {
|
||||
headline: { x: 0.08, y: 0.15, w: 0.84, fontSize: 50, fontWeight: 800, fontFamily: DEFAULT_DISPLAY_FONT, align: 'center' },
|
||||
subtitle: { x: 0.1, y: 0.21, w: 0.8, fontSize: 37, fontWeight: 600, fontFamily: DEFAULT_BODY_FONT, align: 'center' },
|
||||
description: { x: 0.1, y: 0.66, w: 0.8, fontSize: 13, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.4, align: 'center' },
|
||||
headline: { x: 0.08, y: 0.15, w: 0.84, fontSize: 50, fontWeight: 800, fontFamily: DEFAULT_DISPLAY_FONT, align: 'center' as const },
|
||||
subtitle: { x: 0.1, y: 0.21, w: 0.8, fontSize: 37, fontWeight: 600, fontFamily: DEFAULT_BODY_FONT, align: 'center' as const },
|
||||
description: { x: 0.1, y: 0.66, w: 0.8, fontSize: 13, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.4, align: 'center' as const },
|
||||
instructions: { x: 0.12, y: 0.36, w: 0.76, fontSize: 13, fontFamily: DEFAULT_BODY_FONT, lineHeight: 1.3 },
|
||||
qr: { x: 0.3, y: 0.3, w: 0.28 },
|
||||
}
|
||||
@@ -520,8 +520,8 @@ function buildFabricOptions({
|
||||
const elements: LayoutElement[] = [];
|
||||
const textColor = layout?.preview?.text ?? ADMIN_COLORS.backdrop;
|
||||
const accentColor = layout?.preview?.accent ?? ADMIN_COLORS.primary;
|
||||
const secondaryColor = layout?.preview?.secondary ?? ADMIN_COLORS.text;
|
||||
const badgeColor = layout?.preview?.badge ?? accentColor;
|
||||
const secondaryColor = (layout?.preview as any)?.secondary ?? ADMIN_COLORS.text;
|
||||
const badgeColor = (layout?.preview as any)?.badge ?? accentColor;
|
||||
|
||||
const rotatePoint = (cx: number, cy: number, x: number, y: number, angleDeg: number) => {
|
||||
const rad = (angleDeg * Math.PI) / 180;
|
||||
@@ -862,15 +862,18 @@ function TextStep({
|
||||
textFields,
|
||||
onChange,
|
||||
onSave,
|
||||
onBulkAdd,
|
||||
saving,
|
||||
}: {
|
||||
onBack: () => void;
|
||||
textFields: { headline: string; subtitle: string; description: string; instructions: string[] };
|
||||
onChange: (fields: { headline: string; subtitle: string; description: string; instructions: string[] }) => void;
|
||||
onSave: () => void;
|
||||
onBulkAdd?: () => void;
|
||||
saving: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation('management');
|
||||
const { textStrong, border, surface, muted } = useAdminTheme();
|
||||
|
||||
const updateField = (key: 'headline' | 'subtitle' | 'description', value: string) => {
|
||||
onChange({ ...textFields, [key]: value });
|
||||
@@ -941,7 +944,7 @@ function TextStep({
|
||||
onChangeText={(val) => updateInstruction(idx, val)}
|
||||
placeholder={t('events.qr.instructionsPlaceholder', 'Schritt hinzufügen')}
|
||||
numberOfLines={2}
|
||||
flex={1}
|
||||
{...({ flex: 1 } as any)}
|
||||
size="$4"
|
||||
/>
|
||||
<Pressable onPress={() => removeInstruction(idx)} disabled={textFields.instructions.length === 1}>
|
||||
@@ -1096,7 +1099,8 @@ function PreviewStep({
|
||||
|
||||
const aspectRatio = `${canvasBase.width}/${canvasBase.height}`;
|
||||
const paper = resolvePaper(layout);
|
||||
const isLandscape = ((layout?.orientation ?? (isFoldable ? 'landscape' : 'portrait')) || '').toLowerCase() === 'landscape';
|
||||
const orientation = ((layout?.orientation ?? (isFoldable ? 'landscape' : 'portrait')) || '').toString().toLowerCase();
|
||||
const isLandscape = orientation === 'landscape';
|
||||
const orientationLabel = isLandscape
|
||||
? t('events.qr.orientation.landscape', 'Landscape')
|
||||
: t('events.qr.orientation.portrait', 'Portrait');
|
||||
@@ -1157,14 +1161,14 @@ function PreviewStep({
|
||||
try {
|
||||
await loadFonts();
|
||||
const pdfBytes = await generatePdfBytes(exportOptions, paper, orientation);
|
||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||
const blob = new Blob([pdfBytes as any], { type: 'application/pdf' });
|
||||
triggerDownloadFromBlob(blob, 'qr-layout.pdf');
|
||||
} catch (err) {
|
||||
toast.error(t('events.qr.exportFailed', 'Export fehlgeschlagen'));
|
||||
console.error(err);
|
||||
}
|
||||
}}
|
||||
style={{ flex: 1, minWidth: 0 }}
|
||||
style={{ flex: 1, minWidth: 0 } as any}
|
||||
/>
|
||||
<CTAButton
|
||||
label={t('events.qr.exportPng', 'Export PNG')}
|
||||
@@ -1178,7 +1182,7 @@ function PreviewStep({
|
||||
console.error(err);
|
||||
}
|
||||
}}
|
||||
style={{ flex: 1, minWidth: 0 }}
|
||||
style={{ flex: 1, minWidth: 0 } as any}
|
||||
/>
|
||||
</XStack>
|
||||
</YStack>
|
||||
@@ -1315,7 +1319,7 @@ function LayoutControls({
|
||||
|
||||
return (
|
||||
<Accordion.Item value={slotKey} key={slotKey}>
|
||||
<Accordion.Trigger padding="$2" borderWidth={1} borderColor={border} borderRadius={12} backgroundColor={surfaceMuted}>
|
||||
<Accordion.Trigger {...({ padding: "$2", borderWidth: 1, borderColor: border, borderRadius: 12, backgroundColor: surfaceMuted } as any)}>
|
||||
<XStack justifyContent="space-between" alignItems="center" flex={1}>
|
||||
<Text fontSize="$sm" fontWeight="700" color={textStrong}>
|
||||
{label}
|
||||
@@ -1323,7 +1327,7 @@ function LayoutControls({
|
||||
<ChevronDown size={16} color={muted} />
|
||||
</XStack>
|
||||
</Accordion.Trigger>
|
||||
<Accordion.Content paddingTop="$2">
|
||||
<Accordion.Content {...({ paddingTop: "$2" } as any)}>
|
||||
<YStack space="$2" padding="$2" borderWidth={1} borderColor={border} borderRadius={12}>
|
||||
<XStack space="$3">
|
||||
<YStack flex={1} space="$1">
|
||||
@@ -1546,7 +1550,7 @@ function LayoutControls({
|
||||
|
||||
{qrSlot ? (
|
||||
<Accordion.Item value="qr">
|
||||
<Accordion.Trigger padding="$2" borderWidth={1} borderColor={border} borderRadius={12} backgroundColor={surfaceMuted}>
|
||||
<Accordion.Trigger {...({ padding: "$2", borderWidth: 1, borderColor: border, borderRadius: 12, backgroundColor: surfaceMuted } as any)}>
|
||||
<XStack justifyContent="space-between" alignItems="center" flex={1}>
|
||||
<Text fontSize="$sm" fontWeight="700" color={textStrong}>
|
||||
{t('events.qr.qr_code_label', 'QR‑Code')}
|
||||
@@ -1554,7 +1558,7 @@ function LayoutControls({
|
||||
<ChevronDown size={16} color={muted} />
|
||||
</XStack>
|
||||
</Accordion.Trigger>
|
||||
<Accordion.Content paddingTop="$2">
|
||||
<Accordion.Content {...({ paddingTop: "$2" } as any)}>
|
||||
<YStack space="$2" padding="$2" borderWidth={1} borderColor={border} borderRadius={12}>
|
||||
<XStack space="$2">
|
||||
<YStack flex={1} space="$1">
|
||||
|
||||
Reference in New Issue
Block a user