diff --git a/src/App.test.tsx b/src/App.test.tsx index 791960a..2b4da0b 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { App } from './App'; +import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); diff --git a/src/App.tsx b/src/App.tsx index 06bee0d..92b180c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,25 +1,47 @@ import * as React from 'react'; -import { Provider } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import { Provider, connect } from 'react-redux'; import { LexEditor } from './LexComponents'; -import { Header, Icon, Segment } from 'semantic-ui-react'; +import * as actionCreators from './actions/actionCreators'; import { walleStore } from './WallEStore'; +import { Header, Icon, Segment } from 'semantic-ui-react'; -export class App extends React.Component<{}, null> { +function mapStateToProps(state: any) { + return { + lexicon: state.lexicon + }; +} + +function mapDispachToProps(dispatch: any) { + return bindActionCreators(actionCreators, dispatch); +} + +export class Main extends React.Component { render() { return ( - -
- -
- - - Freespeech Lexicon Editor +
+ +
+ + + Freespeech Lexicon Editor -
-
- -
- +
+
+ +
); } } + +const ReduxMain = connect(mapStateToProps, mapDispachToProps)(Main); + +const App = (props: any) => { + return ( + + + + ); +}; + +export default App; diff --git a/src/LexComponents.tsx b/src/LexComponents.tsx index 93f1adf..2a4bb06 100644 --- a/src/LexComponents.tsx +++ b/src/LexComponents.tsx @@ -12,7 +12,6 @@ const { Flex } = require('reflexbox'); interface LexEditorProps { fileName: RequestInfo; } -// const imageRoot = 'https://s3-us-west-2.amazonaws.com/aac-buddy/static/img/png/'; // container component export class LexEditor extends React.Component { @@ -78,7 +77,7 @@ export class LexEditor extends React.Component { return (
this.handleOnSearch(e)} /> { .filter((q: any) => _.get(q, searchLens, '') === searchText) .take(10) .value(); + this.props.search(searchText); this.setState({ ...this.state, matchedEntries, searchText, searchLens }); } } diff --git a/src/actions/actionCreators.tsx b/src/actions/actionCreators.tsx new file mode 100644 index 0000000..16b9bde --- /dev/null +++ b/src/actions/actionCreators.tsx @@ -0,0 +1,7 @@ + +export function search(searchKey: any) { + return { + type: 'ACTION_SEARCH_TEXT', + searchKey + }; +} diff --git a/src/index.tsx b/src/index.tsx index 1f9ec04..a1018f4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,11 +1,8 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { App } from './App'; +import App from './App'; import registerServiceWorker from './registerServiceWorker'; import './index.css'; -ReactDOM.render( - , - document.getElementById('root') as HTMLElement -); +ReactDOM.render(, document.getElementById('root') as HTMLElement); registerServiceWorker(); diff --git a/walle-server.py b/walle-server.py index 239313c..3c79c8c 100644 --- a/walle-server.py +++ b/walle-server.py @@ -1,11 +1,11 @@ from flask import Flask,send_from_directory app = Flask(__name__,static_url_path='',static_folder='build') -import os - -@app.route('/static/') -def send_js(path): - return send_from_directory('build/static', path) @app.route('/') -def hello_world(): +def walle_index(): return app.send_static_file('index.html') + + +@app.route('/test') +def walle_test(): + return "test"