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

Feat/add on click to update applied on date #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dcardona23
Copy link
Collaborator

Type of Change

  • feature β›²
  • refactor πŸ§‘β€πŸ’»
  • testing πŸ§ͺ

Description

This PR adds on-click functionality to edit an application date by clicking the applied on date on an application show page. It also adds a Cypress test to confirm functionality.

Motivation and Context

This change allows a user to change an application date from the application show page without clicking on the "Edit" button to edit the application.

Closes issue #96.

Related Tickets

Screenshots (if appropriate):

Added Test?

  • Yes 🫑
  • No πŸ™…
  • All previous tests still pass πŸ₯³

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link
Collaborator

@MiTOBrien MiTOBrien left a comment

Choose a reason for hiding this comment

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

Overall, code looks clean and well written.

@@ -47,6 +47,8 @@ function JobApplication() {
const [jobDescription, setJobDescription] = useState('');
const [applicationURL, setApplicationURL] = useState('');
const [companyId, setCompanyId] = useState('');
const [isEditing, setIsEditing] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be editing and setEditing instead of isEditing and setIsEditing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree with you that editing and setEditing read better, but I was trying to maintain consistency with other boolean state syntax in showJobApplication.tsx. For example, modal state is managed through "isModalOpen, setIsModalOpen", and edit model state is managed through "isEditModelOpen, setIsEditModelOpen."

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the consistency that Danielle applied. It might be good to add an issue/ticket to refactor all of the "is" parts in the code into simply "set".

Copy link
Collaborator

@wally-yawn wally-yawn left a comment

Choose a reason for hiding this comment

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

Pulling this down and testing locally shows that this doesn't actually save the change when you navigate away from the page. Is there another issue to implement that save?

Copy link
Collaborator

@TDManning TDManning left a comment

Choose a reason for hiding this comment

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

See comments for edits to handleSave function and a possible cypress test to ensure the backend is saving the modified user input

@@ -536,6 +536,10 @@ FORMAT: lastname, firstname
- [Github](https://github.com/stefanjbloom)
- [LinkedIn](https://www.linkedin.com/in/stefanjbloom/)

**Cardona, Danielle**
- [Github](https://github.com/dcardona23)
- [LinkedIn](https://github.com/dcardona23)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like you accidentally listed your Github twice instead of adding the LinkedIn link.

@@ -72,6 +75,11 @@ function JobApplication() {
}
}, [jobAppId]);

const handleSave = () => {
setIsEditing(false)
setEditedDate(editedDate)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Because editedDate is already the current value in state, this code on line 80, setEditedDate(editedDate) may not be doing anything. It can likely be removed.
*Note: editedDate is updated with the user types a new date into the input field and set via the onChange event setEditedDate(e.target.value)

@@ -47,6 +47,8 @@ function JobApplication() {
const [jobDescription, setJobDescription] = useState('');
const [applicationURL, setApplicationURL] = useState('');
const [companyId, setCompanyId] = useState('');
const [isEditing, setIsEditing] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the consistency that Danielle applied. It might be good to add an issue/ticket to refactor all of the "is" parts in the code into simply "set".

@@ -72,6 +75,11 @@ function JobApplication() {
}
}, [jobAppId]);

const handleSave = () => {
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 believe that the handleSave() function is updating the back end. If you call updateJobApplication() inside of the handleSave function, it would trigger the updateJobApplication() function so that the changes persist in the backend database.

You could add a cypress test to verify that the data is saving in the back end.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could add a cypress test to verify that the data is saving in the back end (see the handleSave() function notes for additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants