-
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.
- Loading branch information
Showing
86 changed files
with
1,120 additions
and
438 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
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
68 changes: 68 additions & 0 deletions
68
apps/admin/app/studies/[studyId]/_components/assignment/AssignmentButtons.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,68 @@ | ||
"use client"; | ||
import { Flex } from "@styled-system/jsx"; | ||
import { studyApi } from "apis/study/studyApi"; | ||
import { routerPath } from "constants/router/routerPath"; | ||
import Link from "next/link"; | ||
import type { StudyAssignmentStatusType } from "types/entities/study"; | ||
import Button from "wowds-ui/Button"; | ||
|
||
const AssignmentButtons = ({ | ||
studyDetailId, | ||
assignmentStatus, | ||
}: { | ||
studyDetailId: number; | ||
assignmentStatus: StudyAssignmentStatusType; | ||
}) => { | ||
const handleCancelAssignment = async () => { | ||
const { success } = await studyApi.cancelAssignment(studyDetailId); | ||
if (success) { | ||
console.log("휴강 처리에 성공했어요."); | ||
} else { | ||
console.log("휴강 처리에 실패했어요."); | ||
} | ||
}; | ||
|
||
if (assignmentStatus === "OPEN") { | ||
return ( | ||
<Button | ||
asProp={Link} | ||
href={routerPath["assignment-detail"].href(studyDetailId)} | ||
size="sm" | ||
variant="outline" | ||
> | ||
과제 내용보기 | ||
</Button> | ||
); | ||
} | ||
|
||
if (assignmentStatus === "CANCELLED") { | ||
return ( | ||
<Flex gap="sm"> | ||
<Button size="sm" variant="sub"> | ||
과제 휴강완료 | ||
</Button> | ||
<Button disabled size="sm" variant="solid"> | ||
과제 개설하기 | ||
</Button> | ||
</Flex> | ||
); | ||
} | ||
|
||
return ( | ||
<Flex gap="sm"> | ||
<Button size="sm" variant="sub" onClick={handleCancelAssignment}> | ||
과제 휴강처리 | ||
</Button> | ||
<Button | ||
asProp={Link} | ||
href={routerPath["assignment-edit"].href(studyDetailId)} | ||
size="sm" | ||
variant="solid" | ||
> | ||
과제 개설하기 | ||
</Button> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default AssignmentButtons; |
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
61 changes: 0 additions & 61 deletions
61
apps/admin/app/studies/[studyId]/_components/assignment/CancelStudyButton.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.