-
Notifications
You must be signed in to change notification settings - Fork 0
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 #319 from boostcampwm2023/feature/backlog-finished…
…-page feat: 완료된 스토리 페이지 구현
- Loading branch information
Showing
4 changed files
with
72 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useOutletContext } from "react-router-dom"; | ||
import { BacklogDTO } from "../../types/DTO/backlogDTO"; | ||
import { useMemo } from "react"; | ||
import StoryBlock from "../../components/backlog/StoryBlock"; | ||
import changeEpicListToStoryList from "../../utils/changeEpicListToStoryList"; | ||
import TaskBlock from "../../components/backlog/TaskBlock"; | ||
|
||
const FinishedStoryPage = () => { | ||
const { backlog }: { backlog: BacklogDTO } = useOutletContext(); | ||
const storyList = useMemo( | ||
() => | ||
changeEpicListToStoryList(backlog.epicList).filter( | ||
({ status }) => status === "완료" | ||
), | ||
[backlog.epicList] | ||
); | ||
const epicCategoryList = useMemo( | ||
() => backlog.epicList.map(({ id, name, color }) => ({ id, name, color })), | ||
[backlog.epicList] | ||
); | ||
|
||
return ( | ||
<div className="flex flex-col items-center gap-4"> | ||
<div className="w-full border-b"> | ||
{...storyList.map(({ id, epic, title, point, status, taskList }) => { | ||
const progress = taskList.length | ||
? Math.round( | ||
(taskList.filter(({ status }) => status === "완료").length / | ||
taskList.length) * | ||
100 | ||
) | ||
: 0; | ||
|
||
return ( | ||
<StoryBlock | ||
{...{ id, title, point, status }} | ||
epic={epic} | ||
progress={progress} | ||
taskExist={taskList.length > 0} | ||
epicList={epicCategoryList} | ||
finished={true} | ||
> | ||
{...taskList.map((task) => <TaskBlock {...task} />)} | ||
</StoryBlock> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FinishedStoryPage; |
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