-
Notifications
You must be signed in to change notification settings - Fork 15
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
React component implementation #17
Conversation
#7 - code refactoring, - updating package dependencies, - export and building React components.
@Stukova I think the main |
@neesjanvaneck I have made some changes to the style of the React components so that they fit well into the page elements. I've fixed the placement of the control panel, interaction with the visualization and full screen mode. Also added two new dependencies:
|
@rokotyan @neesjanvaneck Done 85061b7. |
Thanks a lot for these fixes @Stukova! I found four other issues related to the style of the React components:
|
@Stukova Since the update of "mobx": "^4.9.3" -> "^6.6.0" (and "mobx-react-lite": "^1.4.1" -> "^3.4.0"), the following warnings appear in the console: |
- use case-sensitive names, - use prefix @ to avoid confusion in the import.
9b8c688
to
7bc24e7
Compare
https://mobx.js.org/api.html#makeautoobservable makeAutoObservable has the same effect as extendObservable, but does not trigger strict-mode warnings
When using the React component in the application with React 18, the slider height is higher.
This reverts commit 34c41f4.
This reverts commit 9e78724.
Share button and URL preview panel
This reverts commit 5019981.
Prevent from duplicate Worker code
This reverts commit fa220c2.
I would like to introduce the changes that add support to our project for building React components, as suggested in the issue #7. Further below I have described all the changes I have made.
The main change I've made is upgrading Webpack 4 to Webpack 5. Webpack 5 has better support for creating a library. Related changes:
--colors
key. Colors are enabled by default in Webpack 5 (Docs:--colors
is not a valid options in webpack 5 rails/webpacker#3138 (comment)).--watch
key. Dev server will reload/refresh the page by default.--verbose
key to Webpack configstats.logging
option.--display-error-details
key to Webpack configstats.errorDetails
option.I've also add new scripts for building React components library:
build-component
/build-component:vosviewer
script,build-component:dimensions
script,build-component:zeta-alpha
script,build-component:rori
script.They build a component for each project in the lib folder and copy the
package.json
to the same place as well.See copy-package-json.js Node script where
package.json
is created.I've also add lib folder to a
.gitignore
list.As for refactoring, I moved
Helmet
component from each App to the entry point for the Application. It creates a title for the page, that is no needed in the React component.And added
DATA_MAP
,DATA_NETWORK
andDATA_JSON
string global variable. Papaparse, which is located inside Web Worker, will not upload local files. Local files will be downloaded from outside Web Worker using therequire
function.DATA_MAP
,DATA_NETWORK
andDATA_JSON
arejsonConfig.parameters.map
,jsonConfig.parameters.network
andjsonConfig.parameters.json
string values. I did this way, sorequire
will get a global string variable.Require
doesn't support an argument as a variable. (@rokotyan )As a result of using
require
, I deleted fromwebpack.config.json
copying of data files. Now all local data files are created as a separate module file.Note! Because of
require
,config.json
,config-zeta-alpha.json
andconfig-dimensions.json
does not supportparameters.map
,parameters.network
andparameters.json
as the URL value. @neesjanvaneck do you see a case where a file from a URL will be needed as an initial file for an Application or a React component?I've updated, added or removed the following packages.
Updated:
Added:
Added node-polyfill-webpack-plugin (https://github.com/webpack/changelog-v5#automatic-nodejs-polyfills-removed). tinyurl uses http and https but not have them as a dependencies. htmlparser2 uses buffer as well.
Added workerize-loader. Webpack 5 have build-in worker loader, but it doesn't have the inline option. Inline option useful for building libraries.
Removed:
Global
from "@emotion/core" ->injectGlobal
from "@emotion/css".withStyles
that we are using from "@mui/styles" can be replaced with build-in Mui componentssx
property.window.location.search
.I've also moved MobX, mobx-react-lite, React and ReactDOM to a peerDependencies. These packages must be in
package.json
for the React components aspeerDependencies
, but not sure if it is ok if they are in the mainpackage.json
aspeerDependencies
. (@rokotyan )@rokotyan , could you please review the parts where I noticed you in the description.
@neesjanvaneck could you please review the React component library names.
Example of using the component:
parameters
prop include all parameters that was supported from a URL string query anddata
- an initial network data.parameters
anddata
are optional props.data
prop has the same type that has json data in the current state.