Skip to content

Commit

Permalink
fix: conflict 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 31, 2024
2 parents 4e91dbb + d935ed2 commit fc07a30
Show file tree
Hide file tree
Showing 86 changed files with 1,120 additions and 438 deletions.
35 changes: 34 additions & 1 deletion apps/admin/apis/study/studyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { fetcher } from "@wow-class/utils";
import { apiPath, mentorApiPath } from "constants/apiPath";
import { tags } from "constants/tags";
import type { AnnouncementApiResponseDto } from "types/dtos/announcement";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import type {
AssignmentApiRequestDto,
AssignmentApiResponseDto,
} from "types/dtos/assignmentList";
import type { CurriculumApiResponseDto } from "types/dtos/curriculumList";
import type { StudyBasicInfoApiResponseDto } from "types/dtos/studyBasicInfo";
import type { StudyAnnouncementType } from "types/entities/study";
Expand Down Expand Up @@ -40,6 +43,36 @@ export const studyApi = {
);
return response.data;
},
getAssignment: async (studyDetailId: number) => {
const response = await fetcher.get<AssignmentApiResponseDto>(
`/mentor/study-details/${studyDetailId}/assignments`,
{
next: { tags: [`${tags.assignments} ${studyDetailId}`] },
cache: "force-cache",
}
);
return response.data;
},
createAssignment: async (
studyDetailId: number,
data: AssignmentApiRequestDto
) => {
const response = await fetcher.put(
`/mentor/study-details/${studyDetailId}/assignments`,
data
);
return { success: response.ok };
},
patchAssignment: async (
studyDetailId: number,
data: AssignmentApiRequestDto
) => {
const response = await fetcher.patch(
`/mentor/study-details/${studyDetailId}/assignments`,
data
);
return { success: response.ok };
},
cancelAssignment: async (studyDetailId: number) => {
const response = await fetcher.patch(
`/mentor/study-details/${studyDetailId}/assignments/cancel`,
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/app/@modal/(.)participants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { useModalRoute } from "@wow-class/ui/hooks";
import Button from "wowds-ui/Button";

const TestModal = () => {
const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();

return (
<Modal onClose={closeModal}>
<Modal>
<Flex gap="sm" width="21rem">
<Button variant="outline" onClick={closeModal}>
<Button variant="outline" onClick={onClose}>
취소
</Button>
<Button>저장하기</Button>
Expand Down
30 changes: 28 additions & 2 deletions apps/admin/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,34 @@ import type { Metadata } from "next";
import type { ReactNode } from "react";

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: {
default: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
template: "%s | 와우클래스 멘토",
},
description: "와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다.",
openGraph: {
title: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
description:
"와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다.",
images: ["/images/og-image.png"],
siteName: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
type: "website",
},
robots: {
index: false,
follow: false,
},
icons: {
icon: "/images/logo.svg",
apple: "/images/logo.svg",
other: [
{
rel: "icon",
type: "image/svg+xml",
url: "/images/logo.svg",
},
],
},
};

const RootLayout = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const AnnouncementDeleteModal = () => {

const studyAnnouncementId = searchParams.get("studyAnnouncementId");

const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();

const handleClickDeleteButton = async () => {
const result = await studyApi.deleteStudyAnnouncement(
Number(studyAnnouncementId)
);
if (result.success) {
revalidateTagByName(tags.announcements);
closeModal();
onClose();
}
};

Expand All @@ -33,7 +33,7 @@ const AnnouncementDeleteModal = () => {
<Space height={33} />

<Flex gap="sm">
<Button variant="outline" onClick={closeModal}>
<Button variant="outline" onClick={onClose}>
취소
</Button>
<Button onClick={handleClickDeleteButton}>삭제하기</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const AnnouncementModifyModal = () => {

const studyAnnouncementId = searchParams.get("studyAnnouncementId");

const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();

const handleClickModifyButton = async () => {
const result = await studyApi.modifyStudyAnnouncement(
Expand All @@ -31,7 +31,7 @@ const AnnouncementModifyModal = () => {
);
if (result.success) {
revalidateTagByName(tags.announcements);
closeModal();
onClose();
}
};

Expand All @@ -58,7 +58,7 @@ const AnnouncementModifyModal = () => {
</Flex>
<Space height={28} />
<Flex gap="sm">
<Button variant="outline" onClick={closeModal}>
<Button variant="outline" onClick={onClose}>
취소
</Button>
<Button onClick={handleClickModifyButton}>수정하기</Button>
Expand Down
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;
Original file line number Diff line number Diff line change
@@ -1,43 +1,23 @@
"use client";
import { cva } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Table, Text } from "@wow-class/ui";
import { padWithZero, parseISODate } from "@wow-class/utils";
import { studyApi } from "apis/study/studyApi";
import { tags } from "constants/tags";
import Link from "next/link";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import getIsCurrentWeek from "utils/getIsCurrentWeek";
import { revalidateTagByName } from "utils/revalidateTagByName";
import Button from "wowds-ui/Button";

import AssignmentButtons from "./AssignmentButtons";

const AssignmentListItem = ({
assignment,
}: {
assignment: AssignmentApiResponseDto;
}) => {
const {
studyDetailId,
title,
deadline,
week,
descriptionLink,
assignmentStatus,
} = assignment;
const { studyDetailId, title, deadline, week, assignmentStatus } = assignment;
const thisWeekAssignment = getIsCurrentWeek(deadline);
const { year, month, day, hours, minutes } = parseISODate(deadline);

const studyDeadline = `종료 : ${year}${month}${day}${padWithZero(hours)}:${padWithZero(minutes)}`;

const handleCancelAssignment = async (studyDetailId: number) => {
const { success } = await studyApi.cancelAssignment(studyDetailId);
if (success) {
window.alert("휴강 처리에 성공했어요.");
revalidateTagByName(tags.assignments);
} else {
window.alert("휴강 처리에 실패했어요.");
}
};
return (
<Table>
<Table.Left style={TableLeftStyle}>
Expand All @@ -57,38 +37,10 @@ const AssignmentListItem = ({
</Flex>
</Table.Left>
<Table.Right>
<>
{assignmentStatus === "OPEN" ? (
<Button
asProp={Link}
href={descriptionLink || ""}
size="sm"
variant="outline"
>
과제 내용보기
</Button>
) : (
<Flex gap="sm">
<Button
color="sub"
size="sm"
variant="sub"
onClick={() => handleCancelAssignment(studyDetailId)}
>
과제 휴강처리
</Button>
<Button
size="sm"
variant="solid"
onClick={() => {
console.log("TODO: 과제 개설 페이지 연결");
}}
>
과제 개설하기
</Button>
</Flex>
)}
</>
<AssignmentButtons
assignmentStatus={assignmentStatus}
studyDetailId={+studyDetailId}
/>
</Table.Right>
</Table>
);
Expand Down

This file was deleted.

Loading

0 comments on commit fc07a30

Please sign in to comment.