diff --git a/app/events/page.tsx b/app/events/page.tsx index 7bda79c..1aa11f6 100644 --- a/app/events/page.tsx +++ b/app/events/page.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState, useRef } from 'react'; import Header from '../../components/custom/header'; import Footer from '../../components/custom/footer'; +import { useSearchParams } from 'next/navigation'; // Define the Event interface including new fields interface Event { @@ -70,6 +71,8 @@ const EventsPage: React.FC = () => { const [showSortMenu, setShowSortMenu] = useState(false); const [showFilterMenu, setShowFilterMenu] = useState(false); + const searchParams = useSearchParams(); + const sortRef = useRef(null); const filterRef = useRef(null); @@ -140,6 +143,9 @@ const EventsPage: React.FC = () => { useEffect(() => { document.addEventListener('mousedown', handleClickOutside); + if (searchParams.get("q")) { + setSearchQuery(searchParams.get("q")!); + }; return () => { document.removeEventListener('mousedown', handleClickOutside); }; diff --git a/app/page.tsx b/app/page.tsx index 0018a04..c1413cd 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,16 +1,26 @@ 'use client'; -import { useEffect, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; +import { useRouter } from 'next/navigation'; import Header from '../components/custom/header'; import Footer from '../components/custom/footer'; import { Input } from '@/components/ui/input'; +import FeaturedEvent from '@/components/custom/FeaturedEvent'; +import { Button } from '@/components/ui/button'; export default function Home() { + const router = useRouter(); const [isClient, setIsClient] = useState(false); + const inputRef: any = useRef(null); useEffect(() => { setIsClient(true); }, []); + function searchForEvents() { + if (inputRef.current.value == "") return; + router.replace("/events?q=" + encodeURIComponent(inputRef.current.value)); + } + return ( <>
@@ -32,34 +42,55 @@ export default function Home() {
{/* Page Content Over the Video */} -
+
-
+

+ Book your next adventure
on the Flare blockchain
+

+
+
-

-
-

- Featured Events -

-

- No events available at the moment. -

-
-
-

- Upcoming Events -

-
    -
  • Event 1 - Date
  • -
  • Event 2 - Date
  • -
  • Event 3 - Date
  • -
+
+ + +
@@ -68,4 +99,4 @@ export default function Home() {
); -} +} \ No newline at end of file diff --git a/components/custom/FeaturedEvent.tsx b/components/custom/FeaturedEvent.tsx new file mode 100644 index 0000000..a1e1c51 --- /dev/null +++ b/components/custom/FeaturedEvent.tsx @@ -0,0 +1,46 @@ +'use client'; +import React from 'react'; +import { + Card, + CardHeader, + CardFooter, + CardTitle, + CardDescription, + CardContent, +} from '@/components/ui/card'; + +interface props { + name: string; + description: string; + location: string; + capacity: number; + ticketsSold: number; + eventStartDate: number; + eventHost: string; + imageURL: string | null; +} + +const FeaturedEvent = ({ + name, description, location, capacity, ticketsSold, eventStartDate, eventHost, imageURL +}: props) => { + return + + {imageURL && } + + {name} + + + {location}
+ {new Date(eventStartDate*1000).toLocaleString()} +
+
+ + {description} + + + Host: {eventHost.substring(0, 8)}...{eventHost.substring(eventHost.length-3)} + +
+} + +export default FeaturedEvent; \ No newline at end of file