From 5ca138928aa82e898bb71232c494338d4be334c8 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Fri, 14 Mar 2025 11:46:06 +0100 Subject: [PATCH] Refactor event details to use reusable InfoCard component Replaced repetitive JSX for event details (date/time, location) with the reusable `InfoCard` component. This reduces code duplication, improves readability, and centralizes styling logic. Added support for image positioning and optional button props in `InfoCard`. --- Makefile | 1 + .../src/app/(public)/invite/[slug]/page.tsx | 143 ++++-------------- 2 files changed, 33 insertions(+), 111 deletions(-) diff --git a/Makefile b/Makefile index 5f36564..6c9901a 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ REGISTRY := gitea.pragmazest.com/cardosofelipe/eventspace dev: docker compose -f docker-compose.dev.yml up --build -d + docker compose logs -f prod: docker compose up --build -d diff --git a/frontend/src/app/(public)/invite/[slug]/page.tsx b/frontend/src/app/(public)/invite/[slug]/page.tsx index 1346078..86251cf 100644 --- a/frontend/src/app/(public)/invite/[slug]/page.tsx +++ b/frontend/src/app/(public)/invite/[slug]/page.tsx @@ -12,6 +12,7 @@ import { Loader2 } from "lucide-react"; import { useParams } from "next/navigation"; import { EventResponse } from "@/client"; import { getServerFileUrl } from "@/lib/utils"; +import InfoCard from "@/components/info-card"; interface InvitationParams { slug: string; @@ -122,7 +123,6 @@ const InvitationPage = () => { Safari Adventure - {/* Safari Animals Banner */}
{eventTheme?.foreground_image_url ? ( @@ -147,115 +147,40 @@ const InvitationPage = () => {
)} - {/* Date/Time with Elephant */} -
-
-
- {getAssetUrl("elephant") ? ( -
- Elephant -
- ) : ( -

Elephant

- )} -
-
- -

- {eventDate} -

- {timeRange && ( -

- {timeRange} -

- )} -
-
+ {/* Location with Giraffe */} -
- -

- {event.location_name} -

-

- {event.location_address} -

- {event.location_url && ( -
- - - -
- )} -
-
-
- {getAssetUrl("giraffe") ? ( -
- Giraffe -
- ) : ( -

Giraffe

- )} -
-
-
+ {/* Description */} { )} - {/* RSVP Section */} {event.rsvp_enabled && (
{
)} - {/* Gift Registry with Lion */} {event.gift_registry_enabled && (
@@ -385,7 +308,6 @@ const InvitationPage = () => {
)} - {/* View Map Button */} {event.location_url && (
@@ -406,7 +328,6 @@ const InvitationPage = () => {
)} - {/* Footer with Contact Info */}