diff --git a/src/components/SupportUsButton.tsx b/src/components/SupportUsButton.tsx index c9b7278..fe4b907 100644 --- a/src/components/SupportUsButton.tsx +++ b/src/components/SupportUsButton.tsx @@ -49,7 +49,9 @@ function getButtonClasses(buttonVariant: ButtonVariant): string { } // Main component function that renders the support us button, taking in various props for customization and rendering different sections such as hero, organization information, sponsors, and call-to-action based on the provided data and selected theme and button variant -function SupportUsButton({ +function SupportUsButton( + + { Theme = "AOSSIE", pattern = "AOSSIE", hero = { @@ -70,11 +72,29 @@ function SupportUsButton({ }, buttonVariant = "AOSSIE", }: supportUsButtonProps): React.JSX.Element { + // Ensure required props are provided to prevent runtime crashes + + if (!organizationInformation) { + console.warn( + "SupportUsButton: 'organizationInformation' is required." + ); + } + + if (!ctaSection) { + console.warn( + "SupportUsButton: 'ctaSection' is required." + ); + } + + // Defensive fallback to handle unexpected missing props at runtime + const org = organizationInformation ?? null; + const cta = ctaSection ?? null; return ( // Container for the support us button, with dynamic classes based on the selected theme and custom class names
- {organizationInformation.description} + {org.description}
- "{organizationInformation.projectInformation.description}" + "{org.projectInformation.description}"