/** * WordPress dependencies */ import { useSelect } from '@safe-wordpress/data'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { store as NC_DATA } from '@nelio-content/data'; import { isEmpty } from '@nelio-content/utils'; /** * Internal dependencies */ import './style.scss'; import { Task } from '../task'; import { store as NC_EDIT_POST } from '../../../store'; export const Tasks = (): JSX.Element => { const tasks = useTasks(); if ( isEmpty( tasks ) ) { return (
{ _x( 'Keep track of the things that need to get done with tasks.', 'user', 'nelio-content' ) }
); } return (
{ tasks.map( ( task ) => ( ) ) }
); }; // ===== // HOOKS // ===== const useTasks = () => useSelect( ( select ) => { const { getPostId } = select( NC_EDIT_POST ); const { getTaskIdsRelatedToPost } = select( NC_DATA ); const postId = getPostId(); return getTaskIdsRelatedToPost( postId ); }, [] );