Created
December 11, 2019 14:22
-
-
Save alexstrat/a40076659314a7b1a306a874d3b0dae2 to your computer and use it in GitHub Desktop.
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
diff --git a/package.json b/package.json | |
index 6075c4c..da958f0 100644 | |
--- a/package.json | |
+++ b/package.json | |
@@ -26,6 +26,7 @@ | |
"@types/react": "^16.9.13", | |
"@types/react-dom": "^16.9.4", | |
"@types/react-jss": "^10.0.0", | |
+ "@types/react-router-dom": "^5.1.3", | |
"@types/terser-webpack-plugin": "^2.2.0", | |
"@types/webpack": "^4.41.0", | |
"@types/webpack-dev-server": "^3.4.0", | |
@@ -57,15 +58,17 @@ | |
"build:production": "webpack --mode=production && yarn run build:storybook", | |
"build:storybook": "build-storybook -o dist/__storybook", | |
"start": "webpack-dev-server", | |
+ "dev": "webpack-dev-server", | |
"lint": "tslint -p .", | |
"storybook": "start-storybook -p 6006" | |
}, | |
"dependencies": { | |
+ "@getstation/use-firebase-auth": "2.0.0-rc.0", | |
"firebase": "^7.5.1", | |
"react": "^16.12.0", | |
"react-dom": "^16.12.0", | |
"react-jss": "^10.0.0", | |
- "@getstation/use-firebase-auth": "2.0.0-rc.0" | |
+ "react-router-dom": "^5.1.2", | |
"use-async-effect": "^2.2.1" | |
}, | |
"husky": { | |
diff --git a/src/App.tsx b/src/App.tsx | |
index 7f96636..a9696e7 100644 | |
--- a/src/App.tsx | |
+++ b/src/App.tsx | |
@@ -1,14 +1,32 @@ | |
import * as React from 'react'; | |
- | |
-import { AppConfig } from '../config/types'; | |
+import { | |
+ BrowserRouter as Router, | |
+ Switch, | |
+ Route, | |
+} from 'react-router-dom'; | |
+import firebase from 'firebase/app'; | |
+import { FirebaseAuthProvider } from '@getstation/use-firebase-auth'; | |
import AuthorizePage from './AuthorizePage'; | |
+import VerifyEmailAddressPage from './pages/VerifyEmailAddressPage'; | |
-declare const CONFIG: AppConfig; | |
+firebase.initializeApp(CONFIG.firebase); | |
const App = () => { | |
return ( | |
- <AuthorizePage firebaseConfig={CONFIG.firebase} /> | |
+ <FirebaseAuthProvider firebase={firebase} > | |
+ <Router> | |
+ <Switch> | |
+ <Route path="/authenticate*"> | |
+ <AuthorizePage /> | |
+ </Route> | |
+ <Route path="/verify-email*"> | |
+ <VerifyEmailAddressPage /> | |
+ </Route> | |
+ </Switch> | |
+ </Router> | |
+ </FirebaseAuthProvider > | |
+ | |
); | |
}; | |
diff --git a/src/AuthorizePage/AuthenticationBox/index.tsx b/src/AuthorizePage/AuthenticationBox/index.tsx | |
index b1b9738..46052e4 100644 | |
--- a/src/AuthorizePage/AuthenticationBox/index.tsx | |
+++ b/src/AuthorizePage/AuthenticationBox/index.tsx | |
@@ -1,12 +1,9 @@ | |
import * as React from 'react'; | |
import { useFirebaseAuth } from '@getstation/use-firebase-auth'; | |
-import { FirebaseConfig } from '../../../config/types'; | |
- | |
import DummyLogInPane from './dummy/LogInPane'; | |
import DummySignUpPane from './dummy/SignUpPane'; | |
import DummySendResetPasswordPane from './dummy/SendResetPasswordPane'; | |
-import FirebaseContainer from './FirebaseContainer'; | |
import useNavigationPane, { Panes } from './hooks/useNavigationPane'; | |
import useSignUp from './hooks/useSignUpForm'; | |
import useLogIn from './hooks/useLogInForm'; | |
@@ -51,18 +48,4 @@ const AuthenticationBox = (props: Props) => { | |
); | |
}; | |
-type AuthenticationBoxContainerProps = { | |
- firebaseConfig: FirebaseConfig, | |
-}; | |
- | |
-const AuthenticationBoxContainer = (props: Props & AuthenticationBoxContainerProps) => { | |
- const { firebaseConfig, ...restProps } = props; | |
- | |
- return ( | |
- <FirebaseContainer firebaseConfig={firebaseConfig}> | |
- <AuthenticationBox {...restProps} /> | |
- </FirebaseContainer> | |
- ); | |
-}; | |
- | |
-export default AuthenticationBoxContainer; | |
+export default AuthenticationBox; | |
diff --git a/src/AuthorizePage/index.tsx b/src/AuthorizePage/index.tsx | |
index dccf867..6410156 100644 | |
--- a/src/AuthorizePage/index.tsx | |
+++ b/src/AuthorizePage/index.tsx | |
@@ -12,9 +12,7 @@ export default (props: Props) => { | |
return ( | |
<div> | |
<h1>Sign in to Station</h1> | |
- <AuthenticationBox | |
- firebaseConfig={props.firebaseConfig} | |
- /> | |
+ <AuthenticationBox /> | |
</div> | |
); | |
}; | |
diff --git a/src/index.tsx b/src/index.tsx | |
index 6eb56f8..1b989c3 100644 | |
--- a/src/index.tsx | |
+++ b/src/index.tsx | |
@@ -9,6 +9,7 @@ const renderedApp = ( | |
<App /> | |
); | |
-const rootElement = document.getElementById('root'); | |
+// todo: add to root | |
+const rootElement = document.body; | |
ReactDOM.render(renderedApp, rootElement); | |
diff --git a/types.ts b/types.ts | |
deleted file mode 100644 | |
index d3eb96e..0000000 | |
--- a/types.ts | |
+++ /dev/null | |
@@ -1,7 +0,0 @@ | |
-import { AppConfig } from './config/types'; | |
- | |
-declare namespace NodeJS { | |
- export interface Global { | |
- CONFIG: AppConfig; | |
- } | |
-} | |
diff --git a/webpack.config.ts b/webpack.config.ts | |
index 950d96c..1572719 100644 | |
--- a/webpack.config.ts | |
+++ b/webpack.config.ts | |
@@ -2,7 +2,6 @@ import { CleanWebpackPlugin } from 'clean-webpack-plugin'; | |
import HtmlWebpackPlugin from 'html-webpack-plugin'; | |
import TerserPlugin from 'terser-webpack-plugin'; | |
import CopyWebpackPlugin from 'copy-webpack-plugin'; | |
- | |
import * as webpack from 'webpack'; | |
const config: webpack.ConfigurationFactory = (env, conf) => ({ | |
@@ -14,6 +13,9 @@ const config: webpack.ConfigurationFactory = (env, conf) => ({ | |
template: 'src/authenticate.html', | |
filename: 'authenticate.html', | |
}), | |
+ new HtmlWebpackPlugin({ | |
+ filename: 'verify-email.html', | |
+ }), | |
new HtmlWebpackPlugin({ | |
template: 'src/index.html', | |
filename: 'index.html', | |
diff --git a/yarn.lock b/yarn.lock | |
index 2bd3c60..ccb8dfd 100644 | |
--- a/yarn.lock | |
+++ b/yarn.lock | |
@@ -1557,6 +1557,13 @@ | |
dependencies: | |
regenerator-runtime "^0.13.2" | |
+"@babel/runtime@^7.4.0": | |
+ version "7.7.6" | |
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.6.tgz#d18c511121aff1b4f2cd1d452f1bac9601dd830f" | |
+ integrity sha512-BWAJxpNVa0QlE5gZdWjSxXtemZyZ9RmrmVozxt3NUXeZhVIJ5ANyqmMc0JDrivBZyxUuQvFxlvH4OWWOogGfUw== | |
+ dependencies: | |
+ regenerator-runtime "^0.13.2" | |
+ | |
"@babel/template@^7.4.0", "@babel/template@^7.7.0": | |
version "7.7.0" | |
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.0.tgz#4fadc1b8e734d97f56de39c77de76f2562e597d0" | |
@@ -3214,6 +3221,23 @@ | |
dependencies: | |
react-jss "*" | |
+"@types/react-router-dom@^5.1.3": | |
+ version "5.1.3" | |
+ resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.1.3.tgz#b5d28e7850bd274d944c0fbbe5d57e6b30d71196" | |
+ integrity sha512-pCq7AkOvjE65jkGS5fQwQhvUp4+4PVD9g39gXLZViP2UqFiFzsEpB3PKf0O6mdbKsewSK8N14/eegisa/0CwnA== | |
+ dependencies: | |
+ "@types/history" "*" | |
+ "@types/react" "*" | |
+ "@types/react-router" "*" | |
+ | |
+"@types/react-router@*": | |
+ version "5.1.3" | |
+ resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.3.tgz#7c7ca717399af64d8733d8cb338dd43641b96f2d" | |
+ integrity sha512-0gGhmerBqN8CzlnDmSgGNun3tuZFXerUclWkqEhozdLaJtfcJRUTGkKaEKk+/MpHd1KDS1+o2zb/3PkBUiv2qQ== | |
+ dependencies: | |
+ "@types/history" "*" | |
+ "@types/react" "*" | |
+ | |
"@types/[email protected]": | |
version "10.1.0" | |
resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-10.1.0.tgz#9c534e29bbe05dba9beae1234f3ae944836685d4" | |
@@ -7392,6 +7416,18 @@ highlight.js@~9.12.0: | |
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" | |
integrity sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4= | |
+history@^4.9.0: | |
+ version "4.10.1" | |
+ resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" | |
+ integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== | |
+ dependencies: | |
+ "@babel/runtime" "^7.1.2" | |
+ loose-envify "^1.2.0" | |
+ resolve-pathname "^3.0.0" | |
+ tiny-invariant "^1.0.2" | |
+ tiny-warning "^1.0.0" | |
+ value-equal "^1.0.1" | |
+ | |
hmac-drbg@^1.0.0: | |
version "1.0.1" | |
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" | |
@@ -7406,7 +7442,7 @@ hoist-non-react-statics@^2.5.0: | |
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" | |
integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== | |
-hoist-non-react-statics@^3.2.0, hoist-non-react-statics@^3.3.0: | |
+hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.2.0, hoist-non-react-statics@^3.3.0: | |
version "3.3.1" | |
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#101685d3aff3b23ea213163f6e8e12f4f111e19f" | |
integrity sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw== | |
@@ -9308,7 +9344,7 @@ long@~3: | |
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" | |
integrity sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s= | |
-loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: | |
+loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0: | |
version "1.4.0" | |
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" | |
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== | |
@@ -9617,6 +9653,15 @@ min-document@^2.19.0: | |
dependencies: | |
dom-walk "^0.1.0" | |
+mini-create-react-context@^0.3.0: | |
+ version "0.3.2" | |
+ resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz#79fc598f283dd623da8e088b05db8cddab250189" | |
+ integrity sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw== | |
+ dependencies: | |
+ "@babel/runtime" "^7.4.0" | |
+ gud "^1.0.0" | |
+ tiny-warning "^1.0.2" | |
+ | |
mini-css-extract-plugin@^0.7.0: | |
version "0.7.0" | |
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.7.0.tgz#5ba8290fbb4179a43dd27cca444ba150bee743a0" | |
@@ -10558,6 +10603,13 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" | |
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= | |
+path-to-regexp@^1.7.0: | |
+ version "1.8.0" | |
+ resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" | |
+ integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== | |
+ dependencies: | |
+ isarray "0.0.1" | |
+ | |
path-type@^3.0.0: | |
version "3.0.0" | |
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" | |
@@ -11272,7 +11324,7 @@ react-inspector@^3.0.2: | |
is-dom "^1.0.9" | |
prop-types "^15.6.1" | |
-react-is@^16.7.0, react-is@^16.8.1, react-is@^16.9.0: | |
+react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.9.0: | |
version "16.12.0" | |
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" | |
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== | |
@@ -11355,6 +11407,35 @@ react-redux@^7.0.2: | |
prop-types "^15.7.2" | |
react-is "^16.9.0" | |
+react-router-dom@^5.1.2: | |
+ version "5.1.2" | |
+ resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.1.2.tgz#06701b834352f44d37fbb6311f870f84c76b9c18" | |
+ integrity sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew== | |
+ dependencies: | |
+ "@babel/runtime" "^7.1.2" | |
+ history "^4.9.0" | |
+ loose-envify "^1.3.1" | |
+ prop-types "^15.6.2" | |
+ react-router "5.1.2" | |
+ tiny-invariant "^1.0.2" | |
+ tiny-warning "^1.0.0" | |
+ | |
[email protected]: | |
+ version "5.1.2" | |
+ resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.1.2.tgz#6ea51d789cb36a6be1ba5f7c0d48dd9e817d3418" | |
+ integrity sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A== | |
+ dependencies: | |
+ "@babel/runtime" "^7.1.2" | |
+ history "^4.9.0" | |
+ hoist-non-react-statics "^3.1.0" | |
+ loose-envify "^1.3.1" | |
+ mini-create-react-context "^0.3.0" | |
+ path-to-regexp "^1.7.0" | |
+ prop-types "^15.6.2" | |
+ react-is "^16.6.0" | |
+ tiny-invariant "^1.0.2" | |
+ tiny-warning "^1.0.0" | |
+ | |
react-select@^3.0.0, react-select@^3.0.4: | |
version "3.0.8" | |
resolved "https://registry.yarnpkg.com/react-select/-/react-select-3.0.8.tgz#06ff764e29db843bcec439ef13e196865242e0c1" | |
@@ -11782,6 +11863,11 @@ resolve-from@^5.0.0: | |
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" | |
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== | |
+resolve-pathname@^3.0.0: | |
+ version "3.0.0" | |
+ resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" | |
+ integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== | |
+ | |
resolve-url@^0.2.1: | |
version "0.2.1" | |
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" | |
@@ -12905,7 +12991,12 @@ tiny-emitter@^2.0.0: | |
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" | |
integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== | |
-tiny-warning@^1.0.2: | |
+tiny-invariant@^1.0.2: | |
+ version "1.0.6" | |
+ resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.0.6.tgz#b3f9b38835e36a41c843a3b0907a5a7b3755de73" | |
+ integrity sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA== | |
+ | |
+tiny-warning@^1.0.0, tiny-warning@^1.0.2: | |
version "1.0.3" | |
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" | |
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== | |
@@ -13374,6 +13465,11 @@ url@^0.11.0: | |
punycode "1.3.2" | |
querystring "0.2.0" | |
+use-async-effect@^2.2.1: | |
+ version "2.2.1" | |
+ resolved "https://registry.yarnpkg.com/use-async-effect/-/use-async-effect-2.2.1.tgz#6b7c598df86b98b4bfa3481aaf9f01da08da7467" | |
+ integrity sha512-nPsDhym63uBWMRwWwcBclUWb3aPRYEwMIgXDylytQjM3r0BvzsqtRwuuxiNi5EBUa5bmo4Q206xr2LlmBWmd/g== | |
+ | |
use@^3.1.0: | |
version "3.1.1" | |
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" | |
@@ -13434,6 +13530,11 @@ validate-npm-package-license@^3.0.1: | |
spdx-correct "^3.0.0" | |
spdx-expression-parse "^3.0.0" | |
+value-equal@^1.0.1: | |
+ version "1.0.1" | |
+ resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" | |
+ integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== | |
+ | |
vary@~1.1.2: | |
version "1.1.2" | |
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment