Skip to content
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

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

andrewzpu
Copy link
Contributor

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:

  • Team members no longer have access to add program button at top of programs page
  • Team members no longer have access to edit program button on each program card

Testing

Ran website locally using our existing admin and non-admin accounts

Confirmation of Change

Admin view:
image

Team member view:
image

Copy link

github-actions bot commented Apr 22, 2024

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;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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);

Copy link
Member

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.


export default function Programs() {
useRedirectToLoginIfNotSignedIn();
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

Copy link
Member

@adhi0331 adhi0331 left a 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.


export default function Programs() {
useRedirectToLoginIfNotSignedIn();
Copy link
Member

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;
Copy link
Member

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.

Copy link
Member

@adhi0331 adhi0331 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@adhi0331 adhi0331 merged commit d1d1ff5 into main Apr 24, 2024
4 checks passed
@adhi0331 adhi0331 deleted the feature/andrewzpu/program-page-admin-view branch April 24, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[View All Programs Page] - Create Program card components to show all necessary information about a program
3 participants