-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented admin checking and student counts on programs page #93
Conversation
Visit the preview URL for this PR (updated for commit bf3e2c2): https://pia-dev-60cea--pr93-feature-andrewzpu-pr-q2iz3a1t.web.app (expires Wed, 01 May 2024 18:47:22 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: b780ee12a240535f7ca0729d49968573a1f3e284 |
@@ -19,6 +21,10 @@ export default function Programs() { | |||
|
|||
const [programs, setPrograms] = useState<ProgramMap>({}); | |||
|
|||
const { firebaseUser, piaUser, loadingUser } = useContext(UserContext); | |||
const _loadingUser = loadingUser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you need this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it originally because I had an error for unused variable, but I don't think I need loadingUser anyways, so I'll remove that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah gotcha, also I just put up a PR (#94) where I put isAdmin
into the userContext so you could just grab that here if you want:
const { isAdmin } = useContext(UserContext);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once Parth's PR is in lets add that line so that we can maintain consistency.
frontend/src/pages/programs.tsx
Outdated
|
||
export default function Programs() { | ||
useRedirectToLoginIfNotSignedIn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think they should be redirected to login if they are not signed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! Just a few minor changes and it should be good to merge.
frontend/src/pages/programs.tsx
Outdated
|
||
export default function Programs() { | ||
useRedirectToLoginIfNotSignedIn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
@@ -19,6 +21,10 @@ export default function Programs() { | |||
|
|||
const [programs, setPrograms] = useState<ProgramMap>({}); | |||
|
|||
const { firebaseUser, piaUser, loadingUser } = useContext(UserContext); | |||
const _loadingUser = loadingUser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once Parth's PR is in lets add that line so that we can maintain consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
Tracking Info
Resolves #31
Part of #90
Changes
Added student counts to program cards in program page
Added admin checking to program page so certain features only appear for admins:
Testing
Ran website locally using our existing admin and non-admin accounts
Confirmation of Change
Admin view:
![image](https://private-user-images.githubusercontent.com/66804382/324623900-801854f2-5b9c-4405-a5a8-0e288212eb12.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NjAyNjgsIm5iZiI6MTczOTY1OTk2OCwicGF0aCI6Ii82NjgwNDM4Mi8zMjQ2MjM5MDAtODAxODU0ZjItNWI5Yy00NDA1LWE1YTgtMGUyODgyMTJlYjEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDIyNTI0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0MmIwYjc0NDNjYmFlZjc4OGIxZD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