Skip to content

Conversation

@GauriRajesh733
Copy link
Contributor

@GauriRajesh733 GauriRajesh733 commented Apr 20, 2025

Changes

added container to display parts in a project that are still being reviewed (every status except approved). this container only appears for heads/leads of a project if there are any parts in the process of being reviewed. the container has dynamic width and height with a scroll bar if needed.

Notes

tested components manually on PartPage.tsx with examples (list of parts that are approved so nothing should display, list of parts that include parts that have not been approved w/ and w/out scroll bar, loading/error), etc..
used component setup from #3369 since the only difference is that this component only appears for leads/heads of projects.

Test Cases

N/A

Screenshots

no_in_progress_parts
allpartscontainer

To Do

i'm not exactly sure how to test this component aside from creating manual examples (ex. i changed currentUser at line 13 in AllPartsUnderReviewContainer.tsx when testing what happens if I change the user to a project lead, head, or member). there are a few example projects in seed.ts but i am not sure how to test using those.

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes # (issue #)

Copy link
Contributor

@chpy04 chpy04 left a comment

Choose a reason for hiding this comment

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

Can you make this look more like the epic? There shouldn't be white boarders and there should be different shades of gray to make it look a bit softer. Take a look at the epic for reference

// check if current user is head or lead for this project
const currentUser = useCurrentUser();
const { wbsNum } = project;
const { data } = usePartsFromProject(wbsPipe(wbsNum));
Copy link
Contributor

Choose a reason for hiding this comment

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

need to check for loading or error in hook

Copy link
Contributor

@chpy04 chpy04 left a comment

Choose a reason for hiding this comment

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

Few small changes. In general, don't return null from a component. Conditional components should be checked in the parent components

const { data, isLoading, isError, error } = usePartsFromProject(wbsPipe(wbsNum));

if (isLoading || isError || error) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

if its loading, return a loading indicator. If isError is true, return an Error component with the error in it. Take a look at how this is done in other places on the site, this is a super common pattern

// filter out parts in project that have not been approved
const parts = data?.filter((part) => part.status !== Review_Status.APPROVED) || [];
// show list only if head/lead of current project
if (!(isUserHead || isUserLead) || parts.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't check for head/lead here. We will check that in the parent component to determine if we want to display this one. If as a result you no longer need the currentUser get rid of that too

// filter out parts in project that have not been approved
const parts = data?.filter((part) => part.status !== Review_Status.APPROVED) || [];
// show list only if head/lead of current project
if (!(isUserHead || isUserLead) || parts.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the parts.length is 0, we want to convey that to the user. You can do that by returning something like this:

<EmptyPageBlockDisplay
  icon={<CheckCircleOutlineOutlinedIcon sx={{ fontSize: 70 }} />}
  heading={`You're all caught up!`}
  message={'There are no in progress parts on this project!'}
/>

@@ -1,4 +1,4 @@
FROM node:20-alpine
Copy link
Contributor

Choose a reason for hiding this comment

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

note to revieweres: this is good with me

added loading, error, removed checking user
@GauriRajesh733 GauriRajesh733 changed the title #3370 - added all parts under review container to correct branch #3370 - all parts under review container Apr 26, 2025
@walker-sean walker-sean merged commit 98f4d48 into feature/cad-project-file-review Apr 27, 2025
4 checks passed
@walker-sean walker-sean deleted the #3370-All-Parts-Under-Review-Correct-Container branch April 27, 2025 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants