content.js
5 years ago
export.js
5 years ago
filters.js
5 years ago
header.js
1 year ago
list-item.js
5 years ago
pagination.js
5 years ago
preview.js
1 year ago
templates-content.js
5 years ago
content.js
59 lines
| 1 | import { useSelect } from '@wordpress/data'; |
| 2 | |
| 3 | import Preview from './preview'; |
| 4 | import Export from './export'; |
| 5 | import TemplatesContent from './templates-content'; |
| 6 | |
| 7 | const Content = ( { |
| 8 | importTemplate, |
| 9 | getOrder, |
| 10 | setQuery, |
| 11 | getSearchQuery, |
| 12 | setSorting, |
| 13 | isSearch, |
| 14 | setSearch, |
| 15 | } ) => { |
| 16 | const isFetching = useSelect( ( select ) => |
| 17 | select( 'tpc/beaver' ).isFetching() |
| 18 | ); |
| 19 | |
| 20 | const isPreview = useSelect( ( select ) => |
| 21 | select( 'tpc/beaver' ).isPreview() |
| 22 | ); |
| 23 | |
| 24 | const currentTab = useSelect( ( select ) => |
| 25 | select( 'tpc/beaver' ).getCurrentTab() |
| 26 | ); |
| 27 | |
| 28 | if ( isPreview ) { |
| 29 | return ( |
| 30 | <Preview |
| 31 | isFetching={ isFetching } |
| 32 | importTemplate={ importTemplate } |
| 33 | /> |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | if ( 'export' === currentTab ) { |
| 38 | return <Export />; |
| 39 | } |
| 40 | |
| 41 | return ( |
| 42 | <div className="tpc-modal-content"> |
| 43 | <TemplatesContent |
| 44 | isFetching={ isFetching } |
| 45 | isGeneral={ currentTab === 'templates' } |
| 46 | importTemplate={ importTemplate } |
| 47 | getOrder={ getOrder } |
| 48 | setQuery={ setQuery } |
| 49 | getSearchQuery={ getSearchQuery } |
| 50 | setSorting={ setSorting } |
| 51 | isSearch={ isSearch } |
| 52 | setSearch={ setSearch } |
| 53 | /> |
| 54 | </div> |
| 55 | ); |
| 56 | }; |
| 57 | |
| 58 | export default Content; |
| 59 |