blob: b72cd7983f7cc72d1628ea5dfcdba7af919d9c36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import { h, Component } from 'preact'
import { Link } from 'react-router-dom'
import TaskForm from './TaskForm.jsx'
import client from '../../client.js'
export default class Tasks extends Component {
constructor(props) {
super()
this.state = {
adding: false,
}
client.task.index().then( tasks => this.setState({ tasks }) )
}
render() {
const tasks = (this.props.tasks || []).map( (task, i) => {
return (
<div key={i} onClick={() => this.toggle(task)}>
<span class='name'>{task.name}</span>
</div>
)
})
return (
<div class='column'>
<div class='window'>
<div class='heading'>
<b>tasks</b>
</div>
<TaskForm />
<div class='list'>
{tasks}
</div>
</div>
</div>
)
}
}
|