diff --git a/client-react/package-lock.json b/client-react/package-lock.json index b3f934423..374e4b699 100644 --- a/client-react/package-lock.json +++ b/client-react/package-lock.json @@ -933,6 +933,11 @@ "loader-utils": "^1.1.0" } }, + "@types/history": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.2.tgz", + "integrity": "sha512-ui3WwXmjTaY73fOQ3/m3nnajU/Orhi6cEu5rzX+BrAAJxa3eITXZ5ch9suPqtM03OWhAHhPSyBGCN4UKoxO20Q==" + }, "@types/jss": { "version": "9.5.7", "resolved": "https://registry.npmjs.org/@types/jss/-/jss-9.5.7.tgz", @@ -942,6 +947,11 @@ "indefinite-observable": "^1.0.1" } }, + "@types/node": { + "version": "10.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.2.tgz", + "integrity": "sha512-53ElVDSnZeFUUFIYzI8WLQ25IhWzb6vbddNp8UHlXQyU0ET2RhV5zg0NfubzU7iNMh5bBXb0htCzfvrSVNgzaQ==" + }, "@types/prop-types": { "version": "15.5.6", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.6.tgz", @@ -956,6 +966,34 @@ "csstype": "^2.2.0" } }, + "@types/react-dom": { + "version": "16.0.9", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.0.9.tgz", + "integrity": "sha512-4Z0bW+75zeQgsEg7RaNuS1k9MKhci7oQqZXxrV5KUGIyXZHHAAL3KA4rjhdH8o6foZ5xsRMSqkoM5A3yRVPR5w==", + "requires": { + "@types/node": "*", + "@types/react": "*" + } + }, + "@types/react-router": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-4.4.0.tgz", + "integrity": "sha512-b16Fpy4nsxC4Ntu72+VAl0kYd1qrT8M5aRGBJ0D4RoY5QeGaA5VguPWu1If2+g2dLNvb8A4vAMQAcDgYdQ4L9w==", + "requires": { + "@types/history": "*", + "@types/react": "*" + } + }, + "@types/react-router-dom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-4.3.1.tgz", + "integrity": "sha512-GbztJAScOmQ/7RsQfO4cd55RuH1W4g6V1gDW3j4riLlt+8yxYLqqsiMzmyuXBLzdFmDtX/uU2Bpcm0cmudv44A==", + "requires": { + "@types/history": "*", + "@types/react": "*", + "@types/react-router": "*" + } + }, "@types/react-transition-group": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-2.0.14.tgz", @@ -5511,11 +5549,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5528,15 +5568,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5639,7 +5682,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5649,6 +5693,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5661,17 +5706,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -5688,6 +5736,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5760,7 +5809,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5770,6 +5820,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5875,6 +5926,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -13927,6 +13979,11 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz", + "integrity": "sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==" + }, "ua-parser-js": { "version": "0.7.19", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.19.tgz", diff --git a/client-react/package.json b/client-react/package.json index 32af6bfd0..32aa3cbc6 100644 --- a/client-react/package.json +++ b/client-react/package.json @@ -4,10 +4,15 @@ "private": true, "dependencies": { "@material-ui/core": "^3.4.0", + "@types/node": "^10.12.2", + "@types/react": "^16.4.18", + "@types/react-dom": "^16.0.9", + "@types/react-router-dom": "^4.3.1", "react": "^16.6.0", "react-dom": "^16.6.0", "react-router-dom": "^4.3.1", - "react-scripts": "2.1.1" + "react-scripts": "2.1.1", + "typescript": "^3.1.6" }, "scripts": { "start": "react-scripts start", diff --git a/client-react/src/App.js b/client-react/src/App.js deleted file mode 100644 index 7e261ca47..000000000 --- a/client-react/src/App.js +++ /dev/null @@ -1,28 +0,0 @@ -import React, { Component } from 'react'; -import logo from './logo.svg'; -import './App.css'; - -class App extends Component { - render() { - return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); - } -} - -export default App; diff --git a/client-react/src/App.test.js b/client-react/src/App.test.tsx similarity index 100% rename from client-react/src/App.test.js rename to client-react/src/App.test.tsx diff --git a/client-react/src/App.tsx b/client-react/src/App.tsx new file mode 100644 index 000000000..3ae8e1416 --- /dev/null +++ b/client-react/src/App.tsx @@ -0,0 +1,21 @@ +import React, { Component } from 'react'; +import './App.css'; + +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; +import { FirstFactor } from './first-factor'; +import { SecondFactor } from './second-factor'; + +class App extends Component { + render() { + return ( + +
+ + +
+
+ ); + } +} + +export default App; diff --git a/client-react/src/first-factor/index.tsx b/client-react/src/first-factor/index.tsx new file mode 100644 index 000000000..601dd1e51 --- /dev/null +++ b/client-react/src/first-factor/index.tsx @@ -0,0 +1,21 @@ +import React, { Component } from "react"; + +import TextField from '@material-ui/core/TextField'; + +export class FirstFactor extends Component { + render() { + return ( +
+ + + + +
+ ) + } +} \ No newline at end of file diff --git a/client-react/src/index.js b/client-react/src/index.tsx similarity index 100% rename from client-react/src/index.js rename to client-react/src/index.tsx diff --git a/client-react/src/react-app-env.d.ts b/client-react/src/react-app-env.d.ts new file mode 100644 index 000000000..6431bc5fc --- /dev/null +++ b/client-react/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/client-react/src/second-factor/index.tsx b/client-react/src/second-factor/index.tsx new file mode 100644 index 000000000..01271f2b5 --- /dev/null +++ b/client-react/src/second-factor/index.tsx @@ -0,0 +1,7 @@ +import React, { Component } from "react"; + +export class SecondFactor extends Component { + render() { + return
second factor
+ } +} \ No newline at end of file diff --git a/client-react/src/serviceWorker.js b/client-react/src/serviceWorker.ts similarity index 96% rename from client-react/src/serviceWorker.js rename to client-react/src/serviceWorker.ts index 2283ff9ce..86af82ce8 100644 --- a/client-react/src/serviceWorker.js +++ b/client-react/src/serviceWorker.ts @@ -20,7 +20,7 @@ const isLocalhost = Boolean( ) ); -export function register(config) { +export function register(config: any) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); @@ -54,7 +54,7 @@ export function register(config) { } } -function registerValidSW(swUrl, config) { +function registerValidSW(swUrl: any, config: any) { navigator.serviceWorker .register(swUrl) .then(registration => { @@ -98,7 +98,7 @@ function registerValidSW(swUrl, config) { }); } -function checkValidServiceWorker(swUrl, config) { +function checkValidServiceWorker(swUrl: any, config: any) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { diff --git a/client-react/tsconfig.json b/client-react/tsconfig.json new file mode 100644 index 000000000..381e4eab4 --- /dev/null +++ b/client-react/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es6", + "allowJs": true, + "skipLibCheck": false, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve" + }, + "include": [ + "src" + ] +}