Skip to content

Commit 01d547e

Browse files
author
Dmitry Yadrikhinsky
committed
[Timer] TaskControl
1 parent 484d996 commit 01d547e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.task-control {
2+
color: white;
3+
//line-height: ;
4+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React, { useMemo } from 'react';
2+
import { observer } from 'mobx-react';
3+
4+
import './TaskControl.less';
5+
6+
import rootStore from '../../../../services/RootStore';
7+
import { useTaskDuration } from '../../../../hooks/TaskHooks';
8+
9+
const { tasksStore, projectStore } = rootStore;
10+
11+
export default observer(function TaskControl() {
12+
const activeTask = tasksStore.activeTask;
13+
const duration = useTaskDuration(activeTask);
14+
15+
const project = useMemo(() => {
16+
return projectStore.get(activeTask?.projectId || '');
17+
}, [activeTask]);
18+
19+
if (activeTask) {
20+
return (
21+
<div className="task-control">
22+
<div>{project?.title}</div>
23+
<div>{activeTask.title}</div>
24+
{duration}
25+
</div>
26+
);
27+
}
28+
return <div className="task-control">No active tasks</div>;
29+
});

0 commit comments

Comments
 (0)