diff --git a/src/app/student/_components/EventItem.tsx b/src/app/student/_components/EventItem.tsx new file mode 100644 index 0000000..750d15a --- /dev/null +++ b/src/app/student/_components/EventItem.tsx @@ -0,0 +1,40 @@ +import { P } from "@/app/_components/Paragraph" +import { + AccordionContent, + AccordionItem, + AccordionTrigger +} from "@/components/ui/accordion" +import { cn } from "@/lib/utils" + +export function EventItem({ + children, + title, + dateString +}: { + children?: React.ReactNode + title: string + dateString: string +}) { + const expandable = children != null + return ( + +
+ +
+

{dateString}

+
+

{title}

+
+
+
+ + {children} + +
+ ) +} diff --git a/src/app/student/_components/EventsTimeLine.tsx b/src/app/student/_components/EventsTimeLine.tsx new file mode 100644 index 0000000..a4ed4f2 --- /dev/null +++ b/src/app/student/_components/EventsTimeLine.tsx @@ -0,0 +1,81 @@ +import { P } from "@/app/_components/Paragraph" +import { fetchDates } from "@/components/shared/hooks/api/useDates" +import { Accordion } from "@/components/ui/accordion" +import { Button } from "@/components/ui/button" + +import { EventItem } from "@/app/student/_components/EventItem" +import { DateTime } from "luxon" +import Link from "next/link" + +function formatDate(date: string) { + return DateTime.fromISO(date).toFormat( + `d MMMM ${DateTime.fromISO(date).year !== DateTime.now().year ? " YYYY" : ""}` + ) +} + +export async function EventsTimeline() { + const dates = await fetchDates() + + //ASSUMPTION: the start date will be first for fair dates + return ( + + +

+ Before the Initial Registration can open, we need to make + preparations. We are right now choosing a new project group - 20 + something students who will work hard all year to make Armada happen. +

+

+ We will open Initial Registration where you apply to be an exhibitor + soon. You can express your interest here, and we will contact you as + soon as registration opens! +

+
+ + +

+ Initial Registration is where you apply to be an exhibitor. When you + register you commit to be a part of Armada and if given a spot you are + expected to exhibit, so wait with registration until you are sure. If + you have any questions, do not hesitate to contact{" "} + + sales@armada.nu + + . +

+

+ Sadly, we can't guarantee a spot for everyone that applies. We + are right now investigating how many exhibitors we can fit and how big + the interest is. We try our best to get a good mix of great exhibitors + that make Armada the best place for students to find their dream + employer! +

+

+ During the Initial Registration you don't need to choose a + package, and the packages are outlined{" "} + + here + {" "} + to give you an overview. Prices are set, and small changes can occur + in the larger packages. +

+
+ + + +
+
+
+ ) +} diff --git a/src/app/student/events/page.tsx b/src/app/student/events/page.tsx index 8f1d6b2..15f23ba 100644 --- a/src/app/student/events/page.tsx +++ b/src/app/student/events/page.tsx @@ -1,3 +1,4 @@ +import { EventsTimeline } from "@/app/student/_components/EventsTimeLine" import { Page } from "@/components/shared/Page" import { Suspense } from "react" @@ -7,6 +8,7 @@ export default async function StudentEventPage() { Events + ) diff --git a/src/components/shared/hooks/api/useEvents.tsx b/src/components/shared/hooks/api/useEvents.tsx new file mode 100644 index 0000000..2c92900 --- /dev/null +++ b/src/components/shared/hooks/api/useEvents.tsx @@ -0,0 +1,47 @@ +import { env } from "@/env" +import { useQuery } from "@tanstack/react-query" + +export interface Event { + id: number + name: string + description: string + location: string + food: string + event_start: number + event_end: number + event_start_string: string + registration_end: number + image_url: string + fee: number + registration_required: boolean + external_event_link: string + signup_questions: SignupQuestion[] + signup_link: string + can_create_teams: boolean + can_join_teams: boolean + open_for_signup: boolean +} + +export interface SignupQuestion { + id: number + type: string + question: string + required: boolean + options: string[] +} + +export async function fetchEvents(options?: RequestInit) { + const res = await fetch( + `${env.NEXT_PUBLIC_API_URL}/api/events`, + options ?? {} + ) + const result = await res.json() + return result as Event[] +} + +export function useEvents(options?: RequestInit) { + return useQuery({ + queryKey: ["events"], + queryFn: () => fetchEvents(options) + }) +}