46 lines
1018 B
JavaScript
46 lines
1018 B
JavaScript
|
import React from 'react';
|
||
|
import {hot} from 'react-hot-loader';
|
||
|
import {BrowserRouter} from 'react-router-dom';
|
||
|
import {compose} from 'redux';
|
||
|
import {connect} from 'react-redux';
|
||
|
|
||
|
import contempo from 'contempo';
|
||
|
|
||
|
import Editor from './editor/component';
|
||
|
import {ducks} from './index';
|
||
|
import {createMapDispatchToProps} from './ducks';
|
||
|
|
||
|
import DevTools from '../dev-tools';
|
||
|
|
||
|
const decorate = compose(
|
||
|
hot(module),
|
||
|
contempo(require('./component.scss')),
|
||
|
connect(
|
||
|
(state) => ({
|
||
|
currentWorkspace: state.workspace.current,
|
||
|
}),
|
||
|
createMapDispatchToProps(ducks)
|
||
|
),
|
||
|
)
|
||
|
|
||
|
function App({
|
||
|
currentWorkspace,
|
||
|
workspace,
|
||
|
}) {
|
||
|
return <React.Fragment>
|
||
|
<BrowserRouter>
|
||
|
<div className="app">
|
||
|
<Editor workspace={currentWorkspace} />
|
||
|
<button onClick={() => {
|
||
|
workspace.load('/workspace/test');
|
||
|
}}>Load</button>
|
||
|
</div>
|
||
|
</BrowserRouter>
|
||
|
<div className="dev-tools">
|
||
|
<DevTools />
|
||
|
</div>
|
||
|
</React.Fragment>;
|
||
|
};
|
||
|
|
||
|
export default decorate(App);
|