From 47c259d803e9eaf7faea6daea3610256ef4920e9 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 14 Feb 2019 21:28:07 +0000 Subject: [PATCH] Improve task viewing. --- src/Pim/index.tsx | 5 +++-- src/components/Task.tsx | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/components/Task.tsx diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index c222ddd..d5fb042 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -24,8 +24,9 @@ import JournalEntries from '../components/JournalEntries'; import ContactEdit from '../components/ContactEdit'; import Contact from '../components/Contact'; import EventEdit from '../components/EventEdit'; -import TaskEdit from '../components/TaskEdit'; import Event from '../components/Event'; +import TaskEdit from '../components/TaskEdit'; +import Task from '../components/Task'; import PimMain from './PimMain'; import { routeResolver } from '../App'; @@ -366,7 +367,7 @@ class Pim extends React.PureComponent { collections={collectionsTaskList} items={taskListItems} componentEdit={TaskEdit} - componentView={Event} + componentView={Task} onItemSave={this.onItemSave} onItemDelete={this.onItemDelete} onItemCancel={this.onCancel} diff --git a/src/components/Task.tsx b/src/components/Task.tsx new file mode 100644 index 0000000..069a55d --- /dev/null +++ b/src/components/Task.tsx @@ -0,0 +1,49 @@ +import * as React from 'react'; + +import PimItemHeader from './PimItemHeader'; + +import { formatDate } from '../helpers'; + +import { TaskType } from '../pim-types'; + +class Task extends React.PureComponent { + props: { + item?: TaskType, + }; + + render() { + if (this.props.item === undefined) { + throw Error('Task should be defined!'); + } + + const { item } = this.props; + + const style = { + content: { + padding: 15, + }, + }; + + return ( + + + { item.startDate && +
Start: {formatDate(item.startDate)}
+ } + { item.dueDate && +
Due: {formatDate(item.dueDate)}
+ } +
+
{this.props.item.location}
+
+
+
{this.props.item.description}
+ {(this.props.item.attendees.length > 0) && ( +
Attendees: {this.props.item.attendees.map((x) => (x.getFirstValue())).join(', ')}
)} +
+
+ ); + } +} + +export default Task;