82 lines
2.2 KiB
JavaScript
82 lines
2.2 KiB
JavaScript
// Html page
|
|
import 'file-loader?name=[name].[ext]!../index.html'
|
|
|
|
// Import default image
|
|
import 'file-loader?name=img/[name].png!../img/noimage.png'
|
|
|
|
// Import favicon settings
|
|
import 'file-loader?name=[name].png!../img/android-chrome-192x192.png'
|
|
import 'file-loader?name=[name].png!../img/android-chrome-512x512.png'
|
|
import 'file-loader?name=[name].png!../img/apple-touch-icon.png'
|
|
import 'file-loader?name=[name].png!../img/favicon-16x16.png'
|
|
import 'file-loader?name=[name].png!../img/favicon-32x32.png'
|
|
import 'file-loader?name=[name].png!../img/favicon.ico'
|
|
import 'file-loader?name=[name].png!../img/safari-pinned-tab.svg'
|
|
|
|
// Import manifest
|
|
import 'file-loader?name=[name].json!../manifest.json'
|
|
|
|
// Styles
|
|
import '../less/app.less'
|
|
|
|
// React
|
|
import React from 'react'
|
|
import ReactDOM from 'react-dom'
|
|
import { bindActionCreators } from 'redux'
|
|
import { Provider, connect } from 'react-redux'
|
|
import { Router } from 'react-router'
|
|
import { routerActions } from 'react-router-redux'
|
|
|
|
// Action creators
|
|
import * as actionCreators from './actions/actionCreators'
|
|
|
|
// Store
|
|
import store, { history } from './store'
|
|
|
|
// Components
|
|
import NavBar from './components/navbar'
|
|
import Alert from './components/alerts/alert'
|
|
|
|
// Routes
|
|
import getRoutes from './routes'
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
movieStore: state.movieStore,
|
|
showStore: state.showStore,
|
|
userStore: state.userStore,
|
|
torrentStore: state.torrentStore,
|
|
alerts: state.alerts,
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return bindActionCreators(actionCreators, dispatch);
|
|
}
|
|
|
|
function Main(props) {
|
|
return (
|
|
<div>
|
|
<NavBar
|
|
username={props.userStore.username}
|
|
router={props.router}
|
|
torrentCount={props.torrentStore.torrents.length}
|
|
/>
|
|
<Alert
|
|
alerts={props.alerts}
|
|
dismissAlert={props.dismissAlert}
|
|
/>
|
|
<div className="container-fluid">
|
|
{React.cloneElement(props.children, props)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
export const App = connect(mapStateToProps, mapDispatchToProps)(Main);
|
|
|
|
ReactDOM.render((
|
|
<Provider store={store}>
|
|
<Router history={history} routes={getRoutes(App)} />
|
|
</Provider>
|
|
),document.getElementById('app'));
|