import { FunctionComponent } from 'react'; import type { BlockAttributes } from './types'; import type { BlockSaveProps } from '@wordpress/blocks'; const save: FunctionComponent< BlockSaveProps< BlockAttributes > > = ( { attributes } ) => { const { allTasks, pendingTasks, completedTasks, estimate, team } = attributes; const estimates = [ { key: '', name: '---', }, { key: '1-week', name: '1 week', }, { key: '2-weeks', name: '2 weeks', }, { key: '3-weeks', name: '3 weeks', }, ]; const completedPercentage = Math.round( ( completedTasks * 100 ) / allTasks ); return ( <>

Project Overview

{ allTasks } Tasks { '\u2003' } { completedTasks } Completed ({ completedPercentage }%) { '\u2003' } { pendingTasks } In progress
Completed Tasks In-progress Tasks
{ ( estimate || team ) && (
{ team && { 'Team ' + team } } { estimate && ( { estimate && estimates.find( ( option ) => option.key === estimate ).name } ) }
) } ); }; export default save;