Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds UI features like toolbar (w/ sorting & searching), sidebar (w/ filtering), light editing improvements. Adds task type features like priority, tags. Adds some use of Context for prop drilling. Adds Task Settings to the redux store. This is a massive commit. I wanted to keep everything separate but the code is too tightly coupled.
- Loading branch information
1 parent
0bdc0e2
commit 0907a47
Showing
19 changed files
with
639 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { useState, useContext } from 'react'; | ||
|
||
import ICAL from 'ical.js'; | ||
import uuid from 'uuid'; | ||
|
||
import Checkbox from '@material-ui/core/Checkbox'; | ||
import TextField from '@material-ui/core/TextField'; | ||
|
||
import { TaskType, TaskStatusType, TaskPriorityType } from '../../pim-types'; | ||
import { ListItem } from '../../widgets/List'; | ||
import { PimContext } from '../../Pim'; | ||
|
||
const AddNewTaskItem = () => { | ||
const [title, setTitle] = useState(''); | ||
const { onItemSave: save, collectionsTaskList: collections } = useContext(PimContext); | ||
|
||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setTitle(e.target.value); | ||
}; | ||
|
||
const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (e.key === 'Enter') { | ||
e.preventDefault(); | ||
|
||
const event = new TaskType(null); | ||
event.uid = uuid.v4(); | ||
event.title = title; | ||
event.status = TaskStatusType.NeedsAction; | ||
event.priority = TaskPriorityType.None; | ||
event.lastModified = ICAL.Time.now(); | ||
|
||
save(event, collections[0].uid, undefined, false); | ||
|
||
setTitle(''); | ||
} | ||
}; | ||
|
||
return ( | ||
<ListItem leftIcon={<Checkbox disabled />}> | ||
<TextField | ||
label="New task" | ||
value={title} | ||
onChange={handleChange} | ||
onKeyPress={handleKeyPress} | ||
/> | ||
</ListItem> | ||
); | ||
}; | ||
|
||
export default AddNewTaskItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
|
||
import { makeStyles } from '@material-ui/core/styles'; | ||
import * as colors from '@material-ui/core/colors'; | ||
import Radio from '@material-ui/core/Radio'; | ||
import { Omit } from '@material-ui/types'; | ||
import FormControlLabel, { FormControlLabelProps } from '@material-ui/core/FormControlLabel'; | ||
|
||
interface Props { | ||
color: string; | ||
label: string; | ||
} | ||
|
||
const useStyles = makeStyles({ | ||
root: { | ||
color: (props: Props) => colors[props.color][600], | ||
}, | ||
}); | ||
|
||
const ColoredRadio = (props: Props & Omit<FormControlLabelProps, keyof Props | 'control'>) => { | ||
const { color, label, value, ...other } = props; | ||
const { root } = useStyles(props); | ||
|
||
return <FormControlLabel | ||
className={root} | ||
label={label} | ||
control={<Radio color="default" className={root} value={value} />} | ||
{...other} | ||
/>; | ||
}; | ||
|
||
export default ColoredRadio; |
Oops, something went wrong.