diff --git a/app/page.tsx b/app/page.tsx
index c1413cd..c66eab0 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -65,8 +65,6 @@ export default function Home() {
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"
- capacity={100}
- ticketsSold={50}
eventStartDate={1729980000}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={"https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg"}
@@ -75,8 +73,6 @@ export default function Home() {
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"
- capacity={100}
- ticketsSold={50}
eventStartDate={1730307600}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={"https://www.guildofstudents.com/asset/Event/41187/Spooktacular-Web-Event-2024.png"}
@@ -85,8 +81,6 @@ export default function Home() {
name="Housing Fair"
description="We’re hosting a Housing Fair, so make sure you save the date! Whether you’re living in student accommodation or the local community, this will be a great place to start as you begin thinking about where you’ll be living next year."
location="Birmingham, UK"
- capacity={100}
- ticketsSold={50}
eventStartDate={1730804400}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={"https://www.guildofstudents.com/asset/Event/41111/Housing-Fair-Web-Event.png"}
diff --git a/components/custom/FeaturedEvent.tsx b/components/custom/FeaturedEvent.tsx
index a1e1c51..50ab18d 100644
--- a/components/custom/FeaturedEvent.tsx
+++ b/components/custom/FeaturedEvent.tsx
@@ -13,19 +13,17 @@ 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
+ name, description, location, eventStartDate, eventHost, imageURL
}: props) => {
return
- {imageURL &&
}
+ {imageURL &&
}
{name}
From 2235ae9851170cd8f12e6f5f941ecf9b7fbe8777 Mon Sep 17 00:00:00 2001
From: sid <35936587+siddharth-shringarpure@users.noreply.github.com>
Date: Sat, 26 Oct 2024 20:40:04 +0100
Subject: [PATCH 07/11] =?UTF-8?q?=E2=9E=95=20Modified=20config=20files=20f?=
=?UTF-8?q?or=20Aceternity.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package-lock.json | 12 +++++++++---
package.json | 3 ++-
tailwind.config.ts | 46 +++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index ea562bf..1735469 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -25,7 +25,7 @@
"next": "14.2.13",
"react": "^18.3.1",
"react-dom": "^18.3.1",
- "tailwind-merge": "^2.5.2",
+ "tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
@@ -39,6 +39,7 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/tailwindcss": "^3.0.11",
"chai": "^4.2.0",
"eslint": "^8",
"eslint-config-next": "14.2.13",
@@ -7461,6 +7462,13 @@
"license": "MIT",
"peer": true
},
+ "node_modules/@types/tailwindcss": {
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/@types/tailwindcss/-/tailwindcss-3.0.11.tgz",
+ "integrity": "sha512-PR+BOIrI+rxteHwFvkfIOty+PDJwTG4ute3alxSSXpF/xKpryO1room265m46Auyae0VwqUYs3PuVEOF9Oil3w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/yargs": {
"version": "17.0.33",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz",
@@ -13016,7 +13024,6 @@
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
"integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
"dev": true,
- "hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@@ -13379,7 +13386,6 @@
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
"integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
"dev": true,
- "hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
diff --git a/package.json b/package.json
index 74f4bca..54c4813 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"next": "14.2.13",
"react": "^18.3.1",
"react-dom": "^18.3.1",
- "tailwind-merge": "^2.5.2",
+ "tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
@@ -43,6 +43,7 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/tailwindcss": "^3.0.11",
"chai": "^4.2.0",
"eslint": "^8",
"eslint-config-next": "14.2.13",
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 5ea29e2..01d6ddf 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,4 +1,10 @@
import type { Config } from 'tailwindcss';
+import tailwindcssAnimate from 'tailwindcss-animate';
+
+type ColorValue = string | ColorDictionary;
+interface ColorDictionary {
+ [colorName: string]: ColorValue;
+}
const config: Config = {
darkMode: ['class'],
@@ -68,6 +74,44 @@ const config: Config = {
},
},
},
- plugins: [require('tailwindcss-animate')],
+ plugins: [tailwindcssAnimate, addVariablesForColors],
};
+
export default config;
+
+// Plugin to add each Tailwind color as a CSS variable
+function addVariablesForColors({
+ addBase,
+ theme,
+}: {
+ addBase: (styles: Record>) => void;
+ theme: (path: string) => unknown;
+}) {
+ const colors = theme('colors') as ColorDictionary;
+ const flattenedColors = flattenColors(colors);
+ const newVars = Object.fromEntries(
+ Object.entries(flattenedColors).map(([key, val]) => [`--${key}`, val])
+ );
+
+ addBase({
+ ':root': newVars,
+ });
+}
+
+// Recursive function to flatten nested color objects
+function flattenColors(
+ colors: ColorDictionary,
+ prefix = ''
+): Record {
+ const result: Record = {};
+ for (const [key, value] of Object.entries(colors)) {
+ if (typeof value === 'string') {
+ // If the value is a string, add it to the result
+ result[prefix + key] = value;
+ } else if (typeof value === 'object' && value !== null) {
+ // If the value is an object, recursively flatten it
+ Object.assign(result, flattenColors(value, `${prefix}${key}-`));
+ }
+ }
+ return result;
+}
From 1ede2133b39175ec455f74ae11bf0d499a1931d4 Mon Sep 17 00:00:00 2001
From: Ayush Acharjya
Date: Sat, 26 Oct 2024 21:05:00 +0100
Subject: [PATCH 08/11] update ticket cost
---
lib/buyHandler.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/buyHandler.ts b/lib/buyHandler.ts
index 0f8530d..dfd2808 100644
--- a/lib/buyHandler.ts
+++ b/lib/buyHandler.ts
@@ -38,7 +38,8 @@ export const buyHandler = async (
const signer = provider.getSigner();
const contract = getContract().connect(signer);
- const ticketCost = await contract.getEventPriceFlare(eventId);
+ let ticketCost = await contract.getEventPriceFlare(eventId);
+ ticketCost = ticketCost.mul(105).div(100);
const balance = await provider.getBalance(await signer.getAddress());
if (balance.lt(ticketCost)) {
From 9071da494c9a5477b9d8fb4ab6250f0f7ddbb7c5 Mon Sep 17 00:00:00 2001
From: Shay Patel
Date: Sat, 26 Oct 2024 21:15:16 +0100
Subject: [PATCH 09/11] Load search query from URL parameter
---
app/events/page.tsx | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/app/events/page.tsx b/app/events/page.tsx
index 75825ca..11473a2 100644
--- a/app/events/page.tsx
+++ b/app/events/page.tsx
@@ -1,5 +1,5 @@
'use client';
-import React, { useEffect, useState, useRef } from 'react';
+import React, { useEffect, useState, useRef, Suspense } from 'react';
import Header from '../../components/custom/header';
import Footer from '../../components/custom/footer';
import { useSearchParams } from 'next/navigation';
@@ -63,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(''); // Track sorting option
const [filterOptions, setFilterOptions] = useState([]); // Track applied filters
@@ -71,8 +71,6 @@ 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);
@@ -82,6 +80,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) =>
@@ -143,13 +152,10 @@ const EventsPage: React.FC = () => {
useEffect(() => {
document.addEventListener('mousedown', handleClickOutside);
- if (searchParams.get("q")) {
- setSearchQuery(searchParams.get("q")!);
- };
return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
- }, [searchParams]);
+ }, []);
return (
@@ -167,13 +173,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 */}
From c0e0f51309c4b464512be53631e6176da930f95e Mon Sep 17 00:00:00 2001
From: Ayush Acharjya
Date: Sat, 26 Oct 2024 21:59:48 +0100
Subject: [PATCH 10/11] add temp env
---
.env.example | 2 ++
.gitignore | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 .env.example
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/.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
From 64b546975e322cb2b0c60819a1597f9b5784a4a2 Mon Sep 17 00:00:00 2001
From: sid <35936587+siddharth-shringarpure@users.noreply.github.com>
Date: Sat, 26 Oct 2024 22:08:48 +0100
Subject: [PATCH 11/11] =?UTF-8?q?=E2=9C=A8=20Utilised=20Aceternity=20flip-?=
=?UTF-8?q?words=20to=20enhance=20home=20page.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/page.tsx | 48 ++++++++++++++----
components/ui/flip-words.tsx | 98 ++++++++++++++++++++++++++++++++++++
2 files changed, 136 insertions(+), 10 deletions(-)
create mode 100644 components/ui/flip-words.tsx
diff --git a/app/page.tsx b/app/page.tsx
index c66eab0..775ec3d 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -7,6 +7,9 @@ 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);
@@ -17,10 +20,19 @@ export default function Home() {
}, []);
function searchForEvents() {
- if (inputRef.current.value == "") return;
- router.replace("/events?q=" + encodeURIComponent(inputRef.current.value));
+ if (inputRef.current.value == '') return;
+ router.replace('/events?q=' + encodeURIComponent(inputRef.current.value));
}
+ const words = [
+ 'adventure',
+ 'concert',
+ 'outing',
+ 'journey',
+ 'hackathon',
+ 'conference',
+ ];
+
return (
<>
@@ -44,9 +56,17 @@ export default function Home() {
{/* Page Content Over the Video */}
-
- Book your next adventure
on the Flare blockchain
-
+
+
+ Book your next
+
+ on the Flare blockchain.
+
+
+
Search for events
+ >
+ Search for events
+
@@ -67,7 +89,9 @@ export default function Home() {
location="Birmingham, UK"
eventStartDate={1729980000}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
- imageURL={"https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg"}
+ imageURL={
+ 'https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg'
+ }
/>
@@ -93,4 +121,4 @@ export default function Home() {
>
);
-}
\ No newline at end of file
+}
diff --git a/components/ui/flip-words.tsx b/components/ui/flip-words.tsx
new file mode 100644
index 0000000..20f74d1
--- /dev/null
+++ b/components/ui/flip-words.tsx
@@ -0,0 +1,98 @@
+'use client';
+import React, { useCallback, useEffect, useState } from 'react';
+import { AnimatePresence, motion } from 'framer-motion';
+import { cn } from '@/lib/utils';
+
+export const FlipWords = ({
+ words,
+ duration = 3000,
+ className,
+}: {
+ words: string[];
+ duration?: number;
+ className?: string;
+}) => {
+ const [currentWord, setCurrentWord] = useState(words[0]);
+ const [isAnimating, setIsAnimating] = useState
(false);
+
+ // thanks for the fix Julian - https://github.com/Julian-AT
+ const startAnimation = useCallback(() => {
+ const word = words[words.indexOf(currentWord) + 1] || words[0];
+ setCurrentWord(word);
+ setIsAnimating(true);
+ }, [currentWord, words]);
+
+ useEffect(() => {
+ if (!isAnimating)
+ setTimeout(() => {
+ startAnimation();
+ }, duration);
+ }, [isAnimating, duration, startAnimation]);
+
+ return (
+ {
+ setIsAnimating(false);
+ }}
+ >
+
+ {/* edit suggested by Sajal: https://x.com/DewanganSajal */}
+ {currentWord.split(' ').map((word, wordIndex) => (
+
+ {word.split('').map((letter, letterIndex) => (
+
+ {letter}
+
+ ))}
+
+
+ ))}
+
+
+ );
+};