content.js
1 year ago
filters.js
1 year ago
header.js
1 year ago
import-modal.js
1 year ago
list-item.js
1 year ago
notices.js
5 years ago
pagination.js
5 years ago
preview.js
1 year ago
publish-button.js
2 years ago
template-predefine.js
2 years ago
templates-content.js
1 year ago
tpc-templates-button.js
2 years ago
content.js
56 lines
| 1 | import { __ } from '@wordpress/i18n'; |
| 2 | import { withSelect } from '@wordpress/data'; |
| 3 | |
| 4 | import Preview from './preview'; |
| 5 | import TemplatesContent from './templates-content'; |
| 6 | import Notices from './notices'; |
| 7 | |
| 8 | const Content = ( { |
| 9 | importBlocks, |
| 10 | getOrder, |
| 11 | setQuery, |
| 12 | getSearchQuery, |
| 13 | setSorting, |
| 14 | isPreview, |
| 15 | currentTab, |
| 16 | isFetching, |
| 17 | } ) => { |
| 18 | if ( isPreview && currentTab === 'library' ) { |
| 19 | return ( |
| 20 | <Preview isFetching={ isFetching } importBlocks={ importBlocks } /> |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | return ( |
| 25 | <div className="tpc-modal-content"> |
| 26 | <Notices /> |
| 27 | { [ 'templates', 'library' ].includes( currentTab ) && ( |
| 28 | <TemplatesContent |
| 29 | isFetching={ isFetching } |
| 30 | isGeneral={ currentTab === 'templates' } |
| 31 | importBlocks={ importBlocks } |
| 32 | getOrder={ getOrder } |
| 33 | setQuery={ setQuery } |
| 34 | getSearchQuery={ getSearchQuery } |
| 35 | setSorting={ setSorting } |
| 36 | /> |
| 37 | ) } |
| 38 | { currentTab === 'patterns' && |
| 39 | __( |
| 40 | 'We are still working on this. Please check back later. Thank you!', |
| 41 | 'templates-patterns-collection' |
| 42 | ) } |
| 43 | </div> |
| 44 | ); |
| 45 | }; |
| 46 | |
| 47 | export default withSelect( ( select ) => { |
| 48 | const { isPreview, isFetching, getCurrentTab } = |
| 49 | select( 'tpc/block-editor' ); |
| 50 | return { |
| 51 | isPreview: isPreview(), |
| 52 | isFetching: isFetching(), |
| 53 | currentTab: getCurrentTab(), |
| 54 | }; |
| 55 | } )( Content ); |
| 56 |