frontend and backend
1
frontend/.env
Normal file
@ -0,0 +1 @@
|
||||
#REACT_APP_DEV=1
|
23
frontend/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
70
frontend/README.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
32254
frontend/package-lock.json
generated
Normal file
45
frontend/package.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.1",
|
||||
"@testing-library/react": "^12.1.2",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"axiom": "^0.1.6",
|
||||
"axios": "^0.24.0",
|
||||
"bootstrap": "^5.1.3",
|
||||
"react": "^17.0.2",
|
||||
"react-bootstrap": "^2.0.4",
|
||||
"react-copy-to-clipboard": "^5.0.4",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-icons": "^4.3.1",
|
||||
"react-scripts": "5.0.0",
|
||||
"sass": "^1.45.1",
|
||||
"web-vitals": "^2.1.2"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
BIN
frontend/public/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
frontend/public/img/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
frontend/public/img/android-chrome-512x512.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
frontend/public/img/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
9
frontend/public/img/browserconfig.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/img/icons/mstile-150x150.png"/>
|
||||
<TileColor>#5755d9</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
BIN
frontend/public/img/favicon-16x16.png
Normal file
After Width: | Height: | Size: 616 B |
BIN
frontend/public/img/favicon-32x32.png
Normal file
After Width: | Height: | Size: 945 B |
BIN
frontend/public/img/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
frontend/public/img/mstile-150x150.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
142
frontend/public/img/safari-pinned-tab.svg
Normal file
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="1024.000000pt" height="1024.000000pt" viewBox="0 0 1024.000000 1024.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,1024.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M990 10225 c-142 -35 -194 -56 -289 -120 -73 -49 -121 -92 -166 -151
|
||||
-40 -51 -96 -159 -88 -168 3 -3 2 -6 -4 -6 -5 0 -10 -6 -11 -12 0 -7 -7 -42
|
||||
-15 -78 -14 -62 -16 -241 -3 -330 3 -19 8 -56 11 -82 3 -27 8 -72 11 -100 4
|
||||
-29 8 -73 10 -98 3 -25 6 -58 8 -75 2 -16 7 -59 11 -95 3 -36 8 -76 11 -90 2
|
||||
-14 7 -56 10 -95 3 -38 7 -81 10 -95 2 -14 7 -50 9 -80 3 -30 7 -71 10 -90 2
|
||||
-19 7 -57 10 -85 5 -54 12 -115 21 -185 6 -47 12 -101 19 -185 2 -27 4 -50 5
|
||||
-50 3 0 7 -38 15 -120 3 -38 8 -83 10 -100 12 -93 22 -178 31 -270 2 -27 7
|
||||
-70 10 -95 4 -25 7 -58 9 -75 1 -16 5 -52 9 -80 13 -108 19 -161 22 -195 2
|
||||
-19 5 -53 8 -75 3 -22 8 -68 11 -102 3 -34 8 -72 10 -85 3 -21 10 -80 21 -185
|
||||
6 -61 12 -121 19 -173 10 -89 26 -227 30 -270 8 -71 24 -220 30 -272 7 -57 14
|
||||
-117 20 -178 3 -30 7 -68 9 -85 2 -16 6 -59 10 -95 4 -36 9 -76 11 -90 4 -22
|
||||
9 -70 20 -185 4 -38 14 -120 20 -165 3 -19 7 -62 10 -95 8 -86 14 -126 21
|
||||
-136 3 -5 0 -9 -6 -9 -6 0 -8 -5 -4 -11 4 -7 9 -26 11 -43 7 -58 13 -111 18
|
||||
-161 7 -71 12 -123 19 -175 3 -25 8 -65 10 -90 3 -25 10 -88 16 -140 6 -52 13
|
||||
-117 15 -145 3 -27 7 -61 10 -74 4 -23 14 -120 20 -201 2 -19 4 -35 5 -35 2 0
|
||||
8 -50 14 -120 2 -27 5 -50 6 -50 2 0 12 -107 11 -127 0 -10 3 -18 7 -18 4 0 7
|
||||
-19 7 -42 0 -42 11 -164 20 -223 6 -39 16 -130 21 -180 2 -22 6 -58 9 -80 9
|
||||
-69 15 -128 20 -185 2 -30 5 -55 5 -55 1 0 3 -18 5 -40 2 -22 7 -60 10 -85 3
|
||||
-25 8 -63 10 -85 17 -166 24 -227 31 -255 3 -14 7 -37 10 -53 2 -15 11 -41 19
|
||||
-57 9 -17 13 -30 10 -30 -3 0 0 -10 7 -22 7 -13 13 -25 13 -28 3 -15 41 -85
|
||||
48 -88 4 -2 7 -10 7 -18 0 -8 5 -14 10 -14 6 0 10 -4 10 -10 0 -25 117 -136
|
||||
205 -194 72 -48 643 -336 666 -336 5 0 9 -4 9 -10 0 -5 6 -10 12 -10 7 0 85
|
||||
-36 173 -79 88 -43 279 -137 425 -209 367 -180 875 -429 1057 -519 84 -41 156
|
||||
-75 160 -76 4 0 13 -5 18 -9 9 -8 194 -100 205 -103 3 0 127 -61 275 -134 313
|
||||
-154 348 -169 455 -188 48 -9 207 -10 250 -1 19 4 49 10 65 14 17 3 37 8 45
|
||||
11 8 4 17 7 20 8 27 9 61 25 160 73 63 31 117 56 120 57 23 6 487 241 492 249
|
||||
4 6 8 8 8 4 0 -3 63 25 140 63 78 38 144 69 148 69 5 0 14 6 21 12 6 7 15 13
|
||||
19 13 4 1 132 63 284 138 153 75 288 142 300 147 13 6 30 14 38 20 8 5 155 78
|
||||
325 161 1001 490 1219 598 1223 610 2 5 10 9 17 9 7 0 27 12 45 28 145 125
|
||||
218 232 260 383 19 68 25 122 35 274 2 33 4 60 5 60 3 0 7 36 15 115 6 70 9
|
||||
99 20 190 2 19 5 54 7 77 2 24 7 43 11 43 4 0 3 8 -2 19 -6 10 -7 21 -4 25 4
|
||||
4 8 17 9 29 1 12 4 49 8 82 4 33 9 80 12 105 2 25 6 61 10 81 3 20 7 60 9 90
|
||||
6 73 15 163 20 188 2 12 7 49 10 84 4 34 8 82 11 107 3 25 7 65 9 90 2 25 5
|
||||
45 6 45 1 0 3 14 4 30 5 68 15 172 20 205 5 34 11 92 20 195 3 28 7 64 10 80
|
||||
7 41 16 122 20 170 2 22 6 58 9 80 2 22 8 67 11 100 3 33 8 85 12 115 3 30 6
|
||||
70 7 87 0 18 3 33 6 33 3 0 6 17 6 38 3 79 9 122 18 122 5 0 3 6 -3 13 -6 8
|
||||
-9 16 -6 18 5 6 12 47 20 134 17 168 25 245 30 275 3 23 6 48 20 175 7 72 14
|
||||
135 20 175 2 19 7 67 10 105 3 39 8 84 11 100 3 17 7 53 9 80 2 28 7 75 10
|
||||
105 4 30 8 69 10 85 2 17 4 30 5 30 0 0 3 23 5 50 2 28 7 79 11 115 4 36 8 74
|
||||
9 85 1 11 5 43 8 70 12 94 19 160 23 200 6 66 13 127 20 185 10 87 12 111 18
|
||||
180 3 36 8 74 10 85 2 11 7 54 11 95 4 41 9 82 10 91 2 9 6 52 10 95 3 43 8
|
||||
90 10 104 3 14 7 48 10 75 3 28 8 68 10 90 15 125 23 203 30 280 2 28 7 68 10
|
||||
90 3 22 8 67 10 100 2 33 5 60 6 60 0 0 2 11 3 25 2 14 6 50 10 80 3 30 9 82
|
||||
12 115 3 33 7 71 9 85 3 14 7 54 11 90 3 36 7 72 9 80 2 8 6 49 10 90 4 41 9
|
||||
93 12 115 2 22 6 56 8 75 3 33 10 97 20 180 25 220 24 280 -8 416 -8 33 -73
|
||||
160 -103 201 -32 44 -130 141 -163 163 -13 8 -29 20 -35 25 -18 17 -147 73
|
||||
-211 92 -57 17 -247 18 -4140 19 -3361 2 -4090 0 -4135 -11z m4265 -2664 c-8
|
||||
-43 -14 -74 -20 -101 -3 -14 -10 -51 -15 -82 -6 -32 -13 -70 -16 -85 -3 -16
|
||||
-7 -39 -9 -53 -2 -14 -4 -25 -5 -25 -1 0 -3 -9 -5 -20 -2 -11 -7 -36 -11 -55
|
||||
-4 -19 -8 -44 -10 -55 -1 -11 -9 -56 -18 -100 -9 -44 -16 -80 -16 -81 0 -1
|
||||
132 -1 293 -2 275 0 389 -5 447 -17 83 -17 84 -17 155 -40 33 -10 71 -26 85
|
||||
-35 14 -10 35 -20 46 -24 12 -4 51 -35 87 -69 63 -59 111 -134 121 -188 3 -13
|
||||
5 -24 6 -24 4 0 9 -47 11 -100 1 -55 -8 -115 -45 -325 -7 -41 -12 -78 -9 -82
|
||||
2 -5 -1 -8 -7 -8 -6 0 -9 -4 -6 -9 3 -5 1 -33 -4 -62 -6 -30 -13 -69 -16 -88
|
||||
-3 -18 -8 -43 -10 -55 -9 -41 -24 -139 -29 -181 -2 -16 -4 -30 -5 -30 -3 0 -8
|
||||
-26 -14 -79 -3 -22 -10 -62 -15 -90 -6 -28 -12 -62 -15 -76 -11 -70 -19 -117
|
||||
-22 -135 -3 -11 -7 -36 -10 -55 -3 -19 -7 -46 -10 -60 -3 -14 -6 -34 -8 -45
|
||||
-2 -11 -6 -34 -10 -51 l-7 -32 -325 0 -326 0 6 32 c3 17 8 42 11 56 9 42 13
|
||||
63 24 125 6 33 14 74 17 90 3 17 7 39 9 50 1 11 3 20 4 20 1 0 4 14 6 30 2 17
|
||||
6 39 9 51 3 12 8 39 11 60 4 21 10 55 15 74 5 19 11 51 14 70 3 19 10 60 16
|
||||
90 6 30 13 69 16 85 2 17 7 38 10 48 3 10 7 31 10 47 7 48 13 83 19 110 3 14
|
||||
7 39 10 55 6 36 13 71 21 105 3 14 8 59 11 100 4 67 2 79 -19 109 -22 32 -48
|
||||
46 -108 57 -36 6 -559 8 -565 2 -6 -5 -63 -278 -70 -333 -3 -16 -9 -48 -14
|
||||
-70 -6 -22 -13 -56 -16 -75 -3 -19 -10 -53 -15 -75 -5 -22 -12 -56 -15 -75 -3
|
||||
-19 -10 -51 -15 -70 -5 -19 -11 -53 -14 -75 -2 -22 -7 -47 -10 -55 -7 -18 -16
|
||||
-65 -21 -105 -2 -16 -9 -48 -14 -70 -5 -22 -12 -53 -15 -70 -3 -16 -8 -41 -11
|
||||
-55 -10 -50 -17 -85 -20 -105 -2 -11 -9 -42 -15 -70 -6 -27 -13 -61 -15 -75
|
||||
-3 -14 -9 -39 -13 -55 l-8 -30 -307 -1 -307 -2 4 37 c3 20 5 36 6 36 2 0 6 19
|
||||
14 65 3 19 8 46 11 60 3 14 7 36 10 50 3 14 7 36 10 50 3 14 8 39 10 55 3 17
|
||||
8 37 10 45 2 8 7 31 10 50 3 19 17 91 31 160 14 69 27 136 30 150 2 14 7 36
|
||||
10 50 3 14 8 34 10 45 1 11 5 31 8 45 2 14 7 36 10 50 4 14 9 39 11 55 2 17 4
|
||||
30 5 30 1 0 3 11 6 25 2 14 9 48 14 75 6 28 12 61 15 75 4 21 16 81 20 100 1
|
||||
3 5 25 9 50 10 55 10 57 31 155 9 44 19 91 21 105 6 36 15 82 28 139 2 10 7
|
||||
34 10 52 5 33 10 55 22 109 3 14 7 39 10 55 2 17 9 50 15 75 5 25 12 56 14 70
|
||||
3 14 7 36 10 50 2 14 7 37 10 53 3 15 8 39 11 55 4 15 7 36 8 47 1 11 4 25 8
|
||||
30 3 6 10 37 14 70 4 33 9 62 9 65 12 43 15 59 19 80 2 14 7 37 11 51 l7 27
|
||||
309 0 309 0 -5 -27z m2715 -642 c0 -3 15 -6 33 -6 17 -1 59 -7 92 -13 33 -7
|
||||
65 -13 70 -14 110 -21 275 -115 355 -203 85 -92 144 -221 167 -368 18 -121 -5
|
||||
-379 -47 -520 -48 -157 -145 -333 -241 -437 -24 -26 -51 -55 -60 -65 -22 -25
|
||||
-105 -94 -143 -118 -17 -11 -32 -23 -34 -27 -2 -5 -10 -8 -18 -8 -8 0 -14 -5
|
||||
-14 -12 0 -6 -3 -9 -6 -5 -3 3 -24 -5 -45 -19 -61 -38 -223 -98 -293 -109 -17
|
||||
-2 -47 -7 -66 -11 -19 -3 -199 -7 -400 -8 -340 -1 -398 -5 -386 -25 3 -4 1
|
||||
-23 -4 -42 -5 -19 -12 -50 -15 -69 -3 -19 -19 -102 -35 -185 -16 -82 -31 -163
|
||||
-34 -180 -13 -77 -19 -104 -31 -155 -2 -8 -4 -18 -4 -21 -1 -3 -139 -5 -308
|
||||
-5 -266 1 -308 3 -305 16 2 8 6 24 8 35 2 11 6 31 9 45 2 14 7 37 10 53 12 64
|
||||
17 87 36 187 27 137 26 130 49 245 12 55 23 114 25 130 2 17 8 49 14 73 6 23
|
||||
14 58 17 78 6 41 11 68 19 104 7 32 9 43 35 170 11 58 23 116 25 130 2 14 7
|
||||
36 10 50 3 14 8 41 11 60 4 19 11 43 16 54 6 11 6 16 1 13 -6 -4 -4 16 3 43 7
|
||||
27 15 64 19 82 8 46 18 95 37 188 6 30 12 64 14 75 1 11 14 74 27 140 14 66
|
||||
27 134 30 150 3 17 15 75 26 130 12 55 24 116 27 135 3 19 9 51 14 70 10 42
|
||||
22 107 24 135 0 11 5 25 10 30 9 11 1256 15 1256 4z m-4602 -23 c7 -4 12 -2
|
||||
12 4 0 6 5 8 11 5 5 -4 29 -8 52 -10 23 -2 42 -4 42 -5 0 -1 14 -3 30 -4 39
|
||||
-4 167 -36 180 -46 6 -4 23 -10 39 -14 17 -4 42 -16 57 -26 14 -11 29 -17 33
|
||||
-13 3 3 6 1 6 -5 0 -7 7 -12 15 -12 8 0 15 -4 15 -10 0 -5 6 -10 13 -10 23 0
|
||||
144 -126 179 -187 69 -121 96 -236 96 -418 0 -261 -65 -489 -197 -690 -25 -38
|
||||
-53 -79 -61 -89 -17 -22 -161 -166 -182 -181 -48 -37 -119 -83 -153 -100 -22
|
||||
-11 -42 -23 -45 -27 -3 -3 -30 -16 -60 -27 -30 -12 -63 -26 -73 -31 -10 -6
|
||||
-22 -8 -27 -5 -5 3 -11 1 -14 -4 -5 -8 -22 -12 -106 -28 -14 -2 -41 -8 -60
|
||||
-12 -19 -4 -195 -8 -390 -9 -426 -1 -400 0 -398 -9 1 -5 -2 -30 -7 -58 -5 -27
|
||||
-9 -58 -11 -67 -1 -10 -2 -19 -4 -20 -2 -4 -7 -27 -15 -72 -4 -21 -9 -48 -11
|
||||
-60 -5 -21 -6 -28 -19 -101 -4 -22 -13 -71 -21 -108 -8 -38 -12 -73 -8 -78 3
|
||||
-5 1 -9 -3 -9 -5 0 -9 -8 -10 -17 -3 -33 -12 -75 -18 -81 -7 -7 -593 -10 -612
|
||||
-4 -7 2 -10 9 -6 16 4 6 8 16 9 21 11 65 15 88 24 135 6 30 13 65 16 78 2 12
|
||||
7 34 10 50 3 15 10 47 14 72 5 25 11 56 14 70 10 47 30 149 41 208 11 58 18
|
||||
98 22 112 2 8 5 24 7 35 2 11 13 67 25 125 23 115 29 143 36 180 3 14 7 36 11
|
||||
50 3 14 7 36 9 50 2 14 7 39 10 55 4 17 7 38 8 48 1 9 4 17 8 17 4 0 6 8 5 18
|
||||
-2 9 3 42 10 72 7 30 15 69 17 85 3 17 10 53 16 80 11 48 20 98 26 140 1 11 3
|
||||
20 4 20 2 0 4 11 7 25 7 38 33 172 39 200 5 25 11 54 20 100 3 14 7 36 10 50
|
||||
12 58 19 96 21 115 1 11 3 20 4 20 2 0 10 37 14 70 3 17 5 30 6 30 2 0 5 13
|
||||
13 60 3 17 8 42 11 58 13 63 17 84 22 122 6 45 11 52 38 57 38 6 1173 1 1184
|
||||
-6z"/>
|
||||
<path d="M7235 6430 c-2 -3 -6 -21 -9 -40 -3 -19 -10 -59 -16 -89 -5 -30 -8
|
||||
-56 -5 -59 3 -3 0 -11 -6 -19 -6 -7 -9 -13 -6 -13 2 0 -1 -32 -9 -71 -7 -39
|
||||
-13 -74 -12 -77 0 -4 -1 -9 -2 -12 -1 -3 -3 -16 -5 -30 -2 -14 -8 -47 -13 -75
|
||||
-6 -27 -13 -70 -17 -95 -10 -69 -15 -103 -20 -130 -12 -57 -15 -77 -20 -115
|
||||
-7 -48 -13 -80 -15 -80 -9 0 -3 -59 7 -67 7 -6 13 -7 13 -2 0 5 36 9 80 9 44
|
||||
0 80 -4 80 -8 0 -5 6 -5 13 0 17 11 57 12 57 1 0 -5 4 -7 9 -3 5 3 49 8 98 10
|
||||
87 5 136 10 141 15 2 3 3 3 52 14 46 10 170 67 170 77 0 5 5 9 11 9 13 0 99
|
||||
87 99 100 0 4 4 10 8 12 11 4 72 130 77 158 2 11 6 23 8 28 3 4 8 23 11 42 3
|
||||
19 8 46 11 60 15 64 21 172 11 227 -10 65 -66 139 -131 174 -37 21 -131 49
|
||||
-138 42 -3 -3 -12 -1 -19 3 -14 9 -508 13 -513 4z"/>
|
||||
<path d="M2697 6412 c-9 -2 -17 -7 -17 -10 0 -4 -5 -34 -10 -67 -6 -33 -13
|
||||
-76 -15 -95 -3 -19 -8 -46 -11 -58 -3 -13 -7 -43 -10 -65 -3 -23 -7 -49 -10
|
||||
-57 -3 -8 -8 -32 -11 -53 -3 -21 -6 -44 -7 -50 -2 -7 -6 -34 -10 -62 -12 -74
|
||||
-14 -90 -16 -90 -1 0 -3 -16 -5 -35 -7 -51 -13 -95 -15 -95 -1 0 -3 -16 -6
|
||||
-35 -2 -19 -11 -70 -19 -114 -8 -43 -15 -82 -15 -86 0 -8 442 -6 470 2 18 6
|
||||
92 22 102 23 3 0 10 3 14 8 4 4 18 7 31 7 12 0 23 4 23 10 0 5 3 9 8 8 17 -5
|
||||
95 46 145 95 113 110 180 305 180 522 1 64 -4 89 -22 124 -30 58 -74 99 -135
|
||||
127 -48 21 -67 27 -140 40 -31 6 -473 11 -499 6z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 9.8 KiB |
19
frontend/public/img/site.webmanifest
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/img/icons/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/img/icons/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
43
frontend/public/index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="PHP Regular Expression online tester and encoder/decoder tools."
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/img/android-chrome-192x192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>PHP tools - RegExp and D/Encoder</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
25
frontend/public/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "PHP RegExp and D/Encoder",
|
||||
"name": "PHP Regular Expression online tester and encoder/decoder tools.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "/img/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/img/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"start_url": "./index.html",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
3
frontend/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
178
frontend/src/App.js
Normal file
@ -0,0 +1,178 @@
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
import Container from 'react-bootstrap/Container';
|
||||
import Row from 'react-bootstrap/Row';
|
||||
import Col from 'react-bootstrap/Col';
|
||||
|
||||
import Header from "./Header";
|
||||
import Tabs from "./preg/Tabs";
|
||||
import Opts from "./preg/Opts";
|
||||
import Fields from "./preg/Fields";
|
||||
import Return from "./preg/Return";
|
||||
import Code from "./preg/Code";
|
||||
import Output from "./preg/Output";
|
||||
import Footer from "./Footer";
|
||||
import Help from "./preg/Help";
|
||||
|
||||
export default class App extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
method: 'preg_match',
|
||||
pattern: '',
|
||||
replacement: '',
|
||||
subject: '',
|
||||
offset: null,
|
||||
limit: null,
|
||||
delimiter: null,
|
||||
PREG_OFFSET_CAPTURE: false,
|
||||
PREG_UNMATCHED_AS_NULL: false,
|
||||
PREG_SET_ORDER: false,
|
||||
PREG_SPLIT_NO_EMPTY: false,
|
||||
PREG_SPLIT_DELIM_CAPTURE: false,
|
||||
PREG_SPLIT_OFFSET_CAPTURE: false,
|
||||
response: {},
|
||||
help: false
|
||||
}
|
||||
|
||||
this.timer = null
|
||||
this.apiUrl = window.location.href +'api/preg'
|
||||
//this.apiUrl = 'http://localhost:8086/api/preg'
|
||||
this.maps = {
|
||||
'preg_match': {
|
||||
'fields': ['pattern', 'subject'],
|
||||
'opts': ['PREG_OFFSET_CAPTURE', 'PREG_UNMATCHED_AS_NULL', 'offset']
|
||||
},
|
||||
'preg_match_all': {
|
||||
'fields': ['pattern', 'subject'],
|
||||
'opts': ['PREG_PATTERN_ORDER', 'PREG_SET_ORDER', 'PREG_OFFSET_CAPTURE', 'PREG_UNMATCHED_AS_NULL', 'offset']
|
||||
},
|
||||
'preg_split': {
|
||||
'fields': ['pattern', 'subject'],
|
||||
'opts': ['PREG_SPLIT_NO_EMPTY', 'PREG_SPLIT_DELIM_CAPTURE', 'PREG_SPLIT_OFFSET_CAPTURE', 'limit']
|
||||
},
|
||||
'preg_replace': {
|
||||
'fields': ['pattern', 'subject', 'replacement'],
|
||||
'opts': ['limit']
|
||||
},
|
||||
'preg_quote': {
|
||||
'fields': ['pattern'],
|
||||
'opts': ['delimeter']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener("hashchange", this.hashChange, false)
|
||||
this.hashChange()
|
||||
}
|
||||
|
||||
hashChange = () => {
|
||||
const hash = window.location.hash.replace(/^#/, '')
|
||||
|
||||
if (hash && hash !== 'close' && hash !== 'help' && hash !== this.state.response.hash) {
|
||||
axios.get(this.apiUrl, { params: { hash } }).then((res) => {
|
||||
this.setState({ ...res.data, response: {} }, () => {
|
||||
this.api()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
methodSelect = (method) => {
|
||||
this.setState({method}, this.api)
|
||||
}
|
||||
|
||||
handleInputChange = (event) => {
|
||||
const target = event.target
|
||||
const value = (target.type === 'checkbox')?
|
||||
target.checked:
|
||||
(target.type === 'number'?
|
||||
parseInt(target.value):
|
||||
target.value)
|
||||
const name = target.name
|
||||
|
||||
this.setState({ [name]: value }, this.delay)
|
||||
}
|
||||
|
||||
api = () => {
|
||||
const { response, help, ...state } = this.state
|
||||
|
||||
axios.post(this.apiUrl, state).then((res) => {
|
||||
this.setState({ response: res.data }, () => {
|
||||
if ('hash' in res.data) {
|
||||
window.location.hash = '#'+res.data.hash;
|
||||
}
|
||||
})
|
||||
}).catch((error) => {
|
||||
//console.log(error.response)
|
||||
this.setState({ response: {
|
||||
fatal: (error.response? error.response.data.fatal: error.message)
|
||||
} }, () => {
|
||||
window.history.replaceState(null, null, ' ');
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
delay = () => {
|
||||
clearTimeout(this.timer)
|
||||
this.timer = setTimeout(this.api, 200)
|
||||
}
|
||||
|
||||
showHelp = (show) => {
|
||||
this.setState({ help: show })
|
||||
}
|
||||
|
||||
render() {
|
||||
const { method, pattern, replacement, subject, response, help, ...state } = this.state
|
||||
const maps = this.maps[method]
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header method={method} hash={response.hash? window.location.origin+"/#"+response.hash: null} onClick={() => this.showHelp(true)} />
|
||||
|
||||
<Container>
|
||||
<Row className="mt-3 mb-3">
|
||||
<Col>
|
||||
<Tabs method={method} functions={Object.keys(this.maps)} onChange={this.methodSelect} />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Fields method={method} fields={maps.fields} pattern={pattern} replacement={replacement} subject={subject} onChange={this.handleInputChange} />
|
||||
|
||||
<div className="separator">options</div>
|
||||
<Opts method={method} opts={maps.opts} {...state} onChange={this.handleInputChange} />
|
||||
|
||||
<Row className="mt-3">
|
||||
<Col xs="3" sm="2">
|
||||
<div className="separator">return</div>
|
||||
<Return response={response} />
|
||||
</Col>
|
||||
<Col>
|
||||
<div className="separator">snippet</div>
|
||||
<Code response={response} />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row className="mt-3">
|
||||
<Col>
|
||||
<div className="separator">$matches or result</div>
|
||||
<Output response={response} />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row className="mt-3 text-end">
|
||||
<Col>
|
||||
<Footer />
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
|
||||
<Help show={help} onHide={() => this.showHelp(false)} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
16
frontend/src/Footer.js
Normal file
@ -0,0 +1,16 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { BsFileEarmarkCodeFill, BsTwitter } from "react-icons/bs";
|
||||
|
||||
export default class Footer extends Component {
|
||||
render() {
|
||||
return (
|
||||
<footer>
|
||||
<small>
|
||||
Coded by <a href="https://twitter.com/xergio">Sergio Álvarez <BsTwitter /></a>{' '}
|
||||
<span className="text-muted">¦</span>{' '}
|
||||
<a href="https://sergio.am/code/xrg.es"><BsFileEarmarkCodeFill /></a></small>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
}
|
53
frontend/src/Header.js
Normal file
@ -0,0 +1,53 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
||||
|
||||
import { BsFillQuestionCircleFill, BsFillInfoCircleFill } from "react-icons/bs";
|
||||
import { FiPaperclip } from "react-icons/fi";
|
||||
|
||||
import Container from 'react-bootstrap/Container';
|
||||
import Navbar from 'react-bootstrap/Navbar';
|
||||
import Nav from 'react-bootstrap/Nav';
|
||||
|
||||
export default class Header extends Component {
|
||||
state = {
|
||||
copied: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Navbar bg="light" expand="sm">
|
||||
<Container>
|
||||
<Navbar.Brand href="/">
|
||||
<img
|
||||
alt=""
|
||||
src="/img/safari-pinned-tab.svg"
|
||||
width="30"
|
||||
height="30"
|
||||
className="d-inline-block align-top"
|
||||
/>{' '}
|
||||
<strong>XRG</strong>
|
||||
</Navbar.Brand>
|
||||
<Navbar.Toggle aria-controls="basic-navbar-nav" />
|
||||
<Navbar.Collapse id="basic-navbar-nav">
|
||||
<Nav className="me-auto">
|
||||
<Nav.Link href="/">RegExp</Nav.Link>
|
||||
<Nav.Link href="/dencode">D/Encode</Nav.Link>
|
||||
</Nav>
|
||||
<Nav>
|
||||
{this.props.hash &&
|
||||
<Nav.Link href={this.props.hash} title="Permalink" className="text-success">
|
||||
<CopyToClipboard text={this.props.hash} onCopy={() => this.setState({copied: true})}>
|
||||
<FiPaperclip />
|
||||
</CopyToClipboard>
|
||||
</Nav.Link>
|
||||
}
|
||||
<Nav.Link href={'https://php.net/'+this.props.method} title="PHP.net documentation"><BsFillInfoCircleFill /></Nav.Link>
|
||||
<Nav.Link href="#help" title="Help" onClick={this.props.onClick}><BsFillQuestionCircleFill /></Nav.Link>
|
||||
</Nav>
|
||||
</Navbar.Collapse>
|
||||
</Container>
|
||||
</Navbar>
|
||||
)
|
||||
}
|
||||
}
|
35
frontend/src/_bootswatch.scss
Normal file
@ -0,0 +1,35 @@
|
||||
// Cosmo 5.1.3
|
||||
// Bootswatch
|
||||
|
||||
|
||||
// Variables
|
||||
|
||||
$web-font-path: "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;700&display=swap" !default;
|
||||
@if $web-font-path {
|
||||
@import url($web-font-path);
|
||||
}
|
||||
|
||||
// Typography
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
// Indicators
|
||||
|
||||
.badge {
|
||||
&.bg-light {
|
||||
color: $dark;
|
||||
}
|
||||
}
|
||||
|
||||
// Progress bars
|
||||
|
||||
.progress {
|
||||
@include box-shadow(none);
|
||||
|
||||
.progress-bar {
|
||||
font-size: 8px;
|
||||
line-height: 8px;
|
||||
}
|
||||
}
|
69
frontend/src/_variables.scss
Normal file
@ -0,0 +1,69 @@
|
||||
// Cosmo 5.1.3
|
||||
// Bootswatch
|
||||
|
||||
$theme: "cosmo" !default;
|
||||
|
||||
//
|
||||
// Color system
|
||||
//
|
||||
|
||||
$white: #fff !default;
|
||||
$gray-100: #f8f9fa !default;
|
||||
$gray-200: #e9ecef !default;
|
||||
$gray-300: #dee2e6 !default;
|
||||
$gray-400: #ced4da !default;
|
||||
$gray-500: #adb5bd !default;
|
||||
$gray-600: #868e96 !default;
|
||||
$gray-700: #495057 !default;
|
||||
$gray-800: #373a3c !default;
|
||||
$gray-900: #212529 !default;
|
||||
$black: #000 !default;
|
||||
|
||||
$blue: #2780e3 !default;
|
||||
$indigo: #6610f2 !default;
|
||||
$purple: #613d7c !default;
|
||||
$pink: #e83e8c !default;
|
||||
$red: #ff0039 !default;
|
||||
$orange: #f0ad4e !default;
|
||||
$yellow: #ff7518 !default;
|
||||
$green: #3fb618 !default;
|
||||
$teal: #20c997 !default;
|
||||
$cyan: #9954bb !default;
|
||||
|
||||
$primary: $blue !default;
|
||||
$secondary: $gray-800 !default;
|
||||
$success: $green !default;
|
||||
$info: $cyan !default;
|
||||
$warning: $yellow !default;
|
||||
$danger: $red !default;
|
||||
$light: $gray-100 !default;
|
||||
$dark: $gray-800 !default;
|
||||
|
||||
$min-contrast-ratio: 2.6 !default;
|
||||
|
||||
// Options
|
||||
|
||||
$enable-rounded: false !default;
|
||||
|
||||
// Body
|
||||
|
||||
$body-color: $gray-800 !default;
|
||||
|
||||
// Fonts
|
||||
|
||||
// stylelint-disable-next-line value-keyword-case
|
||||
$font-family-sans-serif: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;
|
||||
$headings-font-weight: 400 !default;
|
||||
|
||||
// Navbar
|
||||
|
||||
$navbar-dark-hover-color: rgba($white, 1) !default;
|
||||
$navbar-light-hover-color: rgba($black, .9) !default;
|
||||
|
||||
// Alerts
|
||||
|
||||
$alert-border-width: 0 !default;
|
||||
|
||||
// Progress bars
|
||||
|
||||
$progress-height: .5rem !default;
|
11
frontend/src/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.scss';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
43
frontend/src/index.scss
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
.separator {
|
||||
display: flex;
|
||||
color: #ddd;
|
||||
font-size: .9rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
/*.separator::after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
height: 0.08rem;
|
||||
background: linear-gradient(90deg, rgba(231,233,237,1) 0%, rgba(255,255,255,1) 80%);
|
||||
transform: translateY(.75rem);
|
||||
}
|
||||
|
||||
.separator:not(:empty)::after {
|
||||
margin-left: .25em;
|
||||
}*/
|
||||
|
||||
//$body-bg: #567890;
|
||||
|
||||
.table {
|
||||
width: unset !important;
|
||||
}
|
||||
|
||||
table td:first-child:before {
|
||||
content: '[';
|
||||
color: var(--bs-table-bg);
|
||||
}
|
||||
|
||||
table td:first-child:after {
|
||||
content: ']';
|
||||
color: var(--bs-table-bg);
|
||||
}
|
||||
|
||||
.nav-item:hover {
|
||||
background-color: #eaeaea !important;
|
||||
}
|
||||
|
||||
@import "_variables";
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
@import "_bootswatch";
|
19
frontend/src/preg/Code.js
Normal file
@ -0,0 +1,19 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
function createMarkup(html) {
|
||||
return {__html: html}
|
||||
}
|
||||
|
||||
export default class Code extends Component {
|
||||
render() {
|
||||
const { response } = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{'code' in response &&
|
||||
<code dangerouslySetInnerHTML={createMarkup(response.code)} />
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
29
frontend/src/preg/Fields.js
Normal file
@ -0,0 +1,29 @@
|
||||
import React, { Component } from 'react';
|
||||
import Form from 'react-bootstrap/Form';
|
||||
|
||||
export default class Fields extends Component {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
{this.props.fields.includes('pattern') &&
|
||||
<Form.Group className="mb-3" controlId="pattern">
|
||||
<Form.Label>Regular Expression / Pattern</Form.Label>
|
||||
<Form.Control type="text" onChange={this.props.onChange} name="pattern" value={this.props.pattern} placeholder="#...#" className="font-monospace" />
|
||||
</Form.Group>
|
||||
}
|
||||
{this.props.fields.includes('replacement') &&
|
||||
<Form.Group className="mb-3" controlId="replacement">
|
||||
<Form.Label>Replacement</Form.Label>
|
||||
<Form.Control type="text" onChange={this.props.onChange} name="replacement" value={this.props.replacement} />
|
||||
</Form.Group>
|
||||
}
|
||||
{this.props.fields.includes('subject') &&
|
||||
<Form.Group className="mb-3" controlId="subject">
|
||||
<Form.Label>String / Subject</Form.Label>
|
||||
<Form.Control as="textarea" onChange={this.props.onChange} name="subject" value={this.props.subject} rows={3} />
|
||||
</Form.Group>
|
||||
}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
102
frontend/src/preg/Help.js
Normal file
@ -0,0 +1,102 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import Container from 'react-bootstrap/Container';
|
||||
import Row from 'react-bootstrap/Row';
|
||||
import Col from 'react-bootstrap/Col';
|
||||
import Modal from 'react-bootstrap/Modal';
|
||||
|
||||
export default class Help extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Modal {...this.props} size="xl">
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Regexp spreadsheet (<a href="http://php.net/manual/en/pcre.pattern.php">full documentation</a>)</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<Container>
|
||||
<Row>
|
||||
<Col>
|
||||
<h4>Pattern Modifiers</h4>
|
||||
<div><code>i</code> PCRE_CASELESS</div>
|
||||
<div><code>m</code> PCRE_MULTILINE</div>
|
||||
<div><code>s</code> PCRE_DOTALL</div>
|
||||
<div><code>x</code> PCRE_EXTENDED</div>
|
||||
<div><code>A</code> PCRE_ANCHORED</div>
|
||||
<div><code>D</code> PCRE_DOLLAR_ENDONLY</div>
|
||||
<div><code>S</code> Extra analysis</div>
|
||||
<div><code>U</code> PCRE_UNGREEDY</div>
|
||||
<div><code>X</code> PCRE_EXTRA</div>
|
||||
<div><code>J</code> PCRE_INFO_JCHANGED</div>
|
||||
<div><code>u</code> PCRE_UTF8</div>
|
||||
</Col>
|
||||
|
||||
<Col>
|
||||
<h4>Meta-characters outside <code>[ ]</code></h4>
|
||||
<div><code>\</code> general escape character</div>
|
||||
<div><code>^</code> assert start of subject (or line, in multiline mode)</div>
|
||||
<div><code>$</code> assert end of subject (or line, in multiline mode)</div>
|
||||
<div><code>.</code> match any character except newline (by default)</div>
|
||||
<div><code>[ ]</code> character class definition</div>
|
||||
<div><code>|</code> start of alternative branch</div>
|
||||
<div><code>( )</code> subpattern</div>
|
||||
<div><code>?</code> extends the meaning of '(', also 0 or 1 quantifier</div>
|
||||
<div><code>*</code> 0 or more quantifier</div>
|
||||
<div><code>+</code> 1 or more quantifier</div>
|
||||
<div><code>{'{ }'}</code> min/max quantifier, {'{n[,n]}'}</div>
|
||||
|
||||
<h4 className="mt-4">Meta-characters inside <code>[ ]</code></h4>
|
||||
<div><code>\</code> general escape character</div>
|
||||
<div><code>^</code> negate the class, but only if the first character</div>
|
||||
<div><code>-</code> indicates character range</div>
|
||||
|
||||
<h4 className="mt-4">Others</h4>
|
||||
<div><code>{'\\1-9'}</code> in-group back references</div>
|
||||
<div><code>(?P<lbl>...)</code> labelize subpatterns</div>
|
||||
<div><code>(?:...)</code> non-capture group</div>
|
||||
<div><code>(?>...)</code> Atomic group</div>
|
||||
<div><code>(?=...)</code> Positive lookahead</div>
|
||||
<div><code>(?!...)</code> Negative lookahead</div>
|
||||
<div><code>(?<=..)</code> Positive lookbehind</div>
|
||||
<div><code>(?<!..)</code> Negative lookbehind</div>
|
||||
<div><code>(?(?=.).|.)</code> if . then . else .</div>
|
||||
<div><code>(?#...)</code> Comment</div>
|
||||
</Col>
|
||||
|
||||
<Col>
|
||||
<h4>Scape sequences</h4>
|
||||
<div><code>\a</code> alarm, that is, the BEL character (hex 07)</div>
|
||||
<div><code>\cx</code> "control-x", where x is any character</div>
|
||||
<div><code>\e</code> escape (hex 1B)</div>
|
||||
<div><code>\f</code> formfeed (hex 0C)</div>
|
||||
<div><code>\n</code> newline (hex 0A)</div>
|
||||
<div><code>\r</code> carriage return (hex 0D)</div>
|
||||
<div><code>\R</code> line break: matches \n, \r and \r\n</div>
|
||||
<div><code>\t</code> tab (hex 09)</div>
|
||||
<div><code>\p{'{xx}'}</code> a character with the xx <a href="http://www.php.net/manual/en/regexp.reference.unicode.php">property</a></div>
|
||||
<div><code>\P{'{xx}'}</code> a character without the xx <a href="http://www.php.net/manual/en/regexp.reference.unicode.php">property</a></div>
|
||||
<div><code>\xhh</code> character with hex code hh</div>
|
||||
<div><code>\ddd</code> character with octal code ddd, or backreference</div>
|
||||
<div><code>\d</code> any decimal digit</div>
|
||||
<div><code>\D</code> any character that is not a decimal digit</div>
|
||||
<div><code>\s</code> any whitespace character</div>
|
||||
<div><code>\S</code> any character that is not a whitespace character</div>
|
||||
<div><code>\h</code> any horizontal whitespace character</div>
|
||||
<div><code>\H</code> any character that is not a horizontal whitespace</div>
|
||||
<div><code>\v</code> any vertical whitespace character</div>
|
||||
<div><code>\V</code> any character that is not a vertical whitespace character</div>
|
||||
<div><code>\w</code> any "word" character</div>
|
||||
<div><code>\W</code> any "non-word" character</div>
|
||||
<div><code>\b</code> word boundary</div>
|
||||
<div><code>\B</code> not a word boundary</div>
|
||||
<div><code>\A</code> start of subject (independent of multiline mode)</div>
|
||||
<div><code>\Z</code> end of subject or newline at end (independent of multiline mode)</div>
|
||||
<div><code>\z</code> end of subject (independent of multiline mode)</div>
|
||||
<div><code>\G</code> first matching position in subject</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
55
frontend/src/preg/Opts.js
Normal file
@ -0,0 +1,55 @@
|
||||
import React, { Component } from 'react';
|
||||
import Form from 'react-bootstrap/Form';
|
||||
import InputGroup from 'react-bootstrap/InputGroup';
|
||||
import Col from 'react-bootstrap/Col';
|
||||
|
||||
function Checkbox(props) {
|
||||
return props.opts.includes(props.id)? (
|
||||
<Form.Group className="mb-3" controlId={props.id}>
|
||||
<Form.Check type="checkbox" name={props.id} label={props.id} checked={props[props.id]} onChange={props.onChange} />
|
||||
</Form.Group>
|
||||
): '';
|
||||
}
|
||||
|
||||
export default class Opts extends Component {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
{this.props.opts.includes('PREG_SET_ORDER') &&
|
||||
<p className="text-muted"><tt>PREG_PATTERN_ORDER</tt> is the default order method.</p>
|
||||
}
|
||||
<Checkbox id="PREG_SET_ORDER" {...this.props} />
|
||||
<Checkbox id="PREG_OFFSET_CAPTURE" {...this.props} />
|
||||
<Checkbox id="PREG_UNMATCHED_AS_NULL" {...this.props} />
|
||||
<Checkbox id="PREG_SPLIT_NO_EMPTY" {...this.props} />
|
||||
<Checkbox id="PREG_SPLIT_DELIM_CAPTURE" {...this.props} />
|
||||
<Checkbox id="PREG_SPLIT_OFFSET_CAPTURE" {...this.props} />
|
||||
|
||||
{this.props.opts.includes('offset') &&
|
||||
<Col xl="2" md="3" sm="4" xs="6">
|
||||
<InputGroup className="mb-3">
|
||||
<InputGroup.Text id="offset">offset</InputGroup.Text>
|
||||
<Form.Control type="number" name="offset" placeholder="0" aria-label="offset" aria-describedby="offset" value={this.props.offset ?? ''} onChange={this.props.onChange} min="0" />
|
||||
</InputGroup>
|
||||
</Col>
|
||||
}
|
||||
{this.props.opts.includes('limit') &&
|
||||
<Col xl="2" md="3" sm="4" xs="6">
|
||||
<InputGroup className="mb-3">
|
||||
<InputGroup.Text id="limit">limit</InputGroup.Text>
|
||||
<Form.Control type="number" name="limit" placeholder="-1" aria-label="limit" aria-describedby="limit" value={this.props.limit ?? ''} onChange={this.props.onChange} min="-1" />
|
||||
</InputGroup>
|
||||
</Col>
|
||||
}
|
||||
{this.props.opts.includes('delimeter') &&
|
||||
<Col xl="2" md="3" sm="4" xs="6">
|
||||
<InputGroup className="mb-3">
|
||||
<InputGroup.Text id="delimiter">delimiter</InputGroup.Text>
|
||||
<Form.Control name="delimiter" aria-label="delimiter" aria-describedby="delimiter" value={this.props.delimiter ?? ''} onChange={this.props.onChange} />
|
||||
</InputGroup>
|
||||
</Col>
|
||||
}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
70
frontend/src/preg/Output.js
Normal file
@ -0,0 +1,70 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import Table from 'react-bootstrap/Table'
|
||||
|
||||
function mapObject(object, callback) {
|
||||
return Object.keys(object).map(key => {
|
||||
return callback(key, object[key])
|
||||
})
|
||||
}
|
||||
|
||||
const DumpList = (props) => {
|
||||
const type = typeof props.dump
|
||||
|
||||
if (type === "object") {
|
||||
if (Object.keys(props.dump).length === 0) {
|
||||
return <tt className="text-secondary">[]</tt>
|
||||
}
|
||||
|
||||
const items = mapObject(props.dump, (key, value) => {
|
||||
if (['number', 'string'].includes(typeof value)) {
|
||||
// .replace(" ", '⎵')
|
||||
return (
|
||||
<tr key={key}>
|
||||
<td className="table-active text-end text-muted font-monospace">{key}</td>
|
||||
<td className="px-2">{value}</td>
|
||||
</tr>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<tr key={key}>
|
||||
<td className="table-active text-end text-muted font-monospace">{key}</td>
|
||||
<td><DumpList dump={value} indent={props.indent + 1} /></td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Table borderless variant="light" size="sm">
|
||||
<tbody>
|
||||
{items}
|
||||
</tbody>
|
||||
</Table>
|
||||
)
|
||||
|
||||
} else if (type === 'string') {
|
||||
return (<tt>{props.dump}</tt>)
|
||||
}
|
||||
|
||||
return (<em>empty result</em>)
|
||||
}
|
||||
|
||||
export default class Output extends Component {
|
||||
render() {
|
||||
const { response } = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{'fatal' in response &&
|
||||
<div>
|
||||
<code>{response.fatal}</code>
|
||||
</div>
|
||||
}
|
||||
{'dump' in response &&
|
||||
<DumpList dump={response.dump} indent={0} />
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
18
frontend/src/preg/Return.js
Normal file
@ -0,0 +1,18 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
export default class Return extends Component {
|
||||
render() {
|
||||
const { response } = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{'returnType' in response && 'returnValue' in response &&
|
||||
<span>
|
||||
<code>{response.returnType}</code>:{' '}<code>{response.returnValue}</code>
|
||||
</span>
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
20
frontend/src/preg/Tabs.js
Normal file
@ -0,0 +1,20 @@
|
||||
import React, { Component } from 'react';
|
||||
import Nav from 'react-bootstrap/Nav';
|
||||
|
||||
export default class Tabs extends Component {
|
||||
render() {
|
||||
const tabs = this.props.functions.map((func) => {
|
||||
return (
|
||||
<Nav.Item key={func} className="bg-light font-monospace"><Nav.Link eventKey={func}>{func}</Nav.Link></Nav.Item>
|
||||
)
|
||||
})
|
||||
|
||||
return (
|
||||
<Nav fill variant="pills" defaultActiveKey={this.props.functions[0]} activeKey={this.props.method} onSelect={this.props.onChange}>
|
||||
{tabs}
|
||||
</Nav>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|