From 5d54ab45631a7f1d10659e06dea3fcc76eec944c Mon Sep 17 00:00:00 2001 From: Andrew P Maney Date: Tue, 3 Mar 2020 17:24:47 -0800 Subject: [PATCH] Tasks: reorganizes Tasks components into their own subfolder --- src/Journals/Journal.tsx | 4 ++-- src/Pim/PimMain.tsx | 2 +- src/Pim/index.tsx | 4 ++-- src/components/{ => Tasks}/Task.tsx | 6 +++--- src/components/{ => Tasks}/TaskEdit.tsx | 14 +++++++------- src/components/{ => Tasks}/TaskList.tsx | 19 +++---------------- src/components/Tasks/TaskListItem.tsx | 21 +++++++++++++++++++++ 7 files changed, 39 insertions(+), 31 deletions(-) rename src/components/{ => Tasks}/Task.tsx (89%) rename src/components/{ => Tasks}/TaskEdit.tsx (97%) rename src/components/{ => Tasks}/TaskList.tsx (79%) create mode 100644 src/components/Tasks/TaskListItem.tsx diff --git a/src/Journals/Journal.tsx b/src/Journals/Journal.tsx index e8c8cda..789aa64 100644 --- a/src/Journals/Journal.tsx +++ b/src/Journals/Journal.tsx @@ -14,8 +14,8 @@ import SearchableAddressBook from '../components/SearchableAddressBook'; import Contact from '../components/Contact'; import Calendar from '../components/Calendar'; import Event from '../components/Event'; -import Task from '../components/Task'; -import TaskList from '../components/TaskList'; +import Task from '../components/Tasks/Task'; +import TaskList from '../components/Tasks/TaskList'; import AppBarOverride from '../widgets/AppBarOverride'; import Container from '../widgets/Container'; diff --git a/src/Pim/PimMain.tsx b/src/Pim/PimMain.tsx index a80c348..85dd486 100644 --- a/src/Pim/PimMain.tsx +++ b/src/Pim/PimMain.tsx @@ -16,7 +16,7 @@ import Container from '../widgets/Container'; import SearchableAddressBook from '../components/SearchableAddressBook'; import Calendar from '../components/Calendar'; -import TaskList from '../components/TaskList'; +import TaskList from '../components/Tasks/TaskList'; import { EventType, ContactType, TaskType } from '../pim-types'; diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index 7aa2789..c1c6869 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -27,8 +27,8 @@ import ContactEdit from '../components/ContactEdit'; import Contact from '../components/Contact'; import EventEdit from '../components/EventEdit'; import Event from '../components/Event'; -import TaskEdit from '../components/TaskEdit'; -import Task from '../components/Task'; +import TaskEdit from '../components/Tasks/TaskEdit'; +import Task from '../components/Tasks/Task'; import PimMain from './PimMain'; import { routeResolver } from '../App'; diff --git a/src/components/Task.tsx b/src/components/Tasks/Task.tsx similarity index 89% rename from src/components/Task.tsx rename to src/components/Tasks/Task.tsx index 09986b2..334526b 100644 --- a/src/components/Task.tsx +++ b/src/components/Tasks/Task.tsx @@ -3,11 +3,11 @@ import * as React from 'react'; -import PimItemHeader from './PimItemHeader'; +import PimItemHeader from '../PimItemHeader'; -import { formatDate, formatOurTimezoneOffset } from '../helpers'; +import { formatDate, formatOurTimezoneOffset } from '../../helpers'; -import { TaskType } from '../pim-types'; +import { TaskType } from '../../pim-types'; class Task extends React.PureComponent { public props: { diff --git a/src/components/TaskEdit.tsx b/src/components/Tasks/TaskEdit.tsx similarity index 97% rename from src/components/TaskEdit.tsx rename to src/components/Tasks/TaskEdit.tsx index 84d864e..658c584 100644 --- a/src/components/TaskEdit.tsx +++ b/src/components/Tasks/TaskEdit.tsx @@ -20,10 +20,10 @@ import IconDelete from '@material-ui/icons/Delete'; import IconCancel from '@material-ui/icons/Clear'; import IconSave from '@material-ui/icons/Save'; -import DateTimePicker from '../widgets/DateTimePicker'; +import DateTimePicker from '../../widgets/DateTimePicker'; -import ConfirmationDialog from '../widgets/ConfirmationDialog'; -import TimezonePicker from '../widgets/TimezonePicker'; +import ConfirmationDialog from '../../widgets/ConfirmationDialog'; +import TimezonePicker from '../../widgets/TimezonePicker'; import { Location } from 'history'; import { withRouter } from 'react-router'; @@ -33,9 +33,9 @@ import * as ICAL from 'ical.js'; import * as EteSync from 'etesync'; -import { getCurrentTimezone } from '../helpers'; +import { getCurrentTimezone } from '../../helpers'; -import { TaskType, TaskStatusType, timezoneLoadFromName } from '../pim-types'; +import { TaskType, TaskStatusType, timezoneLoadFromName } from '../../pim-types'; interface PropsType { collections: EteSync.CollectionInfo[]; @@ -177,7 +177,7 @@ class TaskEdit extends React.PureComponent { this.props.item.clone() : new TaskType(null) - ; + ; event.uid = this.state.uid; event.summary = this.state.title; @@ -394,7 +394,7 @@ class TaskEdit extends React.PureComponent { onOk={() => this.props.onDelete(this.props.item!, this.props.initialCollection!)} onCancel={() => this.setState({ showDeleteDialog: false })} > - Are you sure you would like to delete this event? + Are you sure you would like to delete this event? ); diff --git a/src/components/TaskList.tsx b/src/components/Tasks/TaskList.tsx similarity index 79% rename from src/components/TaskList.tsx rename to src/components/Tasks/TaskList.tsx index 509ef07..92283bc 100644 --- a/src/components/TaskList.tsx +++ b/src/components/Tasks/TaskList.tsx @@ -5,27 +5,14 @@ import * as React from 'react'; import { createSelector } from 'reselect'; -import { List, ListItem } from '../widgets/List'; +import { List } from '../../widgets/List'; -import { TaskType } from '../pim-types'; +import { TaskType } from '../../pim-types'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Checkbox from '@material-ui/core/Checkbox'; import Divider from '@material-ui/core/Divider'; -const TaskListItem = React.memo((props: { entry: TaskType, onClick: (entry: TaskType) => void }) => { - const { - entry, - onClick, - } = props; - const title = entry.title; - - return ( - onClick(entry)} - /> - ); -}); +import TaskListItem from './TaskListItem'; const sortSelector = createSelector( (entries: TaskType[]) => entries, diff --git a/src/components/Tasks/TaskListItem.tsx b/src/components/Tasks/TaskListItem.tsx new file mode 100644 index 0000000..5cba101 --- /dev/null +++ b/src/components/Tasks/TaskListItem.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; + +import { TaskType } from '../../pim-types'; +import { ListItem } from '../../widgets/List'; + +const TaskListItem = React.memo((props: { entry: TaskType, onClick: (entry: TaskType) => void }) => { + const { + entry, + onClick, + } = props; + const title = entry.title; + + return ( + onClick(entry)} + /> + ); +}); + +export default TaskListItem; \ No newline at end of file