-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtaskList.js
52 lines (50 loc) · 1.11 KB
/
taskList.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { createEl } from './dom_utils'
export const createEmptyTaskList = tabs =>
tabs.reduce((taskList, tab) => {
taskList[tab.name] = []
return taskList
}, {})
export const createTaskElement = (
{ isRun, isLaunching, isActive, id, name },
index,
{ onOpenTask, onRunTask, onStopTask }
) => {
return createEl('div', {
className: [
'task',
'task-num-' + (index + 1),
isRun && 'running',
isLaunching && 'clicked',
isActive && 'active',
].join(' '),
id,
onclick: onOpenTask,
children: [
createEl('i', {
className: 'fas fa-cog',
}),
createEl('span', {
className: 'task-name',
innerText: name,
}),
createEl('button', {
className: 'run-task',
onclick: onRunTask,
children: [
createEl('i', {
className: 'fas fa-play',
}),
],
}),
createEl('button', {
className: 'stop-task',
onclick: onStopTask,
children: [
createEl('i', {
className: 'fas fa-stop',
}),
],
}),
],
})
}