ReneReid / Internify

3 stars 0 forks source link

Feat/in84 create edit job page 2 #87

Closed ReneReid closed 3 years ago

ReneReid commented 3 years ago

User Story IN-84 Create Edit Page https://chaosneutral.atlassian.net/browse/IN-84

Changes made The user can now (partially) edit a previously created job posting. (Note editing functionality is not fully completed, as @JudeShamsi has offered to work on the radiobuttons, checkboxes. )

To do so, I have created a new page called "Edit.js", found within src->components-> pages

Edit.js, as much as possible, utilizes the components that are also used by "Create.js"; these components had to be modified to reflect whether the user is editing vs creating a job. Thus now the components work equally well whether you are creating a job or editing a job.

In addition, to reduce code duplication as much as possible, a series of functions have been extracted out that would otherwise exist in both Create.js and Edit.js. These functions are now contained within src -> effects -> filter.effects.js Note that though filter.effects.js contains many functions, the vast majority of these are helper functions; only 2 need be exported.

Also note that one function that is common between Edit.js and Create.js was not extracted out - updateStore() found on line 92 of Edit.js and line 118 of Create.js. The reason this was not extracted is because this function relies on quite a few variables that are defined in Edit.js/Create.js; extracting it would have required a very large argument list, and so to avoid creating a function with such a large argument list, I kept that function in Edit.js/Create.js

Separately, a job edit route has been created (connects to our mongoDB database), and a job update action.

Next steps: @JudeShamsi will be fixing up the radiobuttons and checkboxes, and update the registered keys so that the Edit page is correctly populated.

Does your new code introduce new warnings on dev console? Yes - See below (and attached picture) for text. I believe this warning will resolve itself once @JudeShamsi has finished working on radiobutton/ checkbox editing. I can further explain with a demonstration as to why this is my belief.

"Warning: Encountered two children with the same key... Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted - the behavior is unsupported and could change in a future version"

Test Steps

image

Test Steps

Describe the test steps to test your changes.