diff --git a/frontend/src/app/(public)/invite/[slug]/page.tsx b/frontend/src/app/(public)/invite/[slug]/page.tsx index 1976797..d051a9e 100644 --- a/frontend/src/app/(public)/invite/[slug]/page.tsx +++ b/frontend/src/app/(public)/invite/[slug]/page.tsx @@ -4,19 +4,15 @@ import React, { useEffect, useState } from "react"; import { useEvents } from "@/context/event-context"; import { useEventThemes } from "@/context/event-theme-context"; import { format, parseISO } from "date-fns"; -import Image from "next/image"; -import Link from "next/link"; -import { Button } from "@/components/ui/button"; -import { Card } from "@/components/ui/card"; import { Loader2 } from "lucide-react"; +import { motion } from "framer-motion"; +import { Button } from "@/components/ui/button"; +// import { RSVP } from "@/components/rsvp"; import { useParams } from "next/navigation"; -import { EventResponse } from "@/client"; import { getServerFileUrl } from "@/lib/utils"; -import InfoCard from "@/components/info-card"; -interface InvitationParams { - slug: string; -} +// Helper function to get server file URL (assuming it exists in your codebase) +// If not, replace with your actual implementation const InvitationPage = () => { const { slug } = useParams<{ slug: string }>(); @@ -28,7 +24,7 @@ const InvitationPage = () => { // Fetch event data when slug is available useEffect(() => { - fetchEventBySlug(slug); + fetchEventBySlug(slug || ""); }, [slug, fetchEventBySlug]); // If loading, show a spinner @@ -55,7 +51,7 @@ const InvitationPage = () => { // Find the theme for this event const eventTheme = themes?.find((theme) => theme.id === event.theme_id); - // Default colors if theme is not available + // Enhanced color palette that works well with safari animals const colors = eventTheme?.color_palette || { primary: "#90B77D", // Soft jungle green secondary: "#D2AB67", // Warm giraffe yellow @@ -63,21 +59,45 @@ const InvitationPage = () => { accent2: "#8FBDD3", // Elephant blue accent3: "#E8B87D", // Lion tan background: "#F9F5F0", // Cream paper texture + backgroundDark: "#F0E9D6", // Slightly darker cream for panels text: "#5B4B49", // Warm dark brown textLight: "#7D6D6B", // Lighter text variant + gold: "#D4AF37", // Gold accent for special elements + }; + + // Font selections + const fonts = eventTheme?.fonts || { + heading: "Georgia, serif", + body: "Arial, sans-serif", }; // Format date and time for display const eventDate = event.event_date ? format(parseISO(event.event_date), "EEEE, MMMM d, yyyy") : null; + + const displayDay = event.event_date + ? format(parseISO(event.event_date), "EEEE") + : null; + + const displayDate = event.event_date + ? format(parseISO(event.event_date), "d") + : null; + + const displayMonth = event.event_date + ? format(parseISO(event.event_date), "MMMM") + : null; + const startTime = event.event_start_time ? format(parseISO(`2000-01-01T${event.event_start_time}`), "HH:mm") : null; + const endTime = event.event_end_time ? format(parseISO(`2000-01-01T${event.event_end_time}`), "HH:mm") : null; - const timeRange = startTime && endTime ? `${startTime} - ${endTime}` : null; + + const timeRange = + startTime && endTime ? `${startTime} - ${endTime}` : startTime; // Format RSVP deadline const rsvpDeadline = event.rsvp_deadline @@ -92,244 +112,352 @@ const InvitationPage = () => { return null; }; - // Background style - const pageStyle = { - backgroundColor: colors.background, - color: colors.text, - fontFamily: eventTheme?.fonts?.body || "sans-serif", + // Animation variants + const archVariants = { + hidden: { opacity: 0, y: -50 }, + visible: { + opacity: 1, + y: 0, + transition: { + duration: 0.8, + ease: "easeOut", + }, + }, }; - const headingStyle = { - fontFamily: eventTheme?.fonts?.heading || "sans-serif", - color: colors.text, + const contentVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.1, + delayChildren: 0.4, + duration: 0.5, + }, + }, }; + const itemVariants = { + hidden: { opacity: 0, y: 20 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.5 }, + }, + }; + + const animalVariants = { + hidden: { opacity: 0, y: 50 }, + visible: { + opacity: 1, + y: 0, + transition: { + delay: 1.2, + duration: 0.8, + ease: "easeOut", + }, + }, + }; + const foregroundImageUrl = getServerFileUrl(eventTheme?.foreground_image_url); + const backgroundImageUrl = getServerFileUrl(eventTheme?.background_image_url); + const threeAnimalsImgUrl = getAssetUrl("three-animals"); + console.log(backgroundImageUrl); return ( -
-
+ {/* Top jungle arch */} + {/* Top arch with background image */} + {/* Simplest background image approach */} + - -
+ {/* Background image with high transparency (if present) */} + {eventTheme?.background_image_url && ( + + )} -
- {/* Banner */} -
-
- {/* Overlay to ensure text readability */} + {/* Animals image stacked on top */} + Three animals + + {/* Main content container */} +
+ + {/* Title Section */} + +

+ wild +

+

+ ONE +

+ {/**/} + {/* SEI INVITATO ALL'EVENTO*/} + {/*

*/} +

+ {event.title} +

+
+ + {/* Date & Time Section */} +
+ className="rounded-lg p-5" + style={{ backgroundColor: colors.backgroundDark }} + > +
+
+

+ {displayDay} +

+

+ {displayDate} +

+
- {/* Content */} -
-

- {event.title} -

-

- Safari Adventure -

+
+ +
+

+ {displayMonth} +

+
+ +
+ +
+

+ {timeRange} +

+
+
+
- {/* Fallback when image is not available */} - {!eventTheme?.foreground_image_url && ( + {/* Location Section */} + +
+

+ {event.location_name} +

+

+ {event.location_address} +

+ + {event.location_url && ( +
+ +
+ )} +
+
+ + {/* Description Section */} + {event.description && ( +
+
+ {event.description} +
+

+ Con affetto, Emma, Anto & Fely +

+
+
+ )} + + {/* RSVP and Gift Registry Section */} + + {event.rsvp_enabled && ( +
+ {/**/} + {/* RSVP by {rsvpDeadline}*/} + {/*

*/} + +
+ )} + + {event.gift_registry_enabled && ( +
+ {/**/} + {/* List Regali*/} + {/*

*/} + +
+ )} +
+
+ + {/* Animal Section at Bottom */} + +
+ {" "} + {eventTheme?.foreground_image_url ? ( + Safari Animals + ) : ( +
Safari Animals Illustration
)}
-
+ - {/* Date/Time with Elephant */} - - - {/* Location with Giraffe */} - - - {/* Description */} - -

- La nostra piccola safari adventure! -

-
- {event.description ? ( -
- {event.description} -
- ) : ( -

- Join us for a wild safari celebration with games, food, and - jungle fun! Safari attire encouraged but optional. Children - welcome to dress as their favorite animals for a truly wild - experience! -

- )} -
-
- {/* RSVP Section */} - {event.rsvp_enabled && ( -
-

- RSVP -

-

- {rsvpDeadline - ? `Please respond by ${rsvpDeadline}` - : "Please respond as soon as possible"} -

-
- - - -
-
- )} - {/* Gift Registry with Lion */} - {event.gift_registry_enabled && ( - - )} - {/* View Map Button */} - {event.location_url && ( -
- - - -
- )} - {/* Footer with Contact Info */} -
-

Contact:

- {event.contact_email &&

{event.contact_email}

} - {event.contact_phone &&

{event.contact_phone}

} -
+ {/* Bottom arch to frame the animals */}
+ + {/* RSVP Modal */} + {/*{showRSVP && (*/} + {/* setShowRSVP(false)}*/} + {/* />*/} + {/*)}*/}
); };