From add95621af6cf07a0e78630498089dc6f7688c7c Mon Sep 17 00:00:00 2001 From: Andrew P Maney Date: Thu, 12 Mar 2020 14:52:56 -0700 Subject: [PATCH] Tasks: adds priority to Task type with ability to edit in form --- src/components/Tasks/TaskEdit.tsx | 26 ++++++++++++++++++++++++-- src/pim-types.ts | 15 +++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/components/Tasks/TaskEdit.tsx b/src/components/Tasks/TaskEdit.tsx index b49d63a..30380ac 100644 --- a/src/components/Tasks/TaskEdit.tsx +++ b/src/components/Tasks/TaskEdit.tsx @@ -15,6 +15,9 @@ import FormControl from '@material-ui/core/FormControl'; import FormHelperText from '@material-ui/core/FormHelperText'; import InputLabel from '@material-ui/core/InputLabel'; import * as colors from '@material-ui/core/colors'; +import FormLabel from '@material-ui/core/FormLabel'; +import RadioGroup from '@material-ui/core/RadioGroup'; +import Radio from '@material-ui/core/Radio'; import IconDelete from '@material-ui/icons/Delete'; import IconCancel from '@material-ui/icons/Clear'; @@ -35,7 +38,7 @@ import * as EteSync from 'etesync'; import { getCurrentTimezone } from '../../helpers'; -import { TaskType, TaskStatusType, timezoneLoadFromName } from '../../pim-types'; +import { TaskType, TaskStatusType, timezoneLoadFromName, TaskPriorityType } from '../../pim-types'; import { History } from 'history'; @@ -55,6 +58,7 @@ class TaskEdit extends React.PureComponent { uid: string; title: string; status: TaskStatusType; + priority: TaskPriorityType; allDay: boolean; start?: Date; due?: Date; @@ -73,6 +77,7 @@ class TaskEdit extends React.PureComponent { uid: '', title: '', status: TaskStatusType.NeedsAction, + priority: TaskPriorityType.Undefined, allDay: false, location: '', description: '', @@ -88,6 +93,7 @@ class TaskEdit extends React.PureComponent { this.state.uid = event.uid; this.state.title = event.title ? event.title : ''; this.state.status = event.status; + this.state.priority = event.priority || TaskPriorityType.Undefined; if (event.startDate) { this.state.allDay = event.startDate.isDate; this.state.start = event.startDate.convertToZone(ICAL.Timezone.localTimezone).toJSDate(); @@ -132,7 +138,7 @@ class TaskEdit extends React.PureComponent { } } - public handleChange(name: string, value: string) { + public handleChange(name: string, value: string | number) { this.setState({ [name]: value, }); @@ -185,6 +191,7 @@ class TaskEdit extends React.PureComponent { event.uid = this.state.uid; event.summary = this.state.title; event.status = this.state.status; + event.priority = this.state.priority; if (startDate) { event.startDate = startDate; } @@ -295,6 +302,21 @@ class TaskEdit extends React.PureComponent { + + Priority + + this.handleChange('priority', Number(e.target.value))} + > + } label="None" /> + } label="Low" /> + } label="Medium" /> + } label="High" /> + + + Start