Skip to content

Conversation

@nateci
Copy link
Contributor

@nateci nateci commented Apr 18, 2025

Changes

  • part review page
  • URL queries for submissions and reviews
  • dynamic display of submission vs review
  • dynamic display of review vs in progress review
  • displays pdfs
  • allows downloads
  • allows markups of pdfs
  • allows uploads for reviews
  • some other things

Notes

In the video I make reviews from the new button on the part page. Typically this will be done from the action button on the review, so reviewers would not have to go and find the review they just made ,but the action button is not done yet

Screenshots

I made a yt video again: https://youtu.be/ljDsP20cHNs

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.

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

Closes #3384

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.

This looks good so far. Couple things:

  • first change the service function to call the google drive API function (and change that function to make sense for files other than images)
  • change the endpoint to just take in a file id, that way we can use it generically for submission and review files

return deletedPopup;
}

static async downloadSubmissionFile(submissionId: string): Promise<{ buffer: Buffer; type: string; name: string }> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be very similar to downloadImage in the onboarding.service file

…er button we had so it just opens a new tab with that logic impl, saving should work deleting a file works (all backend should be hooked up).
@nateci nateci marked this pull request as ready for review April 26, 2025 16:44
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.

Lit, couple things

notes,
completedAt
completedAt,
...(fileIds !== undefined && { fileIds })
Copy link
Contributor

Choose a reason for hiding this comment

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

this might work but in terms of readability can you change it to fileIds ? fileIds : review.fileIds

@@ -0,0 +1,221 @@
import React, { useEffect, useState, useContext, useMemo } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Put this file near our other part review frontend files, either in the folder or in a components folder within the part review folder. src/components is reserved for things that are used across the site

);
};

export const useUploadReviewFiles = (reviewId: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this deleted?

Copy link
Member

@walker-sean walker-sean left a comment

Choose a reason for hiding this comment

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

Bug found after trying to submit review with no files:
image

In-text markups will also default to common mistakes unless I click on the common mistake button and then the markup button again.

nit:
image
Remove this circle when hovering over the buttons on the part detail page

const imagedata = await uploadFile(file);

if (!imagedata?.id) {
throw new HttpException(500, 'could not upload image');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: not necessarily an image

static async uploadFile(req: Request, res: Response, next: NextFunction) {
try {
if (!req.file) {
throw new HttpException(400, 'Invalid or undefined image data');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: not necessarily an image

commonMistakes: PartReviewCommonMistake[];
onDelete: () => void;
createPopup: (xCoord: number, yCoord: number, title: string, description?: string) => void;
custom: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

maybe make this customComment or something

}) => {
const [hovering, setHovering] = useState<boolean>(false);
const [selelcted, setSelected] = useState<boolean>(true);
const [textEdittor, setTextEdittor] = useState<boolean>(custom);
Copy link
Member

Choose a reason for hiding this comment

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

spelling -- also, it would probably be better to call this showCustomTextField or something like that

custom
}) => {
const [hovering, setHovering] = useState<boolean>(false);
const [selelcted, setSelected] = useState<boolean>(true);
Copy link
Member

Choose a reason for hiding this comment

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

spelling

<Box display="flex" alignItems="center">
{pdf && <DownloadButton fileId={submission.fileIds[fileIdx]} filename={`${submission.name}_${fileIdx + 1}`} />}
<Typography variant={'h4'}>
{submission.name} #{submissionIdx + 1} {review ? ' Review' : ''}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe do ${submission.name} (submission #${submissionIdx + 1}.

Having a number after the name is a bit confusing

);
};

export default PDFViewer;
Copy link
Member

Choose a reason for hiding this comment

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

Should we support multipage pdfs here? Currently, they can only be uploaded but only one file will be shown. Supporting multipage pdfs also means we need to track on which page popups are made

newPopup
}) => {
const [hovering, setHovering] = useState<boolean>(false);
const [selelcted, setSelected] = useState<boolean>(false);
Copy link
Member

Choose a reason for hiding this comment

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

spelling

}) => {
const [hovering, setHovering] = useState<boolean>(false);
const [selelcted, setSelected] = useState<boolean>(false);
const [editting, setEditting] = useState<boolean>(newPopup);
Copy link
Member

Choose a reason for hiding this comment

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

spelling

@walker-sean
Copy link
Member

Also, we should make sure assignees and reviewers are mutually exclusive

@chpy04 chpy04 requested a review from walker-sean May 4, 2025 11:10
}}
onClick={commentOnClick}
>
<AddCommentRoundedIcon sx={{ width: '60%', height: '60%' }} />
Copy link
Member

Choose a reason for hiding this comment

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

Could you add tooltips to these icon buttons that just say their action

<FormLabel>File(s)</FormLabel>
<Grid container>
{files.map((file, index) => {
{fileIds.map((file, index) => {
Copy link
Member

Choose a reason for hiding this comment

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

Could we have these extend down vertically in a list rather than horizontally?

<Typography>{displayName(file.name)}</Typography>
<IconButton onClick={() => removeFile(index)}>
<Typography>{displayName(files[index].name)}</Typography>
<IconButton
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the text and icon button are misaligned

Upload
<input
type="file"
hidden
Copy link
Member

Choose a reason for hiding this comment

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

since you can have multiple files, make this a multiple file input

Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be made a multiple input

@walker-sean
Copy link
Member

Forgot to add: I think clicking on the part link should bring you to the latest submission/review rather than earliest

Copy link
Member

@walker-sean walker-sean left a comment

Choose a reason for hiding this comment

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

2 questions:

  1. Is there utility in having a status selection when making a review or should it always become in review?
  2. Will there be an ability to create a review from the part details page?

Upload
<input
type="file"
hidden
Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be made a multiple input

{/* custom comment, common mistake, and file upload buttons for reviews*/}
{reviewMode && (
<Box display={'flex'} flexDirection={'column'}>
<Box
Copy link
Member

Choose a reason for hiding this comment

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

Add cursor: pointer to this and the following icon

@chpy04
Copy link
Contributor

chpy04 commented May 6, 2025

2 questions:

  1. Is there utility in having a status selection when making a review or should it always become in review?
  2. Will there be an ability to create a review from the part details page?

The ability to start a review will be in the actions button that is being worked on right now in a different ticket. Once that exists we can change the status selection options. Although I am thinking that we will want the options to be review or approve with the idea that if people want to start a review with markups they will go into the part page to do that

@walker-sean walker-sean merged commit 28054b4 into feature/cad-project-file-review May 7, 2025
4 checks passed
@walker-sean walker-sean deleted the #3384PartReview branch May 7, 2025 22:48
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.

4 participants