-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1959 from ever-co/update/add-task-status-api
Update/add task status api
- Loading branch information
Showing
7 changed files
with
89 additions
and
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { kanbanBoardState } from "@app/stores/kanban"; | ||
import { useTaskStatus } from "./useTaskStatus"; | ||
import { useRecoilState } from "recoil"; | ||
import { useEffect, useState } from "react"; | ||
import { ITaskStatusItemList } from "@app/interfaces"; | ||
|
||
export function useKanban() { | ||
|
||
const [loading, setLoading] = useState<boolean>(true); | ||
|
||
const [kanbanBoard, setKanbanBoard] = useRecoilState(kanbanBoardState); | ||
|
||
const taskStatusHook = useTaskStatus(); | ||
|
||
/** | ||
* format data for kanban board | ||
*/ | ||
useEffect(()=> { | ||
if(taskStatusHook.loading) { | ||
let kanban = {}; | ||
taskStatusHook.taskStatus.map((taskStatus: ITaskStatusItemList,)=> { | ||
kanban = { | ||
...kanban, | ||
[taskStatus.name ? taskStatus.name : ''] : [] | ||
} | ||
}); | ||
setKanbanBoard(kanban) | ||
setLoading(false) | ||
} | ||
},[taskStatusHook.loading]) | ||
|
||
return { | ||
data: kanbanBoard, | ||
isLoading: loading, | ||
columns: taskStatusHook.taskStatus | ||
} | ||
} |
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,5 @@ | ||
import { ITeamTask } from "./ITask"; | ||
|
||
export interface IKanban { | ||
[key: string]: ITeamTask[] | ||
} |
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,7 @@ | ||
import { IKanban } from "@app/interfaces/IKanban"; | ||
import { atom } from "recoil"; | ||
|
||
export const kanbanBoardState = atom<IKanban>({ | ||
key: 'kanbanBoardState', | ||
default: {} | ||
}) |
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