diff --git a/src/app/dashboard/[hackathonId]/applications/[applicationId]/detail/page.tsx b/src/app/dashboard/[hackathonId]/applications/[applicationId]/detail/page.tsx index e4f74fe..a27766e 100644 --- a/src/app/dashboard/[hackathonId]/applications/[applicationId]/detail/page.tsx +++ b/src/app/dashboard/[hackathonId]/applications/[applicationId]/detail/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import requireOrganizer from "@/services/helpers/requireOrganizer"; import { Metadata } from "next"; import ApplicationDetailCard from "@/scenes/Dashboard/scenes/ApplicationDetail/ApplicationDetailCard"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Application detail", @@ -13,6 +14,7 @@ const ApplicationDetailPage = async ({ params: { applicationId: string; hackathonId: string }; }) => { await requireOrganizer(); + await disallowVolunteer(params.hackathonId); return ( { + await disallowVolunteer(hackathonId); return ; }; diff --git a/src/app/dashboard/[hackathonId]/applications/review/page.tsx b/src/app/dashboard/[hackathonId]/applications/review/page.tsx index 2e19265..9361bcd 100644 --- a/src/app/dashboard/[hackathonId]/applications/review/page.tsx +++ b/src/app/dashboard/[hackathonId]/applications/review/page.tsx @@ -1,16 +1,18 @@ import React from "react"; import { Metadata } from "next"; import ApplicationReview from "@/scenes/Dashboard/scenes/ApplicationReview/ApplicationReview"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Review applications", }; -const Page = ({ +const Page = async ({ params: { hackathonId }, }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); return ; }; diff --git a/src/app/dashboard/[hackathonId]/form-editor/page.tsx b/src/app/dashboard/[hackathonId]/form-editor/page.tsx index e9594d0..33f084b 100644 --- a/src/app/dashboard/[hackathonId]/form-editor/page.tsx +++ b/src/app/dashboard/[hackathonId]/form-editor/page.tsx @@ -3,6 +3,7 @@ import { Metadata } from "next"; import ApplicationFormEditor from "@/scenes/Dashboard/scenes/ApplicationFormEditor/ApplicationFormEditor"; import getApplicationFormSteps from "@/server/getters/dashboard/applicationFormEditor/applicationFormSteps"; import requireAdmin from "@/services/helpers/requireAdmin"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Edit application form", @@ -13,6 +14,7 @@ const FormEditorPage = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); const applicationFormSteps = await getApplicationFormSteps( Number(hackathonId) diff --git a/src/app/dashboard/[hackathonId]/form-editor/step/[stepId]/edit/page.tsx b/src/app/dashboard/[hackathonId]/form-editor/step/[stepId]/edit/page.tsx index 41db742..a334a8f 100644 --- a/src/app/dashboard/[hackathonId]/form-editor/step/[stepId]/edit/page.tsx +++ b/src/app/dashboard/[hackathonId]/form-editor/step/[stepId]/edit/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Metadata } from "next"; import FormStepEditor from "@/scenes/Dashboard/scenes/ApplicationFormEditor/scenes/EditStepForm/FormStepEditor"; import requireAdmin from "@/services/helpers/requireAdmin"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Edit application form step", @@ -12,6 +13,7 @@ const FormEditorStepPage = async ({ }: { params: { stepId: string; hackathonId: string }; }) => { + await disallowVolunteer(params.hackathonId); await requireAdmin(); return ( diff --git a/src/app/dashboard/[hackathonId]/judging/manage/page.tsx b/src/app/dashboard/[hackathonId]/judging/manage/page.tsx index ffd0cd7..2cfcfd2 100644 --- a/src/app/dashboard/[hackathonId]/judging/manage/page.tsx +++ b/src/app/dashboard/[hackathonId]/judging/manage/page.tsx @@ -4,6 +4,7 @@ import requireAdmin from "@/services/helpers/requireAdmin"; import JudgingManager from "@/scenes/Dashboard/scenes/Judging/scenes/JudgingManager/JudgingManager"; import getJudges from "@/server/getters/dashboard/judging/getJudges"; import getTeamsForJudging from "@/server/getters/dashboard/judging/getTeamsForJudging"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Judging manager", @@ -14,6 +15,7 @@ const Page = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); const judges = await getJudges(Number(hackathonId)); const teamsForJudging = await getTeamsForJudging(Number(hackathonId)); diff --git a/src/app/dashboard/[hackathonId]/judging/page.tsx b/src/app/dashboard/[hackathonId]/judging/page.tsx index 2e0a9f1..58ad71e 100644 --- a/src/app/dashboard/[hackathonId]/judging/page.tsx +++ b/src/app/dashboard/[hackathonId]/judging/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Metadata } from "next"; import requireOrganizer from "@/services/helpers/requireOrganizer"; import Judging from "@/scenes/Dashboard/scenes/Judging/Judging"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Judging", @@ -12,6 +13,7 @@ const Page = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireOrganizer(); return ; }; diff --git a/src/app/dashboard/[hackathonId]/judging/results/page.tsx b/src/app/dashboard/[hackathonId]/judging/results/page.tsx index 0d7176b..1b02ef3 100644 --- a/src/app/dashboard/[hackathonId]/judging/results/page.tsx +++ b/src/app/dashboard/[hackathonId]/judging/results/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Metadata } from "next"; import requireAdmin from "@/services/helpers/requireAdmin"; import JudgingResults from "@/scenes/Dashboard/scenes/Judging/scenes/JudgingResults/JudgingResults"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Judging manager", @@ -12,6 +13,7 @@ const Page = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); return ; }; diff --git a/src/app/dashboard/[hackathonId]/page.tsx b/src/app/dashboard/[hackathonId]/page.tsx index 20cad48..29d853b 100644 --- a/src/app/dashboard/[hackathonId]/page.tsx +++ b/src/app/dashboard/[hackathonId]/page.tsx @@ -1,5 +1,6 @@ import HackathonInfo from "@/scenes/Dashboard/scenes/HackathonInfo/HackathonInfo"; import requireAdmin from "@/services/helpers/requireAdmin"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; const HackathonDashboardPage = async ({ params: { hackathonId }, @@ -8,6 +9,7 @@ const HackathonDashboardPage = async ({ hackathonId: string; }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); return ; }; diff --git a/src/app/dashboard/[hackathonId]/settings/page.tsx b/src/app/dashboard/[hackathonId]/settings/page.tsx index 7179da4..5b464d1 100644 --- a/src/app/dashboard/[hackathonId]/settings/page.tsx +++ b/src/app/dashboard/[hackathonId]/settings/page.tsx @@ -4,6 +4,7 @@ import requireAdmin from "@/services/helpers/requireAdmin"; import getAdminInfo from "@/server/getters/dashboard/settings/adminInfo"; import getMaxTeamSize from "@/server/getters/dashboard/settings/maxTeamSize"; import getSponsorsInfo from "@/server/getters/dashboard/settings/sponsorsInfo"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata = { title: "Settings", @@ -14,6 +15,7 @@ const SettingsPage = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(params.hackathonId); const hackathonId = Number(params.hackathonId); await requireAdmin(); const { description } = await getTravelReimbursementRequestDescription( diff --git a/src/app/dashboard/[hackathonId]/settings/vote-parameters/page.tsx b/src/app/dashboard/[hackathonId]/settings/vote-parameters/page.tsx index 2fb5ec7..4ea7ec8 100644 --- a/src/app/dashboard/[hackathonId]/settings/vote-parameters/page.tsx +++ b/src/app/dashboard/[hackathonId]/settings/vote-parameters/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Metadata } from "next"; import VoteParameterManager from "@/scenes/Dashboard/scenes/VoteParameterManager/VoteParameterManager"; import requireAdmin from "@/services/helpers/requireAdmin"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Settings | Vote parameters", @@ -12,6 +13,7 @@ const Page = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); return ; }; diff --git a/src/app/dashboard/[hackathonId]/tables/page.tsx b/src/app/dashboard/[hackathonId]/tables/page.tsx index d635850..d9c5dac 100644 --- a/src/app/dashboard/[hackathonId]/tables/page.tsx +++ b/src/app/dashboard/[hackathonId]/tables/page.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Metadata } from "next"; import requireAdmin from "@/services/helpers/requireAdmin"; import TablesManager from "@/scenes/Dashboard/scenes/TablesManager/TablesManager"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata: Metadata = { title: "Teams & Tables", @@ -12,6 +13,7 @@ const Page = async ({ }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); await requireAdmin(); return ; }; diff --git a/src/app/dashboard/[hackathonId]/travel-reimbursements/page.tsx b/src/app/dashboard/[hackathonId]/travel-reimbursements/page.tsx index 6e26b98..e066ff6 100644 --- a/src/app/dashboard/[hackathonId]/travel-reimbursements/page.tsx +++ b/src/app/dashboard/[hackathonId]/travel-reimbursements/page.tsx @@ -1,14 +1,16 @@ import React from "react"; import TravelReimbursementsList from "@/scenes/Dashboard/scenes/TravelReimbursements/TravelReimbursementsList"; +import { disallowVolunteer } from "@/services/helpers/disallowVolunteer"; export const metadata = { title: "Travel reimbursements", }; -const TravelReimbursementsPage = ({ +const TravelReimbursementsPage = async ({ params: { hackathonId }, }: { params: { hackathonId: string }; }) => { + await disallowVolunteer(hackathonId); return ; }; diff --git a/src/scenes/Dashboard/scenes/HackathonDashboardLayout/HackathonDashboardLayout.tsx b/src/scenes/Dashboard/scenes/HackathonDashboardLayout/HackathonDashboardLayout.tsx index d3ce62f..82da232 100644 --- a/src/scenes/Dashboard/scenes/HackathonDashboardLayout/HackathonDashboardLayout.tsx +++ b/src/scenes/Dashboard/scenes/HackathonDashboardLayout/HackathonDashboardLayout.tsx @@ -12,11 +12,16 @@ const HackathonDashboardLayout = async ({ children, }: HackathonDashboardProps) => { const session = await getServerSession(authOptions); + + // This is a hack to allow volunteers to access the dashboard + const isVolunteersEmail = + session?.user?.email === "volunteers@hackkosice.com"; return (
{children}
diff --git a/src/scenes/Dashboard/scenes/HackathonDashboardLayout/components/DashboardTabs.tsx b/src/scenes/Dashboard/scenes/HackathonDashboardLayout/components/DashboardTabs.tsx index 8230c55..73e3c3c 100644 --- a/src/scenes/Dashboard/scenes/HackathonDashboardLayout/components/DashboardTabs.tsx +++ b/src/scenes/Dashboard/scenes/HackathonDashboardLayout/components/DashboardTabs.tsx @@ -7,6 +7,7 @@ import { usePathname, useRouter } from "next/navigation"; type DashboardTabsProps = { hackathonId: number; isAdmin: boolean; + isVolunteer: boolean; }; type TabValue = @@ -36,7 +37,11 @@ const getTabValue = ( return undefined; }; -const DashboardTabs = ({ hackathonId, isAdmin }: DashboardTabsProps) => { +const DashboardTabs = ({ + hackathonId, + isAdmin, + isVolunteer, +}: DashboardTabsProps) => { const path = usePathname(); const { push } = useRouter(); @@ -77,6 +82,8 @@ const DashboardTabs = ({ hackathonId, isAdmin }: DashboardTabsProps) => { setTabValue(getTabValue(path, hackathonId)); }, [path, hackathonId]); + if (isVolunteer) return
; + return ( { + const session = await getServerSession(authOptions); + + if (!session) { + redirect("/application"); + return; + } + + const isVolunteerEmail = session.user?.email === "volunteers@hackkosice.com"; + + if (isVolunteerEmail) { + redirect(`/dashboard/${hackathonId}/check-in`); + return; + } +};