diff --git a/public/sponsors/Global-productions.png b/public/sponsors/Global-productions.png deleted file mode 100644 index a3ae3dc..0000000 Binary files a/public/sponsors/Global-productions.png and /dev/null differ diff --git a/public/sponsors/Global-productions.svg b/public/sponsors/Global-productions.svg new file mode 100644 index 0000000..1297096 --- /dev/null +++ b/public/sponsors/Global-productions.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/[locale]/ajakava/page.tsx b/src/app/[locale]/ajakava/page.tsx index e32f55f..eb59e2b 100644 --- a/src/app/[locale]/ajakava/page.tsx +++ b/src/app/[locale]/ajakava/page.tsx @@ -1,27 +1,198 @@ -import { vipnagorgialla } from "@/components/Vipnagorgialla"; -import { getTranslations, setRequestLocale } from "next-intl/server"; +"use client"; -export default async function Timetable({ - params, -}: { - params: Promise<{ locale: string }>; -}) { - const { locale } = await params; - setRequestLocale(locale); - const t = await getTranslations({ locale }); +import { useState } from "react"; +import { useSearchParams } from "next/navigation"; +import { vipnagorgialla } from "@/components/Vipnagorgialla"; +import { scheduleData, type ScheduleItem } from "@/data/timetable"; +import { useTranslations, useLocale } from "next-intl"; + +const tabs = Object.keys(scheduleData); + +// Map of filter shorthand to location key suffixes +const FILTER_MAP: Record = { + aula: ['auditorium'], + auditorium: ['auditorium'], + tudengimaja: ['studentHouse'], + studenthouse: ['studentHouse'], + fuajee: ['lobbyAndLanArea'], + foyer: ['lobbyAndLanArea'], + lan: ['lobbyAndLanArea'], + lanarea: ['lobbyAndLanArea'], + lobby: ['lobbyAndLanArea'], +}; + +function matchesFilter(item: ScheduleItem, filter: string): boolean { + const normalizedFilter = filter.toLowerCase(); + const locationKeys = Array.isArray(item.locationKey) ? item.locationKey : [item.locationKey]; + + // Get the matching location suffixes from the filter map, or use the filter directly + const filterSuffixes = FILTER_MAP[normalizedFilter] || [normalizedFilter]; + + // Check if any of the item's location keys contain any of the filter suffixes + return locationKeys.some(key => + filterSuffixes.some(suffix => + key.toLowerCase().includes(suffix.toLowerCase()) + ) + ); +} + +function formatLocationKeys(keys: string[], t: (key: string) => string, locale: string): string { + const translated = keys.map(k => t(k)); + if (translated.length === 1) return translated[0]; + + const isEstonian = locale === 'et'; + const and = isEstonian ? ' ja ' : ' and '; + + if (translated.length === 2) { + return translated.join(and); + } + + if (isEstonian) { + return translated.slice(0, -1).join(', ') + and + translated[translated.length - 1]; + } + + return translated.slice(0, -1).join(', ') + ', and ' + translated[translated.length - 1]; +} + +export default function Timetable() { + const searchParams = useSearchParams(); + const filter = searchParams.get('filter') || ''; + const [activeTab, setActiveTab] = useState(tabs[0]); + const schedule = scheduleData[activeTab]; + const t = useTranslations(); + const locale = useLocale(); + + // Filter schedule items based on the filter parameter + const filteredSchedule = filter + ? schedule.filter(item => matchesFilter(item, filter)) + : schedule; return ( -
-

- {t("schedule.title")} -

-

- {t("schedule.comingSoon")} -

+
+
+

+ {t("schedule.title")} +

+ + {/* Tab menu */} +
+ {tabs.map((tab) => ( + + ))} +
+ + {/* Filter buttons */} +
+

+ {t("schedule.location")} +

+
+
+ + + + +
+ + {/* Schedule entries */} +
+ {filteredSchedule.map((item, idx) => ( +
+
+ {item.time} +
+
+
+ {t(item.titleKey)} +
+ {item.description && ( +
+ {item.description} +
+ )} +
+ {Array.isArray(item.locationKey) + ? formatLocationKeys(item.locationKey, t, locale) + : t(item.locationKey) + } +
+
+
+ ))} +
+

{t("schedule.transportInfo")}

+
); } diff --git a/src/app/[locale]/kodukord/page.tsx b/src/app/[locale]/kodukord/page.tsx index e05517c..a1e2456 100644 --- a/src/app/[locale]/kodukord/page.tsx +++ b/src/app/[locale]/kodukord/page.tsx @@ -32,7 +32,7 @@ export default async function Page({ return (
-
+
{/* Main content */}
{/* Page title */} diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 74d8751..d8bfdd3 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -41,7 +41,7 @@ const Header = ({ navItems }: HeaderProps) => { const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); // Header navigation should include all options except homepage and hidden items - const hiddenNavHrefs: NavItem["href"][] = ["/messiala", "/ajakava"]; + const hiddenNavHrefs: NavItem["href"][] = ["/messiala"]; const mainNavItems = navItems.filter( (item) => item.href !== "/" && !hiddenNavHrefs.includes(item.href), ); diff --git a/src/components/Sponsors.tsx b/src/components/Sponsors.tsx index 62dd8a9..e85af21 100644 --- a/src/components/Sponsors.tsx +++ b/src/components/Sponsors.tsx @@ -60,7 +60,7 @@ const sponsors: Sponsor[] = [ }, { href: "https://globalproductions.ee/", - src: "/sponsors/Global-productions.png", + src: "/sponsors/Global-productions.svg", alt: "Global Productions", width: 200, height: 200, diff --git a/src/components/SwitchableTicketCard.tsx b/src/components/SwitchableTicketCard.tsx index 58c48b4..62d210c 100644 --- a/src/components/SwitchableTicketCard.tsx +++ b/src/components/SwitchableTicketCard.tsx @@ -288,14 +288,14 @@ export default function SwitchableTicketCard({ {/* Chevron buttons on left/right sides */}