fixed metamask button

This commit is contained in:
ayomaska18
2024-10-26 23:04:06 +01:00
13 changed files with 331 additions and 43 deletions

View File

@@ -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 (
<input
type="text"
placeholder="Search events..."
value={searchQuery}
onChange={(e) => 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 = () => {
<div className="relative z-20 container mx-auto p-4 pt-16">
<div className="mb-6">
<input
type="text"
placeholder="Search events..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="search-bar mt-4 p-2 border border-gray-300 rounded w-full max-w-md"
/>
<Suspense
fallback={
<input
type="text"
placeholder="Search events..."
disabled={true}
value="loading..."
onChange={(e) => setSearchQuery(e.target.value)}
className="search-bar mt-4 p-2 border border-gray-300 rounded w-full max-w-md"
/>
}
>
<SearchBox />
</Suspense>
<div className="flex mt-4 space-x-4">
{/* Sort Button and Dropdown */}
<div className="relative" ref={sortRef}>

View File

@@ -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 (
<>
<Header />
@@ -32,34 +54,65 @@ export default function Home() {
<div className="absolute inset-0 bg-black opacity-50 z-10"></div>
{/* Page Content Over the Video */}
<div className="relative z-20 min-h-screen bg-gradient-to-b from-transparent to-gray-900 pt-16">
<div className="relative z-20 min-h-screen bg-gradient-to-b from-transparent to-gray-900 pt-20">
<div className="container mx-auto p-4">
<div className="flex items-center justify-center">
<div className="container mx-auto justify-center items-center p-4">
<div className="text-4xl font-bold text-white text-shadow-lg">
Book your next
<FlipWords
words={words}
className="text-light-purple text-opacity-75"
/>
on the Flare blockchain.
</div>
</div>
<div className="flex items-center justify-center mt-6 flex-col gap-4">
<Input
type="text"
placeholder="Search events ..."
className="search-bar mt-4 p-2 border bg-white bg-opacity-25 border-gray-300 rounded-xl w-full max-w-5xl text-white"
placeholder="Search for your next experience..."
className="flex w-full rounded-md border border-input bg-white bg-opacity-50 placeholder:text-black px-4 py-6 text-lg shadow-sm"
ref={inputRef}
/>
<Button
className="bg-pink-600 bg-opacity-50 text-white px-4 py-6 text-lg w-full hover:bg-pink-500"
onClick={searchForEvents}
>
Search for events
</Button>
</div>
<main>
<br></br>
<section className="mb-8">
<h2 className="text-2xl font-semibold text-white mb-4">
Featured Events
</h2>
<p className="text-gray-300">
No events available at the moment.
</p>
</section>
<section>
<h2 className="text-2xl font-semibold text-white mb-4">
Upcoming Events
</h2>
<ul className="list-disc list-inside text-gray-300">
<li>Event 1 - Date</li>
<li>Event 2 - Date</li>
<li>Event 3 - Date</li>
</ul>
<section className="mb-8 mt-4 mx-auto grid grid-cols-4 gap-4">
<FeaturedEvent
name="FAB XO Halloween"
description="Halloween is upon us and is one of the biggest nights of the FAB XO calendar. Fancy dress is encouraged! So have your fancy dress ready and we look forward to seeing who have the best fancy dress on the night! As a special treat we will be serving our very own witches brew!!!"
location="Birmingham, UK"
eventStartDate={1729980000}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg'
}
/>
<FeaturedEvent
name="Halls Halloween Spooktacular"
description="Put on your spookiest costume and head on down to Pritchatts Park and join your Event Activators for our ResLife SPOOKTACULAR on Wednesday 30th October 5-8pm."
location="Birmingham, UK"
eventStartDate={1730307600}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/41187/Spooktacular-Web-Event-2024.png'
}
/>
<FeaturedEvent
name="Housing Fair"
description="Were hosting a Housing Fair, so make sure you save the date! Whether youre living in student accommodation or the local community, this will be a great place to start as you begin thinking about where youll be living next year."
location="Birmingham, UK"
eventStartDate={1730804400}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/41111/Housing-Fair-Web-Event.png'
}
/>
</section>
</main>
<Footer />