-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: study-dashboard api 연결, HomeworkBox 분리
- Loading branch information
Showing
10 changed files
with
275 additions
and
68 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,20 @@ | ||
import { fetcher } from "@wow-class/utils"; | ||
import { apiPath } from "constants/apiPath"; | ||
import { tags } from "constants/tags"; | ||
import type { StudyDetailDashboardDto } from "types/dtos/study-detail-dashboard"; | ||
|
||
export const studyDetailApi = { | ||
getStudyDetailDashboard: async (studyId: number) => { | ||
const response = await fetcher.get<StudyDetailDashboardDto>( | ||
`${apiPath.studyDetail}/dashboard?studyId=${studyId}`, | ||
{ | ||
next: { tags: [tags.studyDetailDashboard] }, | ||
headers: { | ||
Authorization: `Bearer ${process.env.DEV_AUTH_TOKEN}`, | ||
}, | ||
} | ||
); | ||
|
||
return response.data; | ||
}, | ||
}; |
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
72 changes: 72 additions & 0 deletions
72
apps/client/app/(afterLogin)/my-study/my-homework/_components/HomeworkBoxWithLinkEdit.tsx
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,72 @@ | ||
"use client"; | ||
|
||
import { Space, Text } from "@wow-class/ui"; | ||
import { tags } from "constants/tags"; | ||
import { revalidateTag } from "next/cache"; | ||
import type { SubmittableAssignment } from "types/dtos/study-detail-dashboard"; | ||
import { Link, Reload } from "wowds-icons"; | ||
import Box from "wowds-ui/Box"; | ||
import Button from "wowds-ui/Button"; | ||
import TextButton from "wowds-ui/TextButton"; | ||
|
||
interface HomeworkOverviewBoxProps { | ||
assignments: SubmittableAssignment[]; | ||
repositoryLink: string; | ||
} | ||
export const HomeworkBoxWithLinkEdit = ({ | ||
assignments, | ||
repositoryLink, | ||
}: HomeworkOverviewBoxProps) => { | ||
const handleClickSubmissionComplete = async () => { | ||
revalidateTag(tags.studyDetailDashboard); | ||
}; | ||
return ( | ||
<> | ||
{assignments.map((assignment) => ( | ||
<Box | ||
key={assignment.studyDetailId} | ||
text={ | ||
<> | ||
<Text color="primary" typo="label2"> | ||
{assignment.week}주차 | ||
</Text> | ||
<Space height={16} /> | ||
<Text as="h2" typo="h2"> | ||
{assignment.title} | ||
</Text> | ||
<TextButton | ||
as="a" | ||
href={assignment.descriptionLink} | ||
style={{ paddingLeft: "0px", width: "fit-content" }} | ||
text="과제 명세 확인" | ||
/> | ||
<Space height="xs" /> | ||
<Text color="sub">종료 일시 : {assignment.deadline}</Text> | ||
|
||
<Space height={26} /> | ||
<Button | ||
as="a" | ||
disabled={!repositoryLink} | ||
href={assignment.submissionLink} | ||
icon={<Link stroke="primary" />} | ||
style={{ maxWidth: "100%" }} | ||
variant="outline" | ||
> | ||
제출하러 가기 | ||
</Button> | ||
<Space height={8} /> | ||
<Button | ||
disabled={!repositoryLink} | ||
icon={<Reload />} | ||
style={{ maxWidth: "100%" }} | ||
onClick={handleClickSubmissionComplete} | ||
> | ||
제출 완료 | ||
</Button> | ||
</> | ||
} | ||
/> | ||
))} | ||
</> | ||
); | ||
}; |
119 changes: 76 additions & 43 deletions
119
apps/client/app/(afterLogin)/my-study/my-homework/_components/HomeworkOverviewBox.tsx
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 |
---|---|---|
@@ -1,56 +1,89 @@ | ||
"use client"; | ||
|
||
import { Flex, styled } from "@styled-system/jsx"; | ||
import { Space, Text } from "@wow-class/ui"; | ||
import { tags } from "constants/tags"; | ||
import { revalidateTag } from "next/cache"; | ||
import Image from "next/image"; | ||
import type { SubmittableAssignment } from "types/dtos/study-detail-dashboard"; | ||
import { Link, Reload } from "wowds-icons"; | ||
import Box from "wowds-ui/Box"; | ||
import Button from "wowds-ui/Button"; | ||
import Tag from "wowds-ui/Tag"; | ||
import TextButton from "wowds-ui/TextButton"; | ||
|
||
export const HomeworkOverviewBox = () => { | ||
interface HomeworkOverviewBoxProps { | ||
assignments: SubmittableAssignment[]; | ||
} | ||
export const HomeworkOverviewBox = ({ | ||
assignments, | ||
}: HomeworkOverviewBoxProps) => { | ||
const handleClickSubmissionComplete = async () => { | ||
revalidateTag(tags.studyDetailDashboard); | ||
}; | ||
return ( | ||
<Box | ||
text={ | ||
<> | ||
<Text color="primary" typo="label2"> | ||
4주차 | ||
</Text> | ||
<Space height={16} /> | ||
<Flex gap="xs"> | ||
<Text as="h2" typo="h2"> | ||
HTTP 통신 코드 작성하기 | ||
</Text> | ||
<Tag color="blue" variant="solid2"> | ||
제출 완료 | ||
</Tag> | ||
</Flex> | ||
<TextButton style={{ paddingLeft: "0px" }} text="과제 명세 확인" /> | ||
<Space height="xs" /> | ||
<Text color="sub">종료 일시 : 2024년 5월 23일 23:59</Text> | ||
<Flex gap="xs"> | ||
<Text as="div" color="sub"> | ||
제출한 과제 : | ||
<Text as="span" color="textBlack"> | ||
2024-1-Web-Study/Week4 | ||
<> | ||
{assignments.map((assignment) => ( | ||
<Box | ||
key={assignment.studyDetailId} | ||
text={ | ||
<> | ||
<Text color="primary" typo="label2"> | ||
{assignment.week}주차 | ||
</Text> | ||
</Text> | ||
<Image alt="dot" height={6} src="/images/dot.svg" width={6} /> | ||
<styled.div color="primary">글자수 충족</styled.div> | ||
</Flex> | ||
<Space height={26} /> | ||
<Button | ||
icon={<Link stroke="primary" />} | ||
style={{ maxWidth: "100%" }} | ||
variant="outline" | ||
> | ||
제출하러 가기 | ||
</Button> | ||
<Space height={8} /> | ||
<Button icon={<Reload />} style={{ maxWidth: "100%" }}> | ||
제출 완료 | ||
</Button> | ||
</> | ||
} | ||
/> | ||
<Space height={16} /> | ||
<Flex gap="xs"> | ||
<Text as="h2" typo="h2"> | ||
{assignment.title} | ||
</Text> | ||
<Tag color="blue" variant="solid2"> | ||
{assignment.assignmentSubmissionStatus} | ||
</Tag> | ||
</Flex> | ||
<TextButton | ||
as="a" | ||
href={assignment.descriptionLink} | ||
style={{ paddingLeft: "0px", width: "fit-content" }} | ||
text="과제 명세 확인" | ||
/> | ||
<Space height="xs" /> | ||
<Text color="sub">종료 일시 : {assignment.deadline}</Text> | ||
<Flex gap="xs"> | ||
<Text as="div" color="sub"> | ||
제출한 과제 | ||
<Text as="span" color="textBlack"> | ||
{assignment.title} | ||
</Text> | ||
</Text> | ||
<Image alt="dot" height={6} src="/images/dot.svg" width={6} /> | ||
<styled.div color="primary"> | ||
{assignment.assignmentSubmissionStatus === "FAILURE" | ||
? assignment.submissionFailureType | ||
: "글자수 충족"} | ||
</styled.div> | ||
</Flex> | ||
<Space height={26} /> | ||
<Button | ||
as="a" | ||
href={assignment.submissionLink} | ||
icon={<Link stroke="primary" />} | ||
style={{ maxWidth: "100%" }} | ||
variant="outline" | ||
> | ||
제출하러 가기 | ||
</Button> | ||
<Space height={8} /> | ||
<Button | ||
icon={<Reload />} | ||
style={{ maxWidth: "100%" }} | ||
onClick={handleClickSubmissionComplete} | ||
> | ||
제출 완료 | ||
</Button> | ||
</> | ||
} | ||
/> | ||
))} | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.