| 1 |
import React, { Component } from 'react'; |
| 2 |
import { Route } from 'react-router-dom'; |
| 3 |
|
| 4 |
import Menu from './Menu'; |
| 5 |
import Notices from './Notices'; |
| 6 |
import DataTable from './DataTable'; |
| 7 |
import ErrorBoundary from 'Shared/ErrorBoundary'; |
| 8 |
|
| 9 |
import '../../css/admin/manage/app.scss'; |
| 10 |
import defaultDatatables from './DataTableConfig'; |
| 11 |
const { hooks } = WPUltimatePostGrid['wp-ultimate-post-grid/dist/shared']; |
| 12 |
|
| 13 |
export default class App extends Component { |
| 14 |
render() { |
| 15 |
let datatables = hooks.applyFilters( 'datatables', defaultDatatables ); |
| 16 |
|
| 17 |
return ( |
| 18 |
<ErrorBoundary module="Manage"> |
| 19 |
<div id="wpupg-admin-manage-header"> |
| 20 |
<Menu |
| 21 |
datatables={ datatables } |
| 22 |
/> |
| 23 |
<Notices /> |
| 24 |
</div> |
| 25 |
<div id="wpupg-admin-manage-content"> |
| 26 |
<Route path="/:type?" render={( {match} ) => { |
| 27 |
let type = 'grids'; |
| 28 |
if ( match.params.type && Object.keys(datatables).includes( match.params.type ) ) { |
| 29 |
type = match.params.type; |
| 30 |
} |
| 31 |
|
| 32 |
if ( ! datatables.hasOwnProperty( type ) ) { |
| 33 |
return null; |
| 34 |
} |
| 35 |
|
| 36 |
return ( |
| 37 |
<DataTable |
| 38 |
type={ type } |
| 39 |
options={ datatables[ type ] } |
| 40 |
/> |
| 41 |
) |
| 42 |
}} /> |
| 43 |
</div> |
| 44 |
</ErrorBoundary> |
| 45 |
); |
| 46 |
} |
| 47 |
} |
| 48 |
|