Skip to content

Commit

Permalink
Merge branch 'main' into 182-lockout-buttons-that-take-some-time-do-s…
Browse files Browse the repository at this point in the history
…omething-login-signup-register
  • Loading branch information
sanasnaik authored Oct 13, 2024
2 parents 6ee8915 + a1d5230 commit 89d6b62
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 34 deletions.
8 changes: 6 additions & 2 deletions app/(pre-dashboard)/(landing)/sections/Sponsors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ export default async function Sponsors() {
const sponsors = [
'/sponsors/NJTRANSIT.png',
'/sponsors/RHNIC_RED_WHITE_RBG.png',
'/sponsors/CAIT2.png'
'/sponsors/CAIT2.png',
'/sponsors/iCIMSWhite.png',
'/sponsors/redbull.png'
];

const sponsorsLinks = [
'https://www.njtransit.com/innovation',
'https://www.canva.com/design/DAGSRyhN4jE/q65xcClKrYfxJka-VgXBwA/watch?utm_content=DAGSRyhN4jE&utm_campaign=share_your_design&utm_medium=link&utm_source=shareyourdesignpanel',
'https://cait.rutgers.edu/about/'
'https://cait.rutgers.edu/about/',
'https://www.icims.com',
'https://www.redbull.com/us-en'
];

return (
Expand Down
50 changes: 26 additions & 24 deletions app/dashboard/page.tsx

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions app/dashboard/views/organizerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -107,6 +108,7 @@ function OrganizerView() {
const [houseOfScannedUser, setHouseOfScannedUser] = useState<string>('');
const [scannedName, setScannedName] = useState<string>('');
const [confirmation, setConfirmation] = useState<boolean>(false);
const [isLoggedIn, setIsLoggedIn] = useState(true);

const resetScanLog = () => {
setScannedName('');
Expand All @@ -115,6 +117,14 @@ function OrganizerView() {
setStatus('AWAITING SCAN');
};

const logout = () => {
setIsLoggedIn(false);
}

if(!isLoggedIn) {
return <Page /> //render page is user is not logged in
}

const handleOnScan = async (
result: string,
forceAttendance: boolean = false,
Expand Down Expand Up @@ -231,6 +241,13 @@ function OrganizerView() {
Event
</button>
</div>

<button
className='mt-2 rounded bg-red-500 px-4 py-2 font-bold text-white hover:bg-red-700'
onClick={logout}
>
Logout
</button>
</div>
{showForceAttendance && (
<PopupDialog
Expand Down
11 changes: 7 additions & 4 deletions app/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function authenticate(email: string, password: string) {
case 'CredentialsSignin':
return 'Invalid credentials.';
default:
return 'Something went wrong.';
return error.message;
}
}
redirect('/dashboard');
Expand Down Expand Up @@ -193,7 +193,7 @@ export async function SignUp(
case 'CredentialsSignin':
resp.error = 'Invalid credentials.';
default:
resp.error = 'Something went wrong.';
resp.error = error.message;
}
}
}
Expand Down Expand Up @@ -285,12 +285,15 @@ export async function SetUser(data: any, user_email_to_update: string) {
.then(async (res) => {
let resJSON = await res.json();
if (resJSON.statusCode !== 200) {
if (resJSON.body) {
resp.error = resJSON.body;
if (resJSON?.error) {
resp.error = resJSON.error;
} else {
resp.error = 'Unexpected Error';
}
}
else{
resp.response = resJSON.message;
}
})
.catch((error) => {
resp.error = error + '; An error occurred retrieving data';
Expand Down
4 changes: 1 addition & 3 deletions app/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ export async function RegisterSelf() {
return resp.error;
}

return {
error: 'Something went wrong',
};
return 'Something went wrong';
}

export async function ConfirmComingOrNot(isComing: boolean): Promise<{
Expand Down
4 changes: 3 additions & 1 deletion public/schools.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ RMK College of Engineering
RNS Institute of Technology
Robbinsville High School
Robert Gordon University
Robert Wood Johnson Medical School
Rochester Institute of Technology
Rock Ridge High School
Roger Williams University
Expand All @@ -1465,7 +1466,8 @@ Rustamji Institute of Technology
Rutgers Preparatory School
Rutgers University - Newark
Rutgers University – Camden
"Rutgers, The State University of New Jersey"
"Rutgers, The State University of New Jersey"\
Rutgers New Jersey Medical School
Ryde School
Rye High School
Ryerson University
Expand Down
Binary file added public/sponsors/iCIMSWhite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sponsors/redbull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 89d6b62

Please sign in to comment.