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

Senghoung/edit review feature #426

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

SenghoungLim
Copy link
Contributor

Description

  • Added edit review feature in user's review menu/tab.
  • Added delete confirmation dialog for user's review.
  • Added user-friendly design of the edit pen icon accommodating dark mode.

Screenshots

  • Showcase of delete review & pen UI for dark/light mode
    Showcase of delete review & pen UI for dark/light mode
  • Showcase delete review confirmation & dark/light mode UI
    Showcase delete review confirmation & dark/light mode UI

Steps to verify/test this change:

  • Verify changes work as expected on staging instance

Final Checks:

  • Verify successful deployment

(optional)

  • Write tests
  • Write documentation

Issues

Closes #273

@SenghoungLim SenghoungLim added frontend Front End tasks backend Back End tasks mvp resolve this to include task in PeterPortal MVP and move out of beta testing labels Feb 13, 2024
@SenghoungLim SenghoungLim self-assigned this Feb 13, 2024
Copy link

Deployed staging instance to https://staging-426.peterportal.org

@Awesome-E
Copy link
Member

Awesome-E commented Feb 14, 2024

Just by first look, this seems pretty cool so far! I'm not assigned to review the PR, but I do have a few comments on design.

I know what you have is the default style for the modal, but I think you should make it look more like the design and/or the one I made in #419 (for both aesthetics but more importantly consistency). To be more specific, that is:

  • Making the X bigger to match the size of the heading on the left
  • not having the borders on bottom and top because that looks cleaner
  • Modal background color should be one of the overlay colors (I forget which one, but it's in my PR)

Also, the edit button from your GIF appears to not be square, which makes the backdrop an oval instead of a circle. To be honest, I think don't think we should have it as a circle at all. Instead, I think we should keep the UI consistent with other parts of PPC and do the same thing like we do in the roadmap – that is, have a transparent button that is of the variant "light/dark depending on theme".

Copy link
Member

@js0mmer js0mmer left a comment

Choose a reason for hiding this comment

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

Works well except for 2 things:

  • reCAPTCHA has no effect, should implement or just omit it for review edits which I think may be safe to do, given that the resource already exists
  • Form validation does not reset. If I edit a review then go to edit it again, green outlines and check marks are still there.
    image

Left additional comments, mainly on small refactors and design.

Edit: also there's some leftover margin to the left of the grade dropdown that looks weird. Should remove it for editable review form.
image

package.json Outdated
@@ -10,6 +10,7 @@
},
"dependencies": {
"dotenv-flow": "^4.0.1",
"react-icons": "^5.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

Would prefer not to add another icon pack/dependency just for one icon. We already have react bootstrap icons, let's use one of their icons.

Comment on lines +100 to +102
<div className="edit-pen-icon" onClick={() => editReview(review, course, professor)}>
<FaPen />
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Should make this a button not a div for accessibility purposes and then style it appropriately. I agree with Ethan's comments on the button styling.

setProfessor(props.review?.professorID);
setCourse(props.review?.courseID);
}
}, [showForm]);
Copy link
Member

Choose a reason for hiding this comment

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

Add the dependencies to clear the warning. The lint check will allow warnings but our goal should be to have none so let's make sure not to add anymore.

Suggested change
}, [showForm]);
}, [showForm, cookies.user, props]);

};
if (content.length > 500) {
setOverCharLimit(true);
if (props.editable === false) {
Copy link
Member

@js0mmer js0mmer Feb 14, 2024

Choose a reason for hiding this comment

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

Does this need to specifically === false, or can we just:

Suggested change
if (props.editable === false) {
if (!props.editable) {

Comment on lines +52 to +56
console.log('Data received from SubReview:', {
course,
professor,
review,
});
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log('Data received from SubReview:', {
course,
professor,
review,
});

});
dispatch(setFormStatus(true));
document.body.style.overflow = 'hidden';
console.log('Edit Review clicked!');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log('Edit Review clicked!');

Comment on lines +100 to +102
<Button variant="secondary" onClick={handleClose}>
Close
</Button>
Copy link
Member

Choose a reason for hiding this comment

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

I would say cancel instead.

Suggested change
<Button variant="secondary" onClick={handleClose}>
Close
</Button>
<Button variant="secondary" onClick={handleClose}>
Cancel
</Button>

@Awesome-E Awesome-E mentioned this pull request Feb 26, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Back End tasks frontend Front End tasks mvp resolve this to include task in PeterPortal MVP and move out of beta testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add confirmation when deleting review on reviews page, and ability to update review
3 participants