Skip to content

Commit

Permalink
Active tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
MIDAV0 committed Sep 1, 2023
1 parent 1a1f4f7 commit 91059f4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/renderer/components/Tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function Tasks() {
const [tasks, setTasks] = useState<TaskType[]>([] as TaskType[]);
const [showCreateTask, setShowCreateTask] = useState(false);
const [isLoadingTasks, setIsLoadingTasks] = useState(false);
const [filterMode, setFilterMode] = useState<'all' | 'completed'>('all');
const [filterMode, setFilterMode] = useState<'all' | 'completed' | 'active'>(
'all'
);

const [taskToShow, setTaskToShow] = useState<TaskType>({} as TaskType);

Expand Down Expand Up @@ -172,6 +174,12 @@ function Tasks() {
onClick={() => setFilterMode('completed')}
label="Completed"
/>
<Button
primary={filterMode === 'active'}
plain={filterMode !== 'active'}
onClick={() => setFilterMode('active')}
label="Active"
/>
</Box>
<Box direction="row-responsive" align="center" gap="large">
<Button
Expand All @@ -194,7 +202,10 @@ function Tasks() {
>
{tasks
?.filter(
(task) => filterMode === 'all' || task.isTrainingCompleted
(task) =>
filterMode === 'all' ||
(filterMode === 'completed' && task.isTrainingCompleted) ||
(filterMode === 'active' && !task.isTrainingCompleted)
)
.map((task: TaskType) => {
return (
Expand Down

0 comments on commit 91059f4

Please sign in to comment.