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

Cindyrzheng/frontend #25

Merged
merged 3 commits into from
Jan 30, 2022
Merged

Cindyrzheng/frontend #25

merged 3 commits into from
Jan 30, 2022

Conversation

cindyrzheng
Copy link
Collaborator

Adding some views for student and professor that is an overview of a class.

Copy link
Collaborator

@krashanoff krashanoff left a comment

Choose a reason for hiding this comment

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

Hey Cindy, thank you for starting on the frontend. This looks good. I raised a little nitpick about React's TS API in the attached thread that might be worth considering.

Only major comment is that I think the student and professor assignment views aren't doing themselves any favors by being separated in the codebase.

faculty class view

student class view

They are so similar that I think we should just refactor them into a single ClassView component that we adjust the appearance of based on application state. For now, we can just make the appearance change based on some props passed to the component, but in the future, we should handle the application state with a context provider or something similar. Maybe cookies. Let me know what you think!

import { Link } from "react-router-dom";

//A card representing a single assignment overview
const StudentAssignmentCard = (props:{name:string}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not so much a review comment, but what are your thoughts on use of React.FC?

Suggested change
const StudentAssignmentCard = (props:{name:string}) => {
const StudentAssignmentCard: React.FC<{name: string}> = ({name}) => {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

never used it before, is it preferrable to use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

didn't end up using it but i am open to changing it later!

@@ -0,0 +1,34 @@
import React, { useState } from "react";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than create a separate assignment card for professors and students, how about we just create a single component that renders based on a property mode = student | faculty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya I can do that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Im not super happy with the const stuff I did but I think I'll fix things up once we get something like local storage set up for a logged in user!

Comment on lines 23 to 25
<Route path="/professor/class/addassignment">
<Route index element={<AddAssignmentView />} />
</Route>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is okay for now, but I think in the future we will need to refactor our AddAssignmentView to something akin to a modal to avoid cluttering our app routes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok! lmk when we get to that and then we can work on adding a modal

Copy link
Collaborator

@1strangequark 1strangequark left a comment

Choose a reason for hiding this comment

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

LGTM

@cindyrzheng cindyrzheng merged commit 9c79afa into main Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants