From 91491748cda460e1a68895df1ef451294e9d6f04 Mon Sep 17 00:00:00 2001 From: centauridesigns Date: Sat, 22 Mar 2025 18:35:47 +0100 Subject: [PATCH] add gangfest support --- package-lock.json | 15 +++++++++ src/app/components/EventCard.tsx | 43 +++++++++++++++++++----- src/app/components/MenuCard.tsx | 8 ++++- src/app/components/SWMGSpecials.tsx | 40 ++++++++++++++++++++++ src/app/globals.css | 52 +++++++++++++++++++++++++++++ src/public/eventItems.json | 36 +++++++++++++++++++- src/public/swmgItems.json | 20 +++++++++++ 7 files changed, 203 insertions(+), 11 deletions(-) create mode 100644 src/app/components/SWMGSpecials.tsx create mode 100644 src/public/swmgItems.json diff --git a/package-lock.json b/package-lock.json index 8a37423..2b0ec0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5749,6 +5749,21 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.13", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.13.tgz", + "integrity": "sha512-V26ezyjPqQpDBV4lcWIh8B/QICQ4v+M5Bo9ykLN+sqeKKBxJVDpEc6biDVyluTXTC40f5IqCU0ttth7Es2ZuMw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } } } diff --git a/src/app/components/EventCard.tsx b/src/app/components/EventCard.tsx index 38d0bec..2ee4a2b 100644 --- a/src/app/components/EventCard.tsx +++ b/src/app/components/EventCard.tsx @@ -12,7 +12,9 @@ interface SpecialEvent { name: string; date: string; time: string; + end_time?: string; timeDiffMs?: number; + ongoing?: boolean; } interface Place { @@ -46,8 +48,7 @@ const EventCard: React.FC = ({ specialTimeAhead, placeTimeAhead, }) => { - const [nextSpecialEvent, setNextSpecialEvent] = useState< - RecurringEvent | SpecialEvent | Place | null + const [nextSpecialEvent, setNextSpecialEvent] = useState(null); const [upcomingEvents, setUpcomingEvents] = useState< (RecurringEvent | SpecialEvent | Place)[] @@ -76,9 +77,24 @@ const EventCard: React.FC = ({ // handle special events const specialEventsWithCountdown = specialEvents.map((event) => { const [day, month, year] = event.date.split("."); - const eventTime = new Date(`${year}-${month}-${day}T${event.time}`); - const timeDiffMs = eventTime.getTime() - now.getTime(); - return { ...event, timeDiffMs }; + + const start = new Date(`${year}-${month}-${day}T${event.time}`); + + let end = null; + if (event.end_time) { + const endHour = parseInt(event.end_time.split(":")[0]); + const endMinute = parseInt(event.end_time.split(":")[1]); + end = new Date(start); + if (endHour < start.getHours()) { + end.setDate(end.getDate() + 1); + } + end.setHours(endHour, endMinute); + } + + const now = new Date(); + const ongoing = end ? now >= start && now <= end : false; + const timeDiffMs = start.getTime() - now.getTime(); + return { ...event, timeDiffMs, ongoing }; }); const filteredEvents = [ @@ -98,10 +114,17 @@ const EventCard: React.FC = ({ const nextSpecialEvent = specialEventsWithCountdown.find( (event) => - event.timeDiffMs! > 0 && - event.timeDiffMs! <= parseInt(specialTimeAhead) * 60 * 60 * 1000 // 30 days + (event.timeDiffMs! > 0 && + event.timeDiffMs! <= parseInt(specialTimeAhead) * 60 * 60 * 1000) || + event.ongoing ); + if (specialEventsWithCountdown.some(e => e.ongoing)) { + document.body.classList.add("swmg"); + } else { + document.body.classList.remove("swmg"); + } + // sort events by time difference filteredEvents.sort((a, b) => a.timeDiffMs! - b.timeDiffMs!); @@ -135,7 +158,7 @@ const EventCard: React.FC = ({ ))}
- {nextSpecialEvent?.name != "" && ( + {nextSpecialEvent && (nextSpecialEvent.ongoing || nextSpecialEvent.timeDiffMs! > 0) && (

Special Event

@@ -143,7 +166,9 @@ const EventCard: React.FC = ({

- {getTimeDifference(nextSpecialEvent?.timeDiffMs ?? 0)} + {nextSpecialEvent?.ongoing + ? "Now" + : getTimeDifference(nextSpecialEvent?.timeDiffMs ?? 0)}

diff --git a/src/app/components/MenuCard.tsx b/src/app/components/MenuCard.tsx index 144e3b5..cbd7b7f 100644 --- a/src/app/components/MenuCard.tsx +++ b/src/app/components/MenuCard.tsx @@ -1,6 +1,8 @@ import React from "react"; import menuItems from "../../public/menuItems.json"; import MenuSection from "./MenuSection"; +import swmgSpecials from "../../public/swmgItems.json"; +import SWMGSpecials from "./SWMGSpecials"; function MenuCard() { return ( @@ -13,9 +15,13 @@ function MenuCard() { {/*right-side container containing 2 boxes*/}
{/*top box*/} - + {/*bottom box*/} +
diff --git a/src/app/components/SWMGSpecials.tsx b/src/app/components/SWMGSpecials.tsx new file mode 100644 index 0000000..f501bef --- /dev/null +++ b/src/app/components/SWMGSpecials.tsx @@ -0,0 +1,40 @@ +interface SpecialItem { + name: string; + description?: string; + price: number; + } + + interface SpecialsProps { + title: string; + items: SpecialItem[]; + } + + const SWMGSpecials: React.FC = ({ title, items }) => { + return ( +
+

{title}

+
+ {items.map((item) => ( +
+
+

{item.name}

+ {item.description && ( +

{item.description}

+ )} +
+
+

kr {item.price}

+
+
+ ))} +
+
+ ); + }; + + + export default SWMGSpecials; + \ No newline at end of file diff --git a/src/app/globals.css b/src/app/globals.css index 455dd8b..1489637 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -77,3 +77,55 @@ p { text-wrap: balance; } } + +/* === swmg theme === */ +.swmg { + --background: #050509; + --foreground: #120c1c; + --primary: #230b3a; + --headers: #ffffff; + --overlay: #1a102b; +} + +.swmg p, +.swmg .para, +.swmg .parasmall, +.swmg .text-p, +.swmg .time { + color: #f5c542 !important; + text-shadow: 0 0 8px #ffffff88; +} + +.swmg .text-headers { + color: #f5c542 !important; + text-shadow: 0 0 8px #ffffff88; +} + +@keyframes swmgPulse { + 0%, 100% { + box-shadow: 0 0 10px #6f42c1aa, 0 0 20px #6f42c188; + } + 50% { + box-shadow: 0 0 15px #a164ffcc, 0 0 30px #6f42c1cc; + } +} + +.swmg .animate-pulse, +.swmg .swmg-glow { + animation: swmgPulse 2.5s ease-in-out infinite; +} + +.swmg .bg-primary { + animation: swmgPulse 5s ease-in-out infinite; +} + +.swmg .specials-box { + background: linear-gradient(145deg, #2a1d38, #1a102b); + border: 2px solid #f5c542aa; + border-radius: 12px; + box-shadow: + 0 0 8px #f5c54255, + 0 0 20px #6f42c188, + inset 0 0 12px #2a1d38cc; + animation: swmgPulse 3s ease-in-out infinite; +} \ No newline at end of file diff --git a/src/public/eventItems.json b/src/public/eventItems.json index bd845c2..2e10fe7 100644 --- a/src/public/eventItems.json +++ b/src/public/eventItems.json @@ -26,7 +26,8 @@ { "name": "Gangfest", "date": "22.03.2025", - "time": "18:00" + "time": "18:00", + "end_time": "03:00" } ], @@ -96,6 +97,39 @@ "time": "22:00" } ] + }, + { + "name": "Valkyrien Grill", + "closing_times" : [ + { + "day": "Monday", + "time": "04:00" + }, + { + "day": "Tuesday", + "time": "04:00" + }, + { + "day": "Wednesday", + "time": "04:00" + }, + { + "day": "Thursday", + "time": "04:00" + }, + { + "day": "Friday", + "time": "04:00" + }, + { + "day": "Saturday", + "time": "04:00" + }, + { + "day": "Sunday", + "time": "04:00" + } + ] } ] } diff --git a/src/public/swmgItems.json b/src/public/swmgItems.json new file mode 100644 index 0000000..b70fd03 --- /dev/null +++ b/src/public/swmgItems.json @@ -0,0 +1,20 @@ +{ + "Specials": [ + { + "name": "Hard Cider", + "description": "Apple, 0.4 liter, 6% vol", + "price": 20 + }, + { + "name": "Cup Noodle", + "description": "Spicy Beef or Chicken", + "price": 23 + }, + { + "name": "Doritos", + "description": "Sweet Chili, Nacho Cheese, Flamin' Hot", + "price": 12 + } + ] + } + \ No newline at end of file