import { InspectorControls } from '@wordpress/block-editor';
import { CustomSelectControl, PanelBody, TextControl } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { FunctionComponent } from 'react';
import type { BlockAttributes, SelectAttributes } from './types';
import type { BlockEditProps } from '@wordpress/blocks';
import './editor.scss';
type EditProps = BlockEditProps< BlockAttributes > & SelectAttributes;
const edit: FunctionComponent< EditProps > = ( args ) => {
const { allTasksLive, attributes, completedTasksLive, pendingTasksLive, setAttributes } = args;
const { estimate, team, allTasks, pendingTasks, completedTasks } = attributes;
const tasksToUpdate = Object.assign(
{},
allTasks !== allTasksLive && { allTasks: allTasksLive },
pendingTasks !== pendingTasksLive && { pendingTasks: pendingTasksLive },
completedTasks !== completedTasksLive && { completedTasks: completedTasksLive }
);
if ( Object.getOwnPropertyNames( tasksToUpdate ).length > 0 ) {
setAttributes( tasksToUpdate );
}
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 + Number.EPSILON )
);
return (
<>
Project Overview