@firedesktop/react-base 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -114
- package/debug.log +2 -2
- package/package.json +59 -59
- package/public/index.html +43 -43
- package/public/manifest.json +25 -25
- package/public/robots.txt +3 -3
- package/src/App.test.tsx +9 -9
- package/src/App.tsx +51 -51
- package/src/TestLabelFunction.tsx +0 -1
- package/src/index.tsx +16 -16
- package/src/reportWebVitals.ts +15 -15
- package/src/setupTests.ts +5 -5
package/README.md
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
This is the FireDesktop base package used to support every React Project in this Company.
|
|
2
|
-
|
|
3
|
-
## Usage of Configuration
|
|
4
|
-
1. Installation
|
|
5
|
-
|
|
6
|
-
- Login in the shell using your npmjs account
|
|
7
|
-
```bash
|
|
8
|
-
npm i @firedesktop/react-base
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
2. Create a file with a name like 'config.json' with the following format and put it in the public/configuration
|
|
12
|
-
sample name it-IT.json
|
|
13
|
-
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"myPropery": "myvalue",
|
|
17
|
-
"urls" : {
|
|
18
|
-
"first": "http..."
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
3. Import
|
|
24
|
-
```javascript
|
|
25
|
-
import { ConfigurationLoader } from '@firedesktop/react-base';
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
4. Load your configuration just put this component in the page where the Provider component is
|
|
29
|
-
|
|
30
|
-
```javascript
|
|
31
|
-
<Provider store={store}>
|
|
32
|
-
...
|
|
33
|
-
<ConfigurationLoader updateAppState={updateAppState} path={null} />
|
|
34
|
-
</Provider >
|
|
35
|
-
```
|
|
36
|
-
- updateAppState: is a function with two paramenters
|
|
37
|
-
```
|
|
38
|
-
updateAppState = (nameInState: string, configuration: object)
|
|
39
|
-
```
|
|
40
|
-
- nameInState: name of the property in the App state where to save the documentation
|
|
41
|
-
- path: is the path from where to load the configuration file (if null: /configuration/config.json)
|
|
42
|
-
|
|
43
|
-
## Usage of LabelManager
|
|
44
|
-
|
|
45
|
-
1. Installation
|
|
46
|
-
```bash
|
|
47
|
-
npm i @firedesktop/react-base
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
2. Create a file with a name like '[locale].json' with the following format and put it in the public/labels
|
|
51
|
-
sample name it-IT.json
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{
|
|
55
|
-
"language": "it-IT",
|
|
56
|
-
"demo": {
|
|
57
|
-
"label_01": "Demo Label 01",
|
|
58
|
-
"label_02": "Demo Label 02"
|
|
59
|
-
},
|
|
60
|
-
"anotherContext": {}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
3. Import
|
|
65
|
-
```javascript
|
|
66
|
-
import { LanguageLoader } from '@firedesktop/react-base';
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
4. Load your language Labels just put this component in the page where the Provider component is
|
|
70
|
-
```javascript
|
|
71
|
-
<Provider store={store}>
|
|
72
|
-
...
|
|
73
|
-
<LanguageLoader updateAppState={updateAppState} locale='it-IT' path={null} />
|
|
74
|
-
</Provider >
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
4. Show a label in code
|
|
78
|
-
```javascript
|
|
79
|
-
import { useSelector } from "react-redux";
|
|
80
|
-
import LanguageManager from './lib/LanguageManager';
|
|
81
|
-
const { getLabel } = LanguageManager();
|
|
82
|
-
|
|
83
|
-
const { labels }: any = useSelector(state => state);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<React.Fragment>
|
|
87
|
-
{getLabel(labels, 'demo.label_01', 'Ola')}
|
|
88
|
-
</React.Fragment>
|
|
89
|
-
);
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Available Scripts
|
|
93
|
-
|
|
94
|
-
In the project directory, you can run:
|
|
95
|
-
|
|
96
|
-
### `npm start`
|
|
97
|
-
|
|
98
|
-
Runs the Demo app in the development mode.<br />
|
|
99
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
100
|
-
|
|
101
|
-
The page will reload if you make edits.<br />
|
|
102
|
-
You will also see any lint errors in the console.
|
|
103
|
-
|
|
104
|
-
### `npm run distribute`
|
|
105
|
-
|
|
106
|
-
Builds (made for windows) the app for production to the `dist` folder.<br />
|
|
107
|
-
It correctly bundles the React component.
|
|
108
|
-
|
|
109
|
-
### `npm publish`
|
|
110
|
-
|
|
111
|
-
Publish the dist on npmjs.
|
|
112
|
-
|
|
113
|
-
## License
|
|
114
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
1
|
+
This is the FireDesktop base package used to support every React Project in this Company.
|
|
2
|
+
|
|
3
|
+
## Usage of Configuration
|
|
4
|
+
1. Installation
|
|
5
|
+
|
|
6
|
+
- Login in the shell using your npmjs account
|
|
7
|
+
```bash
|
|
8
|
+
npm i @firedesktop/react-base
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
2. Create a file with a name like 'config.json' with the following format and put it in the public/configuration
|
|
12
|
+
sample name it-IT.json
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"myPropery": "myvalue",
|
|
17
|
+
"urls" : {
|
|
18
|
+
"first": "http..."
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Import
|
|
24
|
+
```javascript
|
|
25
|
+
import { ConfigurationLoader } from '@firedesktop/react-base';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
4. Load your configuration just put this component in the page where the Provider component is
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
<Provider store={store}>
|
|
32
|
+
...
|
|
33
|
+
<ConfigurationLoader updateAppState={updateAppState} path={null} />
|
|
34
|
+
</Provider >
|
|
35
|
+
```
|
|
36
|
+
- updateAppState: is a function with two paramenters
|
|
37
|
+
```
|
|
38
|
+
updateAppState = (nameInState: string, configuration: object)
|
|
39
|
+
```
|
|
40
|
+
- nameInState: name of the property in the App state where to save the documentation
|
|
41
|
+
- path: is the path from where to load the configuration file (if null: /configuration/config.json)
|
|
42
|
+
|
|
43
|
+
## Usage of LabelManager
|
|
44
|
+
|
|
45
|
+
1. Installation
|
|
46
|
+
```bash
|
|
47
|
+
npm i @firedesktop/react-base
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. Create a file with a name like '[locale].json' with the following format and put it in the public/labels
|
|
51
|
+
sample name it-IT.json
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"language": "it-IT",
|
|
56
|
+
"demo": {
|
|
57
|
+
"label_01": "Demo Label 01",
|
|
58
|
+
"label_02": "Demo Label 02"
|
|
59
|
+
},
|
|
60
|
+
"anotherContext": {}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. Import
|
|
65
|
+
```javascript
|
|
66
|
+
import { LanguageLoader } from '@firedesktop/react-base';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. Load your language Labels just put this component in the page where the Provider component is
|
|
70
|
+
```javascript
|
|
71
|
+
<Provider store={store}>
|
|
72
|
+
...
|
|
73
|
+
<LanguageLoader updateAppState={updateAppState} locale='it-IT' path={null} />
|
|
74
|
+
</Provider >
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
4. Show a label in code
|
|
78
|
+
```javascript
|
|
79
|
+
import { useSelector } from "react-redux";
|
|
80
|
+
import LanguageManager from './lib/LanguageManager';
|
|
81
|
+
const { getLabel } = LanguageManager();
|
|
82
|
+
|
|
83
|
+
const { labels }: any = useSelector(state => state);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<React.Fragment>
|
|
87
|
+
{getLabel(labels, 'demo.label_01', 'Ola')}
|
|
88
|
+
</React.Fragment>
|
|
89
|
+
);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Available Scripts
|
|
93
|
+
|
|
94
|
+
In the project directory, you can run:
|
|
95
|
+
|
|
96
|
+
### `npm start`
|
|
97
|
+
|
|
98
|
+
Runs the Demo app in the development mode.<br />
|
|
99
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
100
|
+
|
|
101
|
+
The page will reload if you make edits.<br />
|
|
102
|
+
You will also see any lint errors in the console.
|
|
103
|
+
|
|
104
|
+
### `npm run distribute`
|
|
105
|
+
|
|
106
|
+
Builds (made for windows) the app for production to the `dist` folder.<br />
|
|
107
|
+
It correctly bundles the React component.
|
|
108
|
+
|
|
109
|
+
### `npm publish`
|
|
110
|
+
|
|
111
|
+
Publish the dist on npmjs.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/debug.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
[1024/175356.424:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
|
|
2
|
-
[1025/090606.275:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
|
|
1
|
+
[1024/175356.424:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
|
|
2
|
+
[1025/090606.275:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@firedesktop/react-base",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"license": "ISC",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"description": "This is the FireDesktop base package used to support every React Project in this Company.",
|
|
7
|
-
"author": "alessandro.gambaro",
|
|
8
|
-
"repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"react
|
|
20
|
-
"react-
|
|
21
|
-
"redux": "^
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@babel/
|
|
28
|
-
"@babel/
|
|
29
|
-
"@babel/
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"distribute": "rmdir /s /q dist & mkdir dist && npx babel src/lib --out-dir dist --extensions \".js,.ts,.tsx\" --source-maps inline",
|
|
39
|
-
"start": "react-scripts start"
|
|
40
|
-
},
|
|
41
|
-
"eslintConfig": {
|
|
42
|
-
"extends": [
|
|
43
|
-
"react-app",
|
|
44
|
-
"react-app/jest"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"browserslist": {
|
|
48
|
-
"production": [
|
|
49
|
-
">0.2%",
|
|
50
|
-
"not dead",
|
|
51
|
-
"not op_mini all"
|
|
52
|
-
],
|
|
53
|
-
"development": [
|
|
54
|
-
"last 1 chrome version",
|
|
55
|
-
"last 1 firefox version",
|
|
56
|
-
"last 1 safari version"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@firedesktop/react-base",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"description": "This is the FireDesktop base package used to support every React Project in this Company.",
|
|
7
|
+
"author": "alessandro.gambaro",
|
|
8
|
+
"repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"react": "^17.0.1",
|
|
11
|
+
"react-dom": "^17.0.1",
|
|
12
|
+
"react-scripts": "4.0.0",
|
|
13
|
+
"react-redux": "^7.2.1",
|
|
14
|
+
"redux": "^4.0.5"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/jest": "^26.0.15",
|
|
18
|
+
"@types/node": "^12.19.1",
|
|
19
|
+
"@types/react": "^16.9.53",
|
|
20
|
+
"@types/react-dom": "^16.9.8",
|
|
21
|
+
"@types/react-redux": "^7.1.9",
|
|
22
|
+
"@testing-library/jest-dom": "^5.11.5",
|
|
23
|
+
"@testing-library/react": "^11.1.0",
|
|
24
|
+
"@testing-library/user-event": "^12.1.10",
|
|
25
|
+
"@babel/cli": "^7.10.5",
|
|
26
|
+
"@babel/core": "^7.10.5",
|
|
27
|
+
"@babel/plugin-proposal-class-properties": "7.10.4",
|
|
28
|
+
"@babel/plugin-transform-arrow-functions": "^7.12.1",
|
|
29
|
+
"@babel/preset-typescript": "^7.12.1",
|
|
30
|
+
"babel-preset-minify": "0.5.1",
|
|
31
|
+
"babel-plugin-minify-builtins": "^0.5.0",
|
|
32
|
+
"react-scripts": "^3.4.3",
|
|
33
|
+
"typescript": "^4.0.3",
|
|
34
|
+
"web-vitals": "^0.2.4"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"distribute": "rmdir /s /q dist & mkdir dist && npx babel src/lib --out-dir dist --extensions \".js,.ts,.tsx\" --source-maps inline",
|
|
39
|
+
"start": "react-scripts start"
|
|
40
|
+
},
|
|
41
|
+
"eslintConfig": {
|
|
42
|
+
"extends": [
|
|
43
|
+
"react-app",
|
|
44
|
+
"react-app/jest"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"browserslist": {
|
|
48
|
+
"production": [
|
|
49
|
+
">0.2%",
|
|
50
|
+
"not dead",
|
|
51
|
+
"not op_mini all"
|
|
52
|
+
],
|
|
53
|
+
"development": [
|
|
54
|
+
"last 1 chrome version",
|
|
55
|
+
"last 1 firefox version",
|
|
56
|
+
"last 1 safari version"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
package/public/index.html
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<meta name="theme-color" content="#000000" />
|
|
8
|
-
<meta
|
|
9
|
-
name="description"
|
|
10
|
-
content="Web site created using create-react-app"
|
|
11
|
-
/>
|
|
12
|
-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
-
<!--
|
|
14
|
-
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
-
-->
|
|
17
|
-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
-
<!--
|
|
19
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
-
|
|
23
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
-
-->
|
|
27
|
-
<title>React App</title>
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
-
<div id="root"></div>
|
|
32
|
-
<!--
|
|
33
|
-
This HTML file is a template.
|
|
34
|
-
If you open it directly in the browser, you will see an empty page.
|
|
35
|
-
|
|
36
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
-
|
|
39
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
-
-->
|
|
42
|
-
</body>
|
|
43
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Web site created using create-react-app"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
+
<!--
|
|
14
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
+
-->
|
|
17
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
+
<div id="root"></div>
|
|
32
|
+
<!--
|
|
33
|
+
This HTML file is a template.
|
|
34
|
+
If you open it directly in the browser, you will see an empty page.
|
|
35
|
+
|
|
36
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
+
|
|
39
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
+
-->
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
package/public/manifest.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/public/robots.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# https://www.robotstxt.org/robotstxt.html
|
|
2
|
-
User-agent: *
|
|
3
|
-
Disallow:
|
|
1
|
+
# https://www.robotstxt.org/robotstxt.html
|
|
2
|
+
User-agent: *
|
|
3
|
+
Disallow:
|
package/src/App.test.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import App from './App';
|
|
4
|
-
|
|
5
|
-
test('renders learn react link', () => {
|
|
6
|
-
render(<App />);
|
|
7
|
-
const linkElement = screen.getByText(/learn react/i);
|
|
8
|
-
expect(linkElement).toBeInTheDocument();
|
|
9
|
-
});
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import App from './App';
|
|
4
|
+
|
|
5
|
+
test('renders learn react link', () => {
|
|
6
|
+
render(<App />);
|
|
7
|
+
const linkElement = screen.getByText(/learn react/i);
|
|
8
|
+
expect(linkElement).toBeInTheDocument();
|
|
9
|
+
});
|
package/src/App.tsx
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Provider } from "react-redux";
|
|
3
|
-
import { createStore } from 'redux';
|
|
4
|
-
|
|
5
|
-
import ConfigurationLoader from './lib/ConfigurationLoader';
|
|
6
|
-
import LanguageLoader from './lib/LanguageLoader';
|
|
7
|
-
import TestLabelFunction from './TestLabelFunction';
|
|
8
|
-
|
|
9
|
-
export const UPDATE_APP_STATE = 'UPDATE_APP_STATE';
|
|
10
|
-
const appReducer = (state = {}, action: any) => {
|
|
11
|
-
switch (action.type) {
|
|
12
|
-
case UPDATE_APP_STATE: {
|
|
13
|
-
const { name, value } = action.payload;
|
|
14
|
-
const newState = { ...state, [name]: value };
|
|
15
|
-
return newState;
|
|
16
|
-
}
|
|
17
|
-
default:
|
|
18
|
-
return state;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function App() {
|
|
23
|
-
|
|
24
|
-
const updateAppState = (name: string, value: object) => {
|
|
25
|
-
console.log(`updateState name: ${name}, configuration: ${value}`);
|
|
26
|
-
return {
|
|
27
|
-
type: UPDATE_APP_STATE,
|
|
28
|
-
payload: {
|
|
29
|
-
name,
|
|
30
|
-
value,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
const store = createStore(appReducer);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
|
|
41
|
-
<Provider store={store}>
|
|
42
|
-
|
|
43
|
-
<TestLabelFunction />
|
|
44
|
-
|
|
45
|
-
<ConfigurationLoader updateAppState={updateAppState} path={null} />
|
|
46
|
-
<LanguageLoader updateAppState={updateAppState} locale='it-IT' path={null} />
|
|
47
|
-
</Provider >
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default App;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import { createStore } from 'redux';
|
|
4
|
+
|
|
5
|
+
import ConfigurationLoader from './lib/ConfigurationLoader';
|
|
6
|
+
import LanguageLoader from './lib/LanguageLoader';
|
|
7
|
+
import TestLabelFunction from './TestLabelFunction';
|
|
8
|
+
|
|
9
|
+
export const UPDATE_APP_STATE = 'UPDATE_APP_STATE';
|
|
10
|
+
const appReducer = (state = {}, action: any) => {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case UPDATE_APP_STATE: {
|
|
13
|
+
const { name, value } = action.payload;
|
|
14
|
+
const newState = { ...state, [name]: value };
|
|
15
|
+
return newState;
|
|
16
|
+
}
|
|
17
|
+
default:
|
|
18
|
+
return state;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
|
|
24
|
+
const updateAppState = (name: string, value: object) => {
|
|
25
|
+
console.log(`updateState name: ${name}, configuration: ${value}`);
|
|
26
|
+
return {
|
|
27
|
+
type: UPDATE_APP_STATE,
|
|
28
|
+
payload: {
|
|
29
|
+
name,
|
|
30
|
+
value,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
const store = createStore(appReducer);
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
|
|
41
|
+
<Provider store={store}>
|
|
42
|
+
|
|
43
|
+
<TestLabelFunction />
|
|
44
|
+
|
|
45
|
+
<ConfigurationLoader updateAppState={updateAppState} path={null} />
|
|
46
|
+
<LanguageLoader updateAppState={updateAppState} locale='it-IT' path={null} />
|
|
47
|
+
</Provider >
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default App;
|
package/src/index.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import App from './App';
|
|
4
|
-
import reportWebVitals from './reportWebVitals';
|
|
5
|
-
|
|
6
|
-
ReactDOM.render(
|
|
7
|
-
<React.StrictMode>
|
|
8
|
-
<App />
|
|
9
|
-
</React.StrictMode>,
|
|
10
|
-
document.getElementById('root')
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
// If you want to start measuring performance in your app, pass a function
|
|
14
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
15
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
16
|
-
reportWebVitals();
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import App from './App';
|
|
4
|
+
import reportWebVitals from './reportWebVitals';
|
|
5
|
+
|
|
6
|
+
ReactDOM.render(
|
|
7
|
+
<React.StrictMode>
|
|
8
|
+
<App />
|
|
9
|
+
</React.StrictMode>,
|
|
10
|
+
document.getElementById('root')
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
// If you want to start measuring performance in your app, pass a function
|
|
14
|
+
// to log results (for example: reportWebVitals(console.log))
|
|
15
|
+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
16
|
+
reportWebVitals();
|
package/src/reportWebVitals.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ReportHandler } from 'web-vitals';
|
|
2
|
-
|
|
3
|
-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
-
getCLS(onPerfEntry);
|
|
7
|
-
getFID(onPerfEntry);
|
|
8
|
-
getFCP(onPerfEntry);
|
|
9
|
-
getLCP(onPerfEntry);
|
|
10
|
-
getTTFB(onPerfEntry);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default reportWebVitals;
|
|
1
|
+
import { ReportHandler } from 'web-vitals';
|
|
2
|
+
|
|
3
|
+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
+
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
+
getCLS(onPerfEntry);
|
|
7
|
+
getFID(onPerfEntry);
|
|
8
|
+
getFCP(onPerfEntry);
|
|
9
|
+
getLCP(onPerfEntry);
|
|
10
|
+
getTTFB(onPerfEntry);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default reportWebVitals;
|
package/src/setupTests.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
2
|
-
// allows you to do things like:
|
|
3
|
-
// expect(element).toHaveTextContent(/react/i)
|
|
4
|
-
// learn more: https://github.com/testing-library/jest-dom
|
|
5
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
2
|
+
// allows you to do things like:
|
|
3
|
+
// expect(element).toHaveTextContent(/react/i)
|
|
4
|
+
// learn more: https://github.com/testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|