From 3148ce61828f8e4d0c98b8c678eb7c251895e0d3 Mon Sep 17 00:00:00 2001 From: Ravi Gulhane <> Date: Fri, 10 Jul 2026 09:56:03 +0530 Subject: [PATCH] 10 july --- src/components/forms/FormShell.tsx | 12 ++- .../forms/PublicFormEventHeader.tsx | 86 ++++++++++++------- src/styles/forms.css | 12 +++ src/types/index.ts | 11 +++ src/utils/formEventHeaderDisplay.ts | 23 +++++ 5 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 src/utils/formEventHeaderDisplay.ts diff --git a/src/components/forms/FormShell.tsx b/src/components/forms/FormShell.tsx index ae6e51d..deca403 100644 --- a/src/components/forms/FormShell.tsx +++ b/src/components/forms/FormShell.tsx @@ -108,11 +108,17 @@ export function FormShell({ eventId, formId, titleOverride }: Props) { return (
- {ev ? : null} + {ev ? ( + + ) : null}

{titleOverride || form.name}

-

{msg}

+

{msg}

); @@ -124,7 +130,7 @@ export function FormShell({ eventId, formId, titleOverride }: Props) { return (
- {ev ? : null} + {ev ? : null}

{pageTitle}

diff --git a/src/components/forms/PublicFormEventHeader.tsx b/src/components/forms/PublicFormEventHeader.tsx index 54a1f7a..088b995 100644 --- a/src/components/forms/PublicFormEventHeader.tsx +++ b/src/components/forms/PublicFormEventHeader.tsx @@ -1,4 +1,9 @@ +import type { ReactNode } from 'react'; import type { PublicFormEventSummary } from '../../types'; +import { + resolveFormEventHeaderDisplay, + type FormEventHeaderDisplay, +} from '../../utils/formEventHeaderDisplay'; const EVENT_TYPE_LABEL: Record = { conference: 'Conference', @@ -46,51 +51,74 @@ function locationKindClass(locationType?: string): string { export function PublicFormEventHeader({ event, variant = 'default', + display, }: { event: PublicFormEventSummary; variant?: 'default' | 'embedded'; + display?: FormEventHeaderDisplay | null; }) { + const d = resolveFormEventHeaderDisplay(display); const typeLabel = formatEventType(event.eventType); const dateLine = formatEventDateRange(event); const kind = formatLocationKind(event.locationType); - const showLoc = shouldShowLocation(event); + const showLoc = d.showVenue && shouldShowLocation(event); const embedded = variant === 'embedded'; + const showBanner = d.showLogo && !!event.imageUrl && !event.logoUrl; + const showLogo = d.showLogo && !!event.logoUrl; + const showTitle = d.showTitle && !!event.name; + const showSubtitle = d.showTitle && !!event.subtitle?.trim(); + + const metaItems: ReactNode[] = []; + if (d.showDateRange && dateLine) { + metaItems.push({dateLine}); + } + if (d.showEventType && typeLabel) { + metaItems.push({typeLabel}); + } + if (d.showLocationType && kind) { + metaItems.push( + {kind}, + ); + } + if (showLoc) { + metaItems.push({event.location!.trim()}); + } + + if (!showBanner && !showLogo && !showTitle && !showSubtitle && metaItems.length === 0) { + return null; + } + return (
- {event.imageUrl && !event.logoUrl ? ( + {showBanner ? (
- +
) : null} - {event.logoUrl ? {event.name} : null} -
-

{event.name}

- {event.subtitle ?

{event.subtitle}

: null} -
- {dateLine} - {typeLabel ? ( - <> - - {typeLabel} - - ) : null} - - {kind} - {showLoc ? ( - <> - - {event.location!.trim()} - + {showLogo ? ( + {event.name} + ) : null} + {showTitle || showSubtitle || metaItems.length > 0 ? ( +
+ {showTitle ?

{event.name}

: null} + {showSubtitle ?

{event.subtitle}

: null} + {metaItems.length > 0 ? ( +
+ {metaItems.map((item, index) => ( + + {index > 0 ? ( + + ) : null} + {item} + + ))} +
) : null}
-
+ ) : null}
); } diff --git a/src/styles/forms.css b/src/styles/forms.css index 7a085d9..6588f3e 100644 --- a/src/styles/forms.css +++ b/src/styles/forms.css @@ -464,6 +464,18 @@ cursor: pointer; } +.form-success-message { + margin: 0; + padding: 12px 16px; + border-radius: 0.375rem; + background-color: #d1e7dd; + color: #198754; + font-weight: 700; + font-size: 0.95rem; + line-height: 1.5; + border: 1px solid #badbcc; +} + .form-captcha-reload:disabled { opacity: 0.6; cursor: not-allowed; diff --git a/src/types/index.ts b/src/types/index.ts index c1c2e13..e914089 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -18,9 +18,11 @@ export interface FormField { export interface PublicFormEventSummary { name: string; subtitle?: string; + description?: string; eventType?: string; startDate?: string | null; endDate?: string | null; + date?: string; location?: string; locationType?: string; logoUrl?: string | null; @@ -39,6 +41,14 @@ export interface PublicFormDefinition { showThankYou?: boolean; collectEmail?: boolean; allowAnonymous?: boolean; + eventHeader?: { + showLogo?: boolean; + showTitle?: boolean; + showDateRange?: boolean; + showEventType?: boolean; + showLocationType?: boolean; + showVenue?: boolean; + }; }; } @@ -58,6 +68,7 @@ export interface MicrositeSpeaker { export interface AgendaItem { title?: string; + date?: string; time?: string; track?: string; description?: string; diff --git a/src/utils/formEventHeaderDisplay.ts b/src/utils/formEventHeaderDisplay.ts new file mode 100644 index 0000000..848fa93 --- /dev/null +++ b/src/utils/formEventHeaderDisplay.ts @@ -0,0 +1,23 @@ +export interface FormEventHeaderDisplay { + showLogo?: boolean; + showTitle?: boolean; + showDateRange?: boolean; + showEventType?: boolean; + showLocationType?: boolean; + showVenue?: boolean; +} + +export type ResolvedFormEventHeaderDisplay = Required; + +export function resolveFormEventHeaderDisplay( + display?: FormEventHeaderDisplay | null, +): ResolvedFormEventHeaderDisplay { + return { + showLogo: display?.showLogo !== false, + showTitle: display?.showTitle !== false, + showDateRange: display?.showDateRange !== false, + showEventType: display?.showEventType !== false, + showLocationType: display?.showLocationType !== false, + showVenue: display?.showVenue !== false, + }; +}