This repository was archived by the owner on Aug 5, 2023. It is now read-only.
Jquery-to-ReactJS render - #19
Open
OliverBrimdjam wants to merge 3 commits into
Open
OliverBrimdjam wants to merge 3 commits into
OliverBrimdjam wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
--In this update, I made a ReactJS render of two pages: options.html and popup.html. To it works, was necessary to use webpack and babel config to insert grafts of React rendered content overwriting the original content. The way choose to do it permit the use of webpack to bundle the React content and no additional adjust is needed for chrome-extension use, just install and run.
--The functions inside js/helpers.js, js/options.js, js/popup.js, js/toDo.js, js/migrations, were copied to src/tools and refactored to be more readable.
--All the Html was separated to react Components, some of the event listeners were changed to events onChange, onClick, onKeyDown, etc. All CSS was left like before, just new elements have different ones.
Why:
--The changes were made to turn the code more readable and workable, making it easier to maintain and more predictable. Some parts of the extension were broken because of old libraries. It was solved using the moderns native ReactJS state hooks.
--The ES6+ standard was used to import/export functions, variable names were rewritten to be more readable. Every storage action was also abstracted to one point, making it easy to change the storage system if necessary.
How:
--The first step was to take all HTML and copy it to ReactJS components. The HTML was split into JSX parts and organized into src/components, these components were grouped by page, and by page section.
--The second step was to bundle it to convert ES6+ into old javascript. To do it was taken webpack configured the loaders, and set to multiple in/out files.
--The third step was to use ReactJS to render the components into HTML
--The last step was to import all functions that were used into the two pages, and all variables too, rewriting and refactoring them when necessary, to activate all features. All these functions were separated into different files and were stored into src/tools/. At this point, all access to Local Storage was abstracted to be made just through the functions src/tools/helpersTools/lsSet.js and src/tools/helpersTools/lsGet.js.
obs: All CSS was kept to stay at global scope because any style change was made.