Skip to content

Commit 8ad2874

Browse files
committed
fix: prevent crash and handle missing organizationInformation
1 parent 62828cd commit 8ad2874

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/SupportUsButton.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ function SupportUsButton({
7070
},
7171
buttonVariant = "AOSSIE",
7272
}: supportUsButtonProps): React.JSX.Element {
73+
74+
7375
return (
7476
// Container for the support us button, with dynamic classes based on the selected theme and custom class names
7577
<div
7678
className={`w-full font-sans justify-center items-center text-center ${Theme == "light" || Theme == "dark" ? classAccordingToTheme(Theme) : "bg-black text-white"} ${classNames.container}`}
7779
>
80+
7881
{/* Hero section with optional background image*/}
7982
<div className="relative w-full h-[50vh] flex justify-center">
8083
{hero.Image && (
@@ -128,7 +131,9 @@ function SupportUsButton({
128131
</div>
129132

130133
{/* Organization information section */}
131-
<div className="w-full flex justify-center p-10 mb-50">
134+
{/* Avoid rendering empty organization section when data is not provided */}
135+
{organizationInformation ? (
136+
<div className="w-full flex justify-center p-10 mb-50">
132137
<div
133138
className={`${classNames.organizationInformation}
134139
relative w-[90%] p-15 rounded-2xl overflow-visible
@@ -235,6 +240,11 @@ function SupportUsButton({
235240
</div>
236241
</div>
237242
</div>
243+
) : (
244+
<p className="text-center text-gray-500 mt-10">
245+
Organization details are not available.
246+
</p>
247+
)}
238248

239249
{/* Sponsors section */}
240250
<div

0 commit comments

Comments
 (0)