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

Edit existing senior #121

Merged
merged 3 commits into from
Mar 14, 2024
Merged

Edit existing senior #121

merged 3 commits into from
Mar 14, 2024

Conversation

cledi01
Copy link
Collaborator

@cledi01 cledi01 commented Mar 13, 2024

Description

Make edit senior pop-up be initialized with the data we have of the senior that needs to be edited.

Issues

Resolve #82

Test

Follow the link below and change as needed. You need to be a chapter leader to edit it.
http://localhost:3000/private/[your userID]/chapter-leader/seniors

Possible Downsides

I did not test the delete functionality from the pop-up of the seniors.

Copy link

vercel bot commented Mar 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
the-legacy-project2 ✅ Ready (Inspect) Visit Preview Mar 13, 2024 3:58am

@@ -54,7 +54,7 @@ const DisplaySenior = (props: DisplayProps) => {
{/* @TODO - Firstname + lastname */}
<h1 className="text-4xl font-bold text-[#000022]">{`${senior.firstname} ${senior.lastname}`}</h1>
<p>{senior.description}</p>
<Assigment editable={editable} senior={senior} />
<Assignment editable={editable} senior={senior} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch :)

Copy link
Collaborator

@nickbar01234 nickbar01234 left a comment

Choose a reason for hiding this comment

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

Changes look great overall, thank you for your work! I went ahead and made some small fixes:

  1. Rebase your branch onto latest main
  2. Move the state management logic from patchAddSenior to handlePopup as either flow ends up with the user clicking the confirming button, which triggers handlePopup.

Other than that, I have some nits in the comment section that you may look into (if you have time). Otherwise, there's some styling issues we can fix (if you have time):

  1. I think the modal should be fixed height and scrolls as you assign / remove students for a given senior. Maybe we can have the student tags as a horizontal scroll?
  2. The current form implementation does not have any validation / user feedback. This might be enough work that it should be a ticket on its own. What do you think?

location: "",
description: "",
};
}, []);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be a constant outside the component?

@@ -33,13 +35,48 @@ export const SeniorView = ({ seniors, students }: SeniorViewProps) => {
/>
}
elements={seniorsState ? seniorsState : []}
Copy link
Collaborator

Choose a reason for hiding this comment

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

seniorState is defined as an array, so the ternary operator is not necessary.

fetch(`/api/senior/${senior.id}`, {
method: "DELETE",
}).then(() => {
window.location.reload();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can filter the id from senior state?

onClick: (e) => {
e.stopPropagation();
e.preventDefault();
if (!setSeniorPatch || !setShowAddSeniorPopUp) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

When does this statement evaluate to true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Girlie pop, I just copied and pasted this mostly

@nickbar01234 nickbar01234 merged commit fd6660f into main Mar 14, 2024
4 checks passed
@nickbar01234 nickbar01234 deleted the cledi01-edit-senior-popup branch March 14, 2024 01:25
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.

Add / Edit Senior Popup
2 participants