diff --git a/.eslintrc.json b/.eslintrc.json index 1a1ad7a..c9fcf13 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "extends": ["next/core-web-vitals", "next/typescript"], "rules": { - "@next/next/no-img-element": "off" + "@next/next/no-img-element": "off", + "@typescript-eslint/no-explicit-any": "off" } } diff --git a/app/events/page.tsx b/app/events/page.tsx index 53ff692..8111421 100644 --- a/app/events/page.tsx +++ b/app/events/page.tsx @@ -1,8 +1,9 @@ 'use client'; -import React, { useEffect, useState, useRef } from 'react'; +import React, { useEffect, useState, useRef, Suspense } from 'react'; import { useRouter } from 'next/navigation'; // Import useRouter for routing import Header from '../../components/custom/header'; import Footer from '../../components/custom/footer'; +import { useSearchParams } from 'next/navigation'; interface Event { EventID: number; @@ -62,7 +63,7 @@ const fetchEvents = (): Event[] => { const EventsPage: React.FC = () => { const [events, setEvents] = useState([]); const [filteredEvents, setFilteredEvents] = useState([]); - const [searchQuery, setSearchQuery] = useState(''); + const [searchQuery, setSearchQuery] = useState(""); const [hoveredEventId, setHoveredEventId] = useState(null); const [sortOption, setSortOption] = useState(''); const [filterOptions, setFilterOptions] = useState([]); @@ -80,6 +81,17 @@ const EventsPage: React.FC = () => { setFilteredEvents(eventsData); }, []); + const SearchBox = () => { + setSearchQuery(useSearchParams().get("q") || ""); + return setSearchQuery(e.target.value)} + className="search-bar mt-4 p-2 border border-gray-300 rounded w-full max-w-md" + /> + }; + useEffect(() => { let filtered = events.filter((event) => ['name', 'date', 'location', 'description', 'host'].some((key) => @@ -166,13 +178,18 @@ const EventsPage: React.FC = () => {
- setSearchQuery(e.target.value)} - className="search-bar mt-4 p-2 border border-gray-300 rounded w-full max-w-md" - /> + setSearchQuery(e.target.value)} + className="search-bar mt-4 p-2 border border-gray-300 rounded w-full max-w-md" + /> + }> + +
{/* Sort Button and Dropdown */}
diff --git a/app/page.tsx b/app/page.tsx index 0018a04..c66eab0 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,49 @@ 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 +93,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..50ab18d --- /dev/null +++ b/components/custom/FeaturedEvent.tsx @@ -0,0 +1,44 @@ +'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; + eventStartDate: number; + eventHost: string; + imageURL: string | null; +} + +const FeaturedEvent = ({ + name, description, location, eventStartDate, eventHost, imageURL +}: props) => { + return + + {imageURL && {name}} + + {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