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

add functionality to allow for multiple TEC attendance picture submission #576

Merged
merged 16 commits into from
Mar 4, 2024

Conversation

alyssayzhang
Copy link
Contributor

@alyssayzhang alyssayzhang commented Feb 12, 2024

Summary

  • implemented Add button so a member can upload multiple TEC attendance for an event
  • add a preview button for pending TEC that member can view in a modal
  • add error handling if use does not upload all files
Screenshot 2024-03-03 at 7 18 17 PM Screenshot 2024-03-03 at 7 18 55 PM Screenshot 2024-03-03 at 7 19 10 PM Screenshot 2024-03-03 at 7 19 51 PM

Notion/Figma Link

https://www.notion.so/Idol-FA23-4899da48384747ba8ef8366f034e5ebf?p=ec88c8354f054dbb868a3e4f91f37c93&pm=s

Test Plan

I tested a multiple image submission for a TEC event and previewed that they were the correct images in the pending section. Also, I tested that the error message would appear for an unsuccessful image(s) upload.

@alyssayzhang alyssayzhang requested a review from a team as a code owner February 12, 2024 01:33
@dti-github-bot
Copy link
Member

dti-github-bot commented Feb 12, 2024

[diff-counting] Significant lines: 132.

Copy link
Contributor

@kevinmram kevinmram left a comment

Choose a reason for hiding this comment

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

The progress towards enhancing TEC attendance feature by introducing the capability for multiple picture submissions is lookin' good; including an "Add" button for uploading several images is a good approach! Maybe, adding error-handling for image uploads and integrating a preview feature for users to review their submissions before finalizing could be implemented!

@alyssayzhang alyssayzhang changed the title WIP add functionality to allow for multiple TEC attendance picture submission add functionality to allow for multiple TEC attendance picture submission Feb 19, 2024
…com:cornell-dti/idol into add-ability-to-submit-multiple-tec-requests
newTeamEventAttendance,
images[index]
);

const newTeamEventAttendance: TeamEventAttendance = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need both newTeamEventAttendance and newTeamEventCreditAttendance here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrew032011 the check that did not pass said cannot redeclare block-scoped variable 'newteameventattendance'.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, but those two variables look almost the exact same, do we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see what you meant! I removed one of them as I was cleaning up code

hoursAttended: teamEvent.hasHours ? Number(hours) : undefined,
image: `eventProofs/${getNetIDFromEmail(userInfo.email)}/${new Date().toISOString()}`,
eventUuid: teamEvent.uuid,
pending: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Type checker should catch this: we killed off the pending field already in #575.

Copy link
Collaborator

@andrew032011 andrew032011 left a comment

Choose a reason for hiding this comment

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

Found a bug, here's how to reproduce:

  1. Increase the number of images upload slots to 2
  2. Upload image for first
  3. Upload a different image for second
  4. Submit
  5. observe that both images are the same

It has to be done in that order to reproduce it. If you switch around 1 and 2, you won't be able to reproduce it.

Attached a video too to show you what I mean:

Screen.Recording.2024-02-28.at.11.06.10.PM.mov

@@ -59,6 +81,11 @@ const TeamEventCreditForm: React.FC = () => {
headerMsg: 'No Image Uploaded',
contentMsg: 'Please upload an image!'
});
} else if (imageIndex.length !== expectedNumOfImages) {
Emitters.generalError.emit({
headerMsg: 'Unsucessful Image Upload',
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo: Unsuccessful, or I might actually make the header message "Missing Images"

@@ -19,6 +19,8 @@ const TeamEventCreditForm: React.FC = () => {
const [pendingAttendance, setPendingAttendance] = useState<TeamEventAttendance[]>([]);
const [rejectedAttendance, setRejectedAttendance] = useState<TeamEventAttendance[]>([]);
const [isAttendanceLoading, setIsAttendanceLoading] = useState<boolean>(true);
const [imageIndex, setImageIndex] = useState<number[]>([0]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you need this imageIndex, setImageIndex hook to be an array. How about just a number to say how many image upload slots you have?

value={image ? undefined : ''}
onChange={handleNewImage}
/>
{imageIndex.map((item, index) => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above, I don't think you're using item here either. Actually item and index are equal here. Don't we just want to know how many images there are? So the only state we want to be storing is numImagesSlots (or something like that), just a number.

@@ -49,6 +69,8 @@ const TeamEventCreditForm: React.FC = () => {
};

const submitTeamEventCredit = () => {
const expectedNumOfImages = images.length;
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to create a variable IMO for this, we can just inline it, since you're only using it once

@andrew032011 andrew032011 force-pushed the add-ability-to-submit-multiple-tec-requests branch from 5c169a0 to fdb9236 Compare March 3, 2024 23:16
Copy link
Collaborator

@andrew032011 andrew032011 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 also QA test this a bit on the deploy preview just to make sure it's working now?

max-height: 60vh !important;
}

.margin_before_button {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: camel case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrew032011 the rest of the css file is snake case

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh ok! let's leave it

onChange={handleNewImage}
/>
{images.map((image, i) => (
<div className="input_container" style={{ marginBottom: '10px' }} key={i}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: inline the styling here. also, what's className "input_container"? I don't see it defined in a CSS file

max-height: 60vh !important;
}

.margin_before_button {
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh ok! let's leave it

@alyssayzhang alyssayzhang merged commit 5c29d57 into main Mar 4, 2024
17 checks passed
@alyssayzhang alyssayzhang deleted the add-ability-to-submit-multiple-tec-requests branch March 4, 2024 05:54
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