Skip to content

Commit

Permalink
feat: merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SeieunYoo committed Sep 2, 2024
2 parents e4e81a7 + b2e8433 commit 02ccc06
Show file tree
Hide file tree
Showing 69 changed files with 9,859 additions and 7,587 deletions.
14 changes: 14 additions & 0 deletions apps/admin/apis/study/createStudyApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { fetcher } from "@wow-class/utils";
import { apiPath } from "constants/apiPath";
import { tags } from "constants/tags";
import type { CreateStudyApiRequestDto } from "types/dtos/createStudy";
import type { SearchStudyMentorResponseDto } from "types/dtos/searchStudyMentor";
import type { CreateStudyDetailInfoApiRequestDto } from "types/dtos/studyDetailInfo";

export const createStudyApi = {
Expand All @@ -19,4 +21,16 @@ export const createStudyApi = {
);
return { success: response.ok };
},
searchStudyMentor: async (
name: string
): Promise<SearchStudyMentorResponseDto[]> => {
const response = await fetcher.get(
`${apiPath.searchMentor}?name=${name}&roles=REGULAR`,
{
next: { tags: [tags.memberList] },
cache: "force-cache",
}
);
return response.data.content;
},
};
11 changes: 11 additions & 0 deletions apps/admin/apis/study/studyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
AssignmentApiRequestDto,
AssignmentApiResponseDto,
} from "types/dtos/assignmentList";
import type { AttendanceApiResponseDto } from "types/dtos/attendance";
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 @@ -127,4 +128,14 @@ export const studyApi = {
);
return { success: response.ok };
},
getStudyAttendances: async (studyId: number) => {
const response = await fetcher.get<AttendanceApiResponseDto[]>(
`/mentor/study-details/attendances?studyId=${studyId}`,
{
next: { tags: [tags.attendances] },
cache: "force-cache",
}
);
return response.data;
},
};
6 changes: 3 additions & 3 deletions apps/admin/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import type { ReactNode } from "react";

export const metadata: Metadata = {
title: {
default: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
default: "와우 클래스: 멘토 | GDSC Hongik 스터디 서비스",
template: "%s | 와우클래스 멘토",
},
description: "와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다.",
openGraph: {
title: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
title: "와우 클래스: 멘토 | GDSC Hongik 스터디 서비스",
description:
"와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다.",
images: ["/images/og-image.png"],
siteName: "GDSC Hongik 스터디 서비스, 와우클래스 멘토",
siteName: "와우 클래스: 멘토 | GDSC Hongik 스터디 서비스",
type: "website",
},
robots: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const AnnouncementDeleteModal = () => {
Number(studyAnnouncementId)
);
if (result.success) {
revalidateTagByName(tags.announcements);
await revalidateTagByName(tags.announcements);
onClose();
}
};
Expand Down
139 changes: 112 additions & 27 deletions apps/admin/app/studies/[studyId]/@modal/(.)announcement-modify/page.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
"use client";

import { Flex } from "@styled-system/jsx";
import { css, cva } from "@styled-system/css";
import { Flex, styled } from "@styled-system/jsx";
import { Modal, Space, Text } from "@wow-class/ui";
import { useModalRoute } from "@wow-class/ui/hooks";
import { studyApi } from "apis/study/studyApi";
import { tags } from "constants/tags";
import { useSearchParams } from "next/navigation";
import { useState } from "react";
import { useEffect, useState } from "react";
import type { StudyAnnouncementType } from "types/entities/study";
import { revalidateTagByName } from "utils/revalidateTagByName";
import Button from "wowds-ui/Button";
import TextField from "wowds-ui/TextField";

const AnnouncementModifyModal = () => {
import usePrefillAnnouncement from "../../hooks/usePrefillAnnouncement";

const AnnouncementModifyModal = ({
params,
}: {
params: { studyId: string };
}) => {
const searchParams = useSearchParams();
const { studyId } = params;
const studyAnnouncementId = Number(searchParams.get("studyAnnouncementId"));
const prefillData = usePrefillAnnouncement(
Number(studyId),
studyAnnouncementId
);
const [studyAnnouncement, setStudyAnnouncement] =
useState<StudyAnnouncementType>({
title: "",
link: "",
});

const studyAnnouncementId = searchParams.get("studyAnnouncementId");
useState<StudyAnnouncementType>({ title: "", link: "" });

useEffect(() => {
setStudyAnnouncement(prefillData);
}, [prefillData]);
const { onClose } = useModalRoute();

const handleClickModifyButton = async () => {
const result = await studyApi.modifyStudyAnnouncement(
Number(studyAnnouncementId),
studyAnnouncementId,
studyAnnouncement
);
if (result.success) {
revalidateTagByName(tags.announcements);
await revalidateTagByName(tags.announcements);
onClose();
}
};
Expand All @@ -41,20 +50,40 @@ const AnnouncementModifyModal = () => {
<Text typo="h1">공지를 수정해주세요</Text>
<Space height={29} />
<Flex direction="column" gap="1.125rem">
<TextField
label="공지 제목"
placeholder="입력해주세요"
onChange={(value) => {
setStudyAnnouncement({ ...studyAnnouncement, title: value });
}}
/>
<TextField
label="공지 링크"
placeholder="http://example.com"
onChange={(value) => {
setStudyAnnouncement({ ...studyAnnouncement, link: value });
}}
/>
<Flex direction="column" gap="xs" width="100%">
<styled.label className={labelStyle}>공지 제목</styled.label>
<styled.textarea
placeholder="입력해주세요"
rows={1}
value={studyAnnouncement.title}
className={textareaStyle({
type: studyAnnouncement.title?.length > 0 ? "typed" : "default",
})}
onChange={(e) => {
setStudyAnnouncement({
...studyAnnouncement,
title: e.target.value,
});
}}
/>
</Flex>
<Flex direction="column" gap="xs" width="100%">
<styled.label className={labelStyle}>공지 링크</styled.label>
<styled.textarea
placeholder="http://example.com"
rows={1}
value={studyAnnouncement.link}
className={textareaStyle({
type: studyAnnouncement.link?.length > 0 ? "typed" : "default",
})}
onChange={(e) => {
setStudyAnnouncement({
...studyAnnouncement,
link: e.target.value,
});
}}
/>
</Flex>
</Flex>
<Space height={28} />
<Flex gap="sm">
Expand All @@ -69,3 +98,59 @@ const AnnouncementModifyModal = () => {
};

export default AnnouncementModifyModal;

const labelStyle = css({
display: "flex",
justifyContent: "space-between",
alignItems: "center",
textStyle: "label2",
color: "sub",
});

const textareaStyle = cva({
base: {
borderRadius: "sm",
borderWidth: "button",
borderStyle: "solid",
paddingX: "sm",
paddingY: "xs",
textStyle: "body1",
height: "2.625rem",
maxHeight: "7.5rem",
overflowY: "hidden",
resize: "none",
backgroundColor: "backgroundNormal",
_placeholder: {
color: "outline",
},
_focus: {
outline: "none",
borderColor: "primary",
},
_scrollbar: {
width: "2px",
},
_scrollbarThumb: {
width: "2px",
height: "65px",
borderRadius: "sm",
backgroundColor: "outline",
},
_scrollbarTrack: {
marginTop: "2px",
marginBottom: "2px",
},
},
variants: {
type: {
default: {
borderColor: "outline",
color: "outline",
},
typed: {
borderColor: "sub",
color: "textBlack",
},
},
},
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"use client";

import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { css, cva } from "@styled-system/css";
import { Flex, styled } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { studyApi } from "apis/study/studyApi";
import { tags } from "constants/tags";
import { useState } from "react";
import type { StudyAnnouncementType } from "types/entities/study";
import { revalidateTagByName } from "utils/revalidateTagByName";
import Button from "wowds-ui/Button";
import TextField from "wowds-ui/TextField";

const CreateStudyAnnouncement = ({ studyId }: { studyId: string }) => {
const [studyAnnouncement, setStudyAnnouncement] =
Expand Down Expand Up @@ -38,24 +37,40 @@ const CreateStudyAnnouncement = ({ studyId }: { studyId: string }) => {
<Text typo="h2">공지를 작성해주세요.</Text>
<Flex gap="xl" justify="space-between" width="100%">
<Flex gap="sm" justifyContent="stretch" width="100%">
<TextField
label="공지 제목"
placeholder="입력해주세요"
style={{ width: "100%" }}
value={studyAnnouncement.title}
onChange={(value) => {
setStudyAnnouncement({ ...studyAnnouncement, title: value });
}}
/>
<TextField
label="공지 링크"
placeholder="http://example.com"
style={{ width: "100%" }}
value={studyAnnouncement.link}
onChange={(value) => {
setStudyAnnouncement({ ...studyAnnouncement, link: value });
}}
/>
<Flex direction="column" gap="xs" width="100%">
<styled.label className={labelStyle}>공지 제목</styled.label>
<styled.textarea
placeholder="입력해주세요"
rows={1}
value={studyAnnouncement.title}
className={textareaStyle({
type: studyAnnouncement.title?.length > 0 ? "typed" : "default",
})}
onChange={(e) => {
setStudyAnnouncement({
...studyAnnouncement,
title: e.target.value,
});
}}
/>
</Flex>
<Flex direction="column" gap="xs" width="100%">
<styled.label className={labelStyle}>공지 링크</styled.label>
<styled.textarea
placeholder="http://example.com"
rows={1}
value={studyAnnouncement.link}
className={textareaStyle({
type: studyAnnouncement.link?.length > 0 ? "typed" : "default",
})}
onChange={(e) => {
setStudyAnnouncement({
...studyAnnouncement,
link: e.target.value,
});
}}
/>
</Flex>
</Flex>
<Button
size="sm"
Expand All @@ -77,11 +92,67 @@ export default CreateStudyAnnouncement;

const StudyAnnouncementBoxStyle = css({
width: "100%",
height: "171px",
minHeight: "171px",
backgroundColor: "backgroundAlternative",
borderRadius: "md",
display: "flex",
flexDirection: "column",
gap: "24px",
padding: "30px",
});

const labelStyle = css({
display: "flex",
justifyContent: "space-between",
alignItems: "center",
textStyle: "label2",
color: "sub",
});

const textareaStyle = cva({
base: {
borderRadius: "sm",
borderWidth: "button",
borderStyle: "solid",
paddingX: "sm",
paddingY: "xs",
textStyle: "body1",
height: "2.625rem",
maxHeight: "7.5rem",
overflowY: "hidden",
resize: "none",
backgroundColor: "backgroundNormal",
_placeholder: {
color: "outline",
},
_focus: {
outline: "none",
borderColor: "primary",
},
_scrollbar: {
width: "2px",
},
_scrollbarThumb: {
width: "2px",
height: "65px",
borderRadius: "sm",
backgroundColor: "outline",
},
_scrollbarTrack: {
marginTop: "2px",
marginBottom: "2px",
},
},
variants: {
type: {
default: {
borderColor: "outline",
color: "outline",
},
typed: {
borderColor: "sub",
color: "textBlack",
},
},
},
});
Loading

0 comments on commit 02ccc06

Please sign in to comment.