Skip to content

Commit

Permalink
Merge branch 'dev' into 744-scunt-popup-name-change
Browse files Browse the repository at this point in the history
  • Loading branch information
Freeassassin authored Sep 3, 2023
2 parents b8e8894 + b33e4d6 commit 9dabab6
Show file tree
Hide file tree
Showing 35 changed files with 585 additions and 246 deletions.
Binary file added client/src/assets/judges/alexi.jpg
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 client/src/assets/judges/amelie.jpg
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 client/src/assets/judges/ben.jpg
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 client/src/assets/judges/celin.jpg
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 client/src/assets/judges/emaan.jpg
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 client/src/assets/judges/erika.jpg
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 client/src/assets/judges/jeremy.jpg
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 client/src/assets/judges/kaija.jpeg
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 client/src/assets/judges/karen.jpg
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 client/src/assets/judges/katie.jpg
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 client/src/assets/judges/khalil.jpg
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 client/src/assets/judges/luka.jpg
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 client/src/assets/judges/nat.jpg
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 client/src/assets/judges/novera.jpg
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 client/src/assets/judges/rimjot.jpg
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 client/src/assets/judges/tanya.jpg
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 client/src/assets/judges/tech.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion client/src/components/ScuntLinks/ScuntLinks.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import { pages } from '../../util/pages';
import { ButtonOutlined } from '../button/ButtonOutlined/ButtonOutlined';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
preKitPickUp,
searchFroshList,
clearFroshList,
getFood,
} from '../../../../state/frosh/saga';
import PropTypes from 'prop-types';
import { capitalizeFirstLetter } from '../../../../pages/Profile/functions';
Expand All @@ -29,6 +30,8 @@ export const ProfilePageQRScanner = ({ scopes }) => {
setScannerType('registration');
} else if (scopes?.includes('scanner:kits')) {
setScannerType('kits');
} else if (scopes?.includes('scanner:food')) {
setScannerType('food');
}
}, [scopes]);

Expand Down Expand Up @@ -91,6 +94,20 @@ export const ProfilePageQRScanner = ({ scopes }) => {
)}
</>
);
case 'food':
return (
<>
{frosh['gotFood'] ? (
<div style={{ color: 'black' }}>
<ErrorSuccessBox error content={'Food already picked up'} />
</div>
) : (
<div style={{ color: 'black' }}>
<ErrorSuccessBox success content={'Food picked up!'} />
</div>
)}
</>
);
}
};

Expand All @@ -104,6 +121,8 @@ export const ProfilePageQRScanner = ({ scopes }) => {
dispatch(signInFrosh({ userID }));
} else if (scannerType === 'kits') {
dispatch(preKitPickUp({ userID }));
} else if (scannerType === 'food') {
dispatch(getFood({ userID }));
}
}
}}
Expand All @@ -126,9 +145,16 @@ export const ProfilePageQRScanner = ({ scopes }) => {
{Object.keys(frosh).map((keyPassed) => {
const key = keyPassed.toString();
return (
!['_id', 'signInDate', 'userType', 'firstName', 'preferredName', 'preKit'].includes(
key,
) && (
![
'_id',
'signInDate',
'userType',
'firstName',
'preferredName',
'preKit',
'isRegistered',
'gotFood',
].includes(key) && (
<div key={key}>
<b>{capitalizeFirstLetter(key) + ': '}</b>
{frosh[key]?.toString()}
Expand Down Expand Up @@ -179,6 +205,8 @@ export const ProfilePageQRScanner = ({ scopes }) => {
dispatch(signInFrosh({ userID: searchResultFrosh._id }));
} else if (scannerType === 'kits') {
dispatch(preKitPickUp({ userID: searchResultFrosh._id }));
} else if (scannerType === 'food') {
dispatch(getFood({ userID: searchResultFrosh._id }));
}
}}
key={searchResultFrosh.email + index}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,62 @@ import { getScuntTeamObjFromTeamNumber } from '../../../../pages/ScuntJudgeForm/
import { scuntDiscord } from '../../../../util/scunt-constants';
import { scuntTeamsSelector } from '../../../../state/scuntTeams/scuntTeamsSlice';

export const ProfilePageScuntToken = () => {
const { scuntSettings } = useSelector(scuntSettingsSelector);
const { user } = useSelector(userSelector);
const { scuntTeams } = useSelector(scuntTeamsSelector);
const isRegistered = useSelector(registeredSelector);
const { setSnackbar } = useContext(SnackbarContext);
const [showToken, setShowToken] = useState(false);
// export const ProfilePageScuntToken = () => {
// const { scuntSettings } = useSelector(scuntSettingsSelector);
// const { user } = useSelector(userSelector);
// const { scuntTeams } = useSelector(scuntTeamsSelector);
// const isRegistered = useSelector(registeredSelector);
// const { setSnackbar } = useContext(SnackbarContext);
// const [showToken, setShowToken] = useState(false);
// if (!isRegistered || (scuntSettings && !scuntSettings?.revealTeams)) {
// return null;
// }

const code = user?.scuntToken;
if (code === undefined || !isRegistered || (scuntSettings && !scuntSettings?.revealTeams)) {
return null;
}
// if (!user?.attendingScunt && user?.userType !== 'leadur') {
// return (
// <div className="profile-page-scunt-token profile-page-side-section">
// <p>
// <b>Looking for your Scunt login Token?</b>
// </p>
// <p>You have chosen not to participate in Scunt.</p>
// <div style={{ height: '30px' }} />
// </div>
// );
// }
// return (
// <div className="profile-page-scunt-token profile-page-side-section">
// <h2>{getScuntTeamObjFromTeamNumber(user?.scuntTeam, scuntTeams)?.name}</h2>
// <i>
// <h4>Team {user?.scuntTeam ? user?.scuntTeam.toString() : '‽'}</h4>
// </i>
// <h3
// style={{ filter: showToken ? '' : 'blur(10px)' }}
// onClick={() => {
// navigator.clipboard.writeText(code);
// setSnackbar('Copied to clipboard');
// }}
// >
// {code}
// </h3>
// <p>Scunt Login Token</p>
// <p style={{ fontSize: '13px' }}>
// Use this token to login to the{' '}
// <a href={scuntDiscord} target="_blank" rel="noreferrer">
// Scunt Discord
// </a>
// </p>
// <ButtonOutlined
// isSecondary={showToken}
// label={showToken ? 'Hide' : 'Show'}
// onClick={() => {
// setShowToken(!showToken);
// }}
// />
// </div>
// );
// };

if (!user?.attendingScunt && user?.userType !== 'leadur') {
return (
<div className="profile-page-scunt-token profile-page-side-section">
<p>
<b>Looking for your Scunt login Token?</b>
</p>
<p>You have chosen not to participate in Scunt.</p>
<div style={{ height: '30px' }} />
</div>
);
}
return (
<div className="profile-page-scunt-token profile-page-side-section">
<h2>{getScuntTeamObjFromTeamNumber(user?.scuntTeam, scuntTeams)?.name}</h2>
<i>
<h4>Team {user?.scuntTeam ? user?.scuntTeam.toString() : '‽'}</h4>
</i>
<h3
style={{ filter: showToken ? '' : 'blur(10px)' }}
onClick={() => {
navigator.clipboard.writeText(code);
setSnackbar('Copied to clipboard');
}}
>
{code}
</h3>
<p>Scunt Login Token</p>
<p style={{ fontSize: '13px' }}>
Use this token to login to the{' '}
<a href={scuntDiscord} target="_blank" rel="noreferrer">
Scunt Discord
</a>
</p>
<ButtonOutlined
isSecondary={showToken}
label={showToken ? 'Hide' : 'Show'}
onClick={() => {
setShowToken(!showToken);
}}
/>
</div>
);
};

ProfilePageScuntToken.propTypes = {
scuntTeams: PropTypes.array,
scuntTeamObjs: PropTypes.array,
};
// ProfilePageScuntToken.propTypes = {
// scuntTeams: PropTypes.array,
// scuntTeamObjs: PropTypes.array,
// };
41 changes: 25 additions & 16 deletions client/src/pages/Profile/PageProfileFrosh.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { scuntSettingsSelector } from '../../state/scuntSettings/scuntSettingsSl
import { getRemainingTickets } from '../FroshRetreat/FroshRetreat';
import { ProfilePageSchedule } from '../../components/profile/ProfilePageSchedule/ProfilePageSchedule';
import { ProfilePageResources } from '../../components/profile/ProfilePageResources/ProfilePageResources';
import { ProfilePageFroshScuntTeamsSelection } from '../../components/profile/scunt/ProfilePageFroshScuntTeamsSelection/ProfilePageFroshScuntTeamsSelection';
// import { ProfilePageFroshScuntTeamsSelection } from '../../components/profile/scunt/ProfilePageFroshScuntTeamsSelection/ProfilePageFroshScuntTeamsSelection';
import { getScuntTeams } from '../../state/scuntTeams/saga';
import { getScuntSettings } from '../../state/scuntSettings/saga';
import { scuntTeamsSelector } from '../../state/scuntTeams/scuntTeamsSlice';
Expand All @@ -42,16 +42,18 @@ const PageProfileFrosh = () => {
const dispatch = useDispatch();

useEffect(() => {
dispatch(getScuntSettings());
dispatch(getScuntTeams());
}, [dispatch]);
if (user?.attendingScunt) {
dispatch(getScuntSettings());
dispatch(getScuntTeams());
}
}, [dispatch, user]);

return (
<>
<ProfilePageFroshHeader editButton={true} />
<div className="profile-info-row">
<div className="profile-info-row-right">
<ProfilePageFroshScuntMessage />
{user?.attendingScunt === true ? <ProfilePageFroshScuntMessage /> : null}
{isRegistered ? <ProfilePageRetreat /> : null}
{/* <ProfilePageNitelife /> */}
<ProfilePageInstagrams />
Expand All @@ -61,9 +63,9 @@ const PageProfileFrosh = () => {
<div style={{ display: 'flex', flexDirection: 'column' }}>
<ProfilePageQRCode />
{/* <ProfilePageScuntToken scuntTeamObjs={scuntTeamObjs} scuntTeams={scuntTeams} /> not doing discord */}
<ProfilePageScuntTeam />
<ProfilePageFroshScuntTeamsSelection />
<ProfilePageResources froshObject={user?.isRegistered ? user : null} />
{user?.attendingScunt ? <ProfilePageScuntTeam /> : null}
{/* <ProfilePageFroshScuntTeamsSelection /> */}
<ProfilePageResources froshObject={isRegistered ? user : null} />
</div>
</div>
</>
Expand Down Expand Up @@ -164,8 +166,7 @@ const ProfilePageFroshScuntMessage = () => {
const isRegistered = useSelector(registeredSelector);
const { darkMode } = useContext(DarkModeContext);

const code = user?.scuntToken;
if (code === undefined || !isRegistered || !scuntSettings || !scuntSettings?.revealTeams) {
if (!isRegistered || !scuntSettings || !scuntSettings?.revealTeams) {
return null;
}

Expand All @@ -174,8 +175,8 @@ const ProfilePageFroshScuntMessage = () => {
<div className="frosh-instagram-container">
<img src={ScuntIcon} alt="Scunt" style={{ filter: darkMode ? 'invert(1)' : 'unset' }} />
<div>
<h2>Havenger Scunt!</h2>
<p>Find more information about Scunt by clicking here!</p>
<h2>SkavENGer Hunt!</h2>
<p>Find more information about The Hunt by clicking here!</p>
</div>
</div>
</Link>
Expand Down Expand Up @@ -425,22 +426,30 @@ const ProfilePageQRCode = () => {
);
};

const ProfilePageScuntTeam = () => {
export const ProfilePageScuntTeam = () => {
const isRegistered = useSelector(registeredSelector);
const { scuntSettings } = useSelector(scuntSettingsSelector);
const { scuntTeams } = useSelector(scuntTeamsSelector);
const { user } = useSelector(userSelector);
const [scuntTeam, setScuntTeam] = useState();
const [scuntTeam, setScuntTeam] = useState(null);

const dispatch = useDispatch();

useEffect(() => {
dispatch(getScuntSettings());
dispatch(getScuntTeams());
}, [dispatch]);

if (!isRegistered || !scuntSettings || !scuntSettings?.revealTeams) return null;
useEffect(() => {
if (scuntTeams?.length) {
const [team] = scuntTeams.filter((team) => {
return team.number === user?.scuntTeam;
return team?.number === user?.scuntTeam;
});
setScuntTeam(team);
}
}, [scuntTeams]);

if (!isRegistered || !scuntSettings || !scuntSettings?.revealTeams) return null;
return (
<div className="profile-page-scunt-team profile-page-side-section">
<h3>Your Scunt Team:</h3>
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/Profile/PageProfileLeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const PageProfileLeader = () => {
const { user } = useSelector(userSelector);
const qrCodeLeader =
user?.authScopes?.approved.includes('scanner:registration') ||
user?.authScopes?.approved.includes('scanner:kits');
user?.authScopes?.approved.includes('scanner:kits') ||
user?.authScopes?.approved.includes('scanner:food');

const dispatch = useDispatch();

Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/ScopeRequest/functions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const getTotalScopes = () => {
accounts: ['read', 'edit', 'delete'],
email: ['send'],
timeline: ['create', 'edit', 'delete'],
scanner: ['registration', 'kits'],
scanner: ['registration', 'kits', 'food'],
scunt: [
'judge missions',
'judge bribe points',
Expand Down
Loading

0 comments on commit 9dabab6

Please sign in to comment.