From 1d037d140a14ceff63f2fa481a286ab44de4a5f1 Mon Sep 17 00:00:00 2001 From: Het Patel Date: Sun, 6 Oct 2024 23:01:21 -0400 Subject: [PATCH] logout while in organizer view --- app/dashboard/page.tsx | 2 +- app/dashboard/views/organizerView.tsx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index c32b311..a51b5cb 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -184,7 +184,7 @@ export default function Dashboard() { data.set('file', waiverFile); const requiredFields = ["first_name","last_name","resume","github","major","short_answer","shirt_size","hackathon_count","dietary_restrictions","special_needs","age","school","grad_year","gender","level_of_study","country_of_residence","ethnicity","how_you_heard_about_hackru","reasons","phone_number"] const fieldtext = ["First Name", "Last Name", "Resume", "Github", "major", "What are you hoping to experience at HackRU?", "Shirt Size", "Hackathon Count", "Dietary Restrictions", "Anything we should account for?", - 'age', "schhool", "Graduation Year", "Gender", "Level of Study", "Country of Residence", "Ethnicity", "How you heard about hackru", "reasons for attending", "phone number" + 'age', "school", "Graduation Year", "Gender", "Level of Study", "Country of Residence", "Ethnicity", "How you heard about hackru", "reasons for attending", "phone number" ] for (let i = 0; i < requiredFields.length; i++) { if (!userData[requiredFields[i]]){ diff --git a/app/dashboard/views/organizerView.tsx b/app/dashboard/views/organizerView.tsx index 0fcf7eb..2aaba78 100644 --- a/app/dashboard/views/organizerView.tsx +++ b/app/dashboard/views/organizerView.tsx @@ -8,6 +8,7 @@ import EventScan from './eventScan'; import { AttendEventScan, GetUser, SetUser } from '@/app/lib/actions'; import PopupDialog from '../components/dialog'; import { set } from 'zod'; +import Page from '@/app/(pre-dashboard)/(landing)/page'; type STATUS = | 'SUCCESSFUL' @@ -107,6 +108,7 @@ function OrganizerView() { const [houseOfScannedUser, setHouseOfScannedUser] = useState(''); const [scannedName, setScannedName] = useState(''); const [confirmation, setConfirmation] = useState(false); + const [isLoggedIn, setIsLoggedIn] = useState(true); const resetScanLog = () => { setScannedName(''); @@ -115,6 +117,14 @@ function OrganizerView() { setStatus('AWAITING SCAN'); }; + const logout = () => { + setIsLoggedIn(false); + } + + if(!isLoggedIn) { + return //render page is user is not logged in + } + const handleOnScan = async ( result: string, forceAttendance: boolean = false, @@ -231,6 +241,13 @@ function OrganizerView() { Event + + {showForceAttendance && (