|
| 1 | +/*! |
| 2 | + * |
| 3 | + * Angle - Bootstrap Admin App + ReactJS |
| 4 | + * |
| 5 | + * Version: 3.7 |
| 6 | + * Author: @themicon_co |
| 7 | + * Website: http://themicon.co |
| 8 | + * License: https://wrapbootstrap.com/help/licenses |
| 9 | + * |
| 10 | + */ |
| 11 | + |
| 12 | +import React from 'react'; |
| 13 | +import ReactDOM from 'react-dom'; |
| 14 | +import { Router, Route, Link, hashHistory, useRouterHistory, IndexRoute } from 'react-router'; |
| 15 | +import { createHistory } from 'history'; |
| 16 | + |
| 17 | +import initTranslation from './components/Common/localize'; |
| 18 | +import initLoadThemes from './components/Common/load-themes'; |
| 19 | + |
| 20 | +import Base from './components/Layout/Base'; |
| 21 | +import BasePage from './components/Layout/BasePage'; |
| 22 | +import BaseHorizontal from './components/Layout/BaseHorizontal'; |
| 23 | + |
| 24 | +import SingleView from './components/SingleView/SingleView'; |
| 25 | +import SubMenu from './components/SubMenu/SubMenu'; |
| 26 | + |
| 27 | +// Application Styles |
| 28 | +import './styles/bootstrap.scss'; |
| 29 | +import './styles/app.scss' |
| 30 | + |
| 31 | + |
| 32 | +// Init translation system |
| 33 | +initTranslation(); |
| 34 | +// Init css loader (for themes) |
| 35 | +initLoadThemes(); |
| 36 | + |
| 37 | +// Disable warning "Synchronous XMLHttpRequest on the main thread is deprecated.." |
| 38 | +$.ajaxPrefilter(function(options, originalOptions, jqXHR) { |
| 39 | + options.async = true; |
| 40 | +}); |
| 41 | + |
| 42 | +// specify basename below if running in a subdirectory or set as "/" if app runs in root |
| 43 | +const appHistory = useRouterHistory(createHistory)({ |
| 44 | + basename: WP_BASE_HREF |
| 45 | +}) |
| 46 | + |
| 47 | +ReactDOM.render( |
| 48 | + <Router history={appHistory}> |
| 49 | + <Route path="/" component={Base}> |
| 50 | + |
| 51 | + {/* Default route*/} |
| 52 | + <IndexRoute component={SingleView} /> |
| 53 | + |
| 54 | + <Route path="singleview" component={SingleView}/> |
| 55 | + <Route path="submenu" component={SubMenu}/> |
| 56 | + |
| 57 | + </Route> |
| 58 | + |
| 59 | + {/* Not found handler */} |
| 60 | + {/*<Route path="*" component={NotFound}/>*/} |
| 61 | + |
| 62 | + </Router>, |
| 63 | + document.getElementById('app') |
| 64 | +); |
| 65 | + |
| 66 | +// Auto close sidebar on route changes |
| 67 | +appHistory.listen(function(ev) { |
| 68 | + $('body').removeClass('aside-toggled'); |
| 69 | +}); |
0 commit comments