diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e06dfc2 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +NEXT_PUBLIC_RPC_URL= +NEXT_PUBLIC_CONTRACT_ADDRESS= \ No newline at end of file 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/.gitignore b/.gitignore index f7e1f5a..f9fcfb5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ yarn-debug.log* yarn-error.log* # local env files -.env* +.env .local # vercel diff --git a/app/events/page.tsx b/app/events/page.tsx index 53ff692..af9b2b2 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; @@ -80,6 +81,19 @@ 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 +180,20 @@ 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..775ec3d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,16 +1,38 @@ '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'; + +import React from 'react'; +import { FlipWords } from '@/components/ui/flip-words'; 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)); + } + + const words = [ + 'adventure', + 'concert', + 'outing', + 'journey', + 'hackathon', + 'conference', + ]; + return ( <>
@@ -32,34 +54,65 @@ export default function Home() {
{/* Page Content Over the Video */} -
+
-
+
+
+ Book your next + + on the Flare blockchain. +
+
+ +
+
-

-
-

- Featured Events -

-

- No events available at the moment. -

-
-
-

- Upcoming Events -

-
    -
  • Event 1 - Date
  • -
  • Event 2 - Date
  • -
  • Event 3 - Date
  • -
+
+ + +
diff --git a/components/custom/FeaturedEvent.tsx b/components/custom/FeaturedEvent.tsx new file mode 100644 index 0000000..4d283a4 --- /dev/null +++ b/components/custom/FeaturedEvent.tsx @@ -0,0 +1,51 @@ +'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; diff --git a/components/custom/footer.tsx b/components/custom/footer.tsx index 4012306..9d39d64 100644 --- a/components/custom/footer.tsx +++ b/components/custom/footer.tsx @@ -3,8 +3,8 @@ import React from 'react'; const Footer = () => { return (
-

- © 2024 Ticket Chain. All rights reserved. +

+ © 2024 TicketChain. All rights reserved.

); diff --git a/components/custom/header.tsx b/components/custom/header.tsx index 5e80639..b044a19 100644 --- a/components/custom/header.tsx +++ b/components/custom/header.tsx @@ -36,14 +36,16 @@ const Header = () => { >
- TicketChain + + TicketChain +