From 085976b7184f5729928a75bbeb6a37af3e5800ed Mon Sep 17 00:00:00 2001 From: alex-cannon Date: Wed, 20 Nov 2019 13:18:49 -0700 Subject: [PATCH] chore: hacked temp reducer so it'll work --- package.json | 3 ++- src/core/store.ts | 13 +++++++++++++ src/{index.jsx => index.tsx} | 12 +++++++++++- tsconfig.json | 13 +++++++++++++ yarn.lock | 10 +++++++++- 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/core/store.ts rename src/{index.jsx => index.tsx} (87%) create mode 100644 tsconfig.json diff --git a/package.json b/package.json index f109bb4..7e66b0d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "fd-servicedirectory", "version": "1.0.0", "description": "PFA Service Directory", - "main": "src/index.jsx", + "main": "src/index.tsx", "repository": "git@github.com:CodeForFoco/fd-servicedirectory.git", "author": "Code for Fort Collins", "license": "MIT", @@ -58,6 +58,7 @@ "react-dom": "^16.8.6", "react-redux": "^7.1.3", "react-router-dom": "^5.0.0", + "redux": "^4.0.4", "redux-thunk": "^2.3.0", "styled-components": "^4.2.0", "styled-normalize": "^8.0.6", diff --git a/src/core/store.ts b/src/core/store.ts new file mode 100644 index 0000000..de127c2 --- /dev/null +++ b/src/core/store.ts @@ -0,0 +1,13 @@ +import { createStore, applyMiddleware } from "redux"; +import thunk from "redux-thunk"; + +// Temporary Reducer. Remove this. +const defaultReducer = (state, action) => { + let newAction = action; + Object.keys(newAction); + return state; +}; + +export const configureStore = initialState => { + return createStore(defaultReducer, initialState, applyMiddleware(thunk)); +}; diff --git a/src/index.jsx b/src/index.tsx similarity index 87% rename from src/index.jsx rename to src/index.tsx index 14b243e..8c141ff 100644 --- a/src/index.jsx +++ b/src/index.tsx @@ -1,8 +1,10 @@ import React from "react"; import { render } from "react-dom"; import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom"; +import { Provider } from "react-redux"; import styled, { createGlobalStyle, ThemeProvider } from "styled-components"; import { Normalize } from "styled-normalize"; +import { configureStore } from "~/core/store"; import Nav from "~/components/nav"; import theme from "~/core/theme"; import Categories from "~/pages/categories"; @@ -23,6 +25,9 @@ const PageContainer = styled.div({ marginBottom: "96px", }); +// Initialize Redux store +const store = configureStore({}); + const App = () => ( @@ -52,4 +57,9 @@ const App = () => ( ); -render(, document.getElementById("app")); +render( + + + , + document.getElementById("app") +); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..487708a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +// References: +// https://parceljs.org/typeScript.html +// https://www.typescriptlang.org/docs/handbook/tsconfig-json.html +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "~*": ["./*"] + }, + "jsx": "react", + }, + "include": ["src/**/*"] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 4dfd38f..d53fbf9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6800,6 +6800,14 @@ redux-thunk@^2.3.0: resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622" integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw== +redux@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.4.tgz#4ee1aeb164b63d6a1bcc57ae4aa0b6e6fa7a3796" + integrity sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q== + dependencies: + loose-envify "^1.4.0" + symbol-observable "^1.2.0" + regenerate-unicode-properties@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz#7b38faa296252376d363558cfbda90c9ce709662" @@ -7704,7 +7712,7 @@ svgo@^1.0.0, svgo@^1.0.5: unquote "~1.1.1" util.promisify "~1.0.0" -symbol-observable@^1.1.0: +symbol-observable@^1.1.0, symbol-observable@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==