Skip to content

Commit

Permalink
Merge branch 'beta' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Freeassassin authored Aug 18, 2023
2 parents 7cb771e + 3f9f4e5 commit 3da97ec
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 241 deletions.
18 changes: 13 additions & 5 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ import { AskQuestionButton } from './components/button/AskQuestionButton/AskQues
import { DarkModeProvider } from './util/DarkModeProvider';
import { SnackbarProvider } from './util/SnackbarProvider';

// import { getScuntSettings } from './state/scuntSettings/saga';
// import { scuntSettingsSelector } from './state/scuntSettings/scuntSettingsSlice';

import { getScuntSettings } from './state/scuntSettings/saga';
import { scuntSettingsSelector } from './state/scuntSettings/scuntSettingsSlice';


export default function App() {
const dispatch = useDispatch();
useEffect(() => {
dispatch(getUserInfo());
// dispatch(getScuntSettings());
dispatch(getScuntSettings());
}, []);

return (
Expand All @@ -39,15 +41,21 @@ const TransitionRoutes = () => {
const loggedIn = useSelector(loggedInSelector);
const registered = useSelector(registeredSelector);
const initials = useSelector(initialsSelector);
// const scuntSettings = useSelector(scuntSettingsSelector);
const scuntSettings = useSelector(scuntSettingsSelector);

return (
<TransitionGroup>
<Navbar isLoggedIn={loggedIn} froshInitials={initials} isRegistered={registered} />
<ScrollToTop />
<CSSTransition key={location.key} classNames="page" timeout={300}>
<Routes location={location}>
{[...pages.main, ...pages.hidden, ...pages.special].map((page) => {
{[
...pages.main,
...pages.hidden,
...pages.special,
...pages.scunt,
...pages.scuntHidden,
].map((page) => {
return (
<Route
path={page.path}
Expand Down
8 changes: 4 additions & 4 deletions client/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import userSaga from './state/user/saga';
import accountsSaga from './state/accounts/saga';
import announcementsSaga from './state/announcements/saga';
import froshSaga from './state/frosh/saga';
// import scuntSettingsSaga from './state/scuntSettings/saga';
// import scuntMissionsSaga from './state/scuntMissions/saga';
import scuntSettingsSaga from './state/scuntSettings/saga';
import scuntMissionsSaga from './state/scuntMissions/saga';

const store = configureAppStore();

sagaMiddleware.run(userSaga);
sagaMiddleware.run(accountsSaga);
sagaMiddleware.run(announcementsSaga);
sagaMiddleware.run(froshSaga);
// sagaMiddleware.run(scuntSettingsSaga);
// sagaMiddleware.run(scuntMissionsSaga);
sagaMiddleware.run(scuntSettingsSaga);
sagaMiddleware.run(scuntMissionsSaga);

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
Expand Down
124 changes: 62 additions & 62 deletions client/src/pages/Profile/PageProfileFrosh.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { QRNormal } from 'react-qrbtf';
import { Button } from '../../components/button/Button/Button';
import EditIcon from '../../assets/misc/pen-solid.svg';
import CampingIcon from '../../assets/misc/camping-tent.png';
// import { getScuntTeamObjFromTeamNumber } from '../ScuntJudgeForm/ScuntJudgeForm';
import { getScuntTeamObjFromTeamNumber } from '../ScuntJudgeForm/ScuntJudgeForm';
import { Link } from 'react-router-dom';
import { instagramAccounts } from '../../util/instagramAccounts';
import InstagramIcon from '../../assets/social/instagram-brands.svg';
// import NitelifeIcon from '../../assets/misc/nitelife.png';
// import ScuntIcon from '../../assets/misc/magnifier.png';
import NitelifeIcon from '../../assets/misc/nitelife.png';
import ScuntIcon from '../../assets/misc/magnifier.png';
import { useDispatch, useSelector } from 'react-redux';
import { registeredSelector, userSelector } from '../../state/user/userSlice';
import { announcementsSelector } from '../../state/announcements/announcementsSlice';
Expand All @@ -25,42 +25,42 @@ import {
import { DarkModeContext } from '../../util/DarkModeProvider';
import { SnackbarContext } from '../../util/SnackbarProvider';
import { completedAnnouncementsSelector } from '../../state/announcements/announcementsSlice';
// import { scuntSettingsSelector } from '../../state/scuntSettings/scuntSettingsSlice';
import { scuntSettingsSelector } from '../../state/scuntSettings/scuntSettingsSlice';
import useAxios from '../../hooks/useAxios';
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 { ProfilePageScuntToken } from '../../components/profile/scunt/ProfilePageScuntToken/ProfilePageScuntToken';
import { ProfilePageFroshScuntTeamsSelection } from '../../components/profile/scunt/ProfilePageFroshScuntTeamsSelection/ProfilePageFroshScuntTeamsSelection';
import { ProfilePageScuntToken } from '../../components/profile/scunt/ProfilePageScuntToken/ProfilePageScuntToken';

const { axios } = useAxios();

const PageProfileFrosh = () => {
const { user } = useSelector(userSelector);
// const [scuntTeams, setScuntTeams] = useState([]);
// const [scuntTeamObjs, setScuntTeamObjs] = useState();

// const getScuntTeams = async () => {
// try {
// const response = await axios.get('/scunt-teams');
// const { teamPoints } = response.data;
// if (teamPoints.length <= 0 || !teamPoints) setScuntTeams([]);
// else {
// setScuntTeamObjs(teamPoints);
// setScuntTeams(
// teamPoints.map((team) => {
// return team?.name;
// }),
// );
// }
// } catch (e) {
// setScuntTeams(['Error loading teams']);
// }
// };

// useEffect(() => {
// getScuntTeams();
// }, []);
const [scuntTeams, setScuntTeams] = useState([]);
const [scuntTeamObjs, setScuntTeamObjs] = useState();

const getScuntTeams = async () => {
try {
const response = await axios.get('/scunt-teams');
const { teamPoints } = response.data;
if (teamPoints.length <= 0 || !teamPoints) setScuntTeams([]);
else {
setScuntTeamObjs(teamPoints);
setScuntTeams(
teamPoints.map((team) => {
return team?.name;
}),
);
}
} catch (e) {
setScuntTeams(['Error loading teams']);
}
};

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

return (
<>
Expand All @@ -77,8 +77,8 @@ const PageProfileFrosh = () => {
<div style={{ display: 'flex', flexDirection: 'column' }}>
<ProfilePageQRCode />
{/* Remove scunt stuff for now! */}
{/* <ProfilePageScuntToken scuntTeamObjs={scuntTeamObjs} scuntTeams={scuntTeams} /> */}
{/* <ProfilePageFroshScuntTeamsSelection /> */}
<ProfilePageScuntToken scuntTeamObjs={scuntTeamObjs} scuntTeams={scuntTeams} />
<ProfilePageFroshScuntTeamsSelection />
<ProfilePageResources froshObject={user?.isRegistered ? user : null} />
</div>
</div>
Expand Down Expand Up @@ -177,37 +177,37 @@ export const ProfilePageRetreat = () => {
);
};

// export const ProfilePageFroshScuntMessage = () => {
// const { scuntSettings } = useSelector(scuntSettingsSelector);
// const { user } = useSelector(userSelector);
// const isRegistered = useSelector(registeredSelector);
// const { darkMode, setDarkModeStatus } = useContext(DarkModeContext);

// const code = user?.scuntToken;
// if (
// code === undefined ||
// !isRegistered ||
// !scuntSettings ||
// scuntSettings.length <= 0 ||
// scuntSettings[0]?.revealTeams === false
// ) {
// return <></>;
// }
export const ProfilePageFroshScuntMessage = () => {
const { scuntSettings } = useSelector(scuntSettingsSelector);
const { user } = useSelector(userSelector);
const isRegistered = useSelector(registeredSelector);
const { darkMode, setDarkModeStatus } = useContext(DarkModeContext);

const code = user?.scuntToken;
if (
code === undefined ||
!isRegistered ||
!scuntSettings ||
scuntSettings.length <= 0 ||
scuntSettings[0]?.revealTeams === false
) {
return <></>;
}

// return isRegistered ? (
// <Link to="/scunt">
// <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>
// </div>
// </div>
// </Link>
// ) : (
// <></>
// );
// };
return isRegistered ? (
<Link to="/scunt">
<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>
</div>
</div>
</Link>
) : (
<></>
);
};

const ProfilePageFroshHeader = ({ editButton }) => {
const { user } = useSelector(userSelector);
Expand Down
Loading

0 comments on commit 3da97ec

Please sign in to comment.