diff --git a/apps/admin/apis/study/createStudyApi.ts b/apps/admin/apis/study/createStudyApi.ts index ee0a43eb..1f57e3d0 100644 --- a/apps/admin/apis/study/createStudyApi.ts +++ b/apps/admin/apis/study/createStudyApi.ts @@ -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 = { @@ -19,4 +21,16 @@ export const createStudyApi = { ); return { success: response.ok }; }, + searchStudyMentor: async ( + name: string + ): Promise => { + const response = await fetcher.get( + `${apiPath.searchMentor}?name=${name}&roles=REGULAR`, + { + next: { tags: [tags.memberList] }, + cache: "force-cache", + } + ); + return response.data.content; + }, }; diff --git a/apps/admin/apis/study/studyApi.ts b/apps/admin/apis/study/studyApi.ts index cd1de72d..c849ed96 100644 --- a/apps/admin/apis/study/studyApi.ts +++ b/apps/admin/apis/study/studyApi.ts @@ -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"; @@ -127,4 +128,14 @@ export const studyApi = { ); return { success: response.ok }; }, + getStudyAttendances: async (studyId: number) => { + const response = await fetcher.get( + `/mentor/study-details/attendances?studyId=${studyId}`, + { + next: { tags: [tags.attendances] }, + cache: "force-cache", + } + ); + return response.data; + }, }; diff --git a/apps/admin/app/layout.tsx b/apps/admin/app/layout.tsx index 42b0d62c..2129b180 100644 --- a/apps/admin/app/layout.tsx +++ b/apps/admin/app/layout.tsx @@ -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: { diff --git a/apps/admin/app/studies/[studyId]/@modal/(.)announcement-delete/page.tsx b/apps/admin/app/studies/[studyId]/@modal/(.)announcement-delete/page.tsx index 363e7d34..720b7f40 100644 --- a/apps/admin/app/studies/[studyId]/@modal/(.)announcement-delete/page.tsx +++ b/apps/admin/app/studies/[studyId]/@modal/(.)announcement-delete/page.tsx @@ -21,7 +21,7 @@ const AnnouncementDeleteModal = () => { Number(studyAnnouncementId) ); if (result.success) { - revalidateTagByName(tags.announcements); + await revalidateTagByName(tags.announcements); onClose(); } }; diff --git a/apps/admin/app/studies/[studyId]/@modal/(.)announcement-modify/page.tsx b/apps/admin/app/studies/[studyId]/@modal/(.)announcement-modify/page.tsx index db003d05..8b69beeb 100644 --- a/apps/admin/app/studies/[studyId]/@modal/(.)announcement-modify/page.tsx +++ b/apps/admin/app/studies/[studyId]/@modal/(.)announcement-modify/page.tsx @@ -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({ - title: "", - link: "", - }); - - const studyAnnouncementId = searchParams.get("studyAnnouncementId"); + useState({ 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(); } }; @@ -41,20 +50,40 @@ const AnnouncementModifyModal = () => { 공지를 수정해주세요 - { - setStudyAnnouncement({ ...studyAnnouncement, title: value }); - }} - /> - { - setStudyAnnouncement({ ...studyAnnouncement, link: value }); - }} - /> + + 공지 제목 + 0 ? "typed" : "default", + })} + onChange={(e) => { + setStudyAnnouncement({ + ...studyAnnouncement, + title: e.target.value, + }); + }} + /> + + + 공지 링크 + 0 ? "typed" : "default", + })} + onChange={(e) => { + setStudyAnnouncement({ + ...studyAnnouncement, + link: e.target.value, + }); + }} + /> + @@ -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", + }, + }, + }, +}); diff --git a/apps/admin/app/studies/[studyId]/_components/announcement/CreateStudyAnnouncement.tsx b/apps/admin/app/studies/[studyId]/_components/announcement/CreateStudyAnnouncement.tsx index 006fe139..00a152a1 100644 --- a/apps/admin/app/studies/[studyId]/_components/announcement/CreateStudyAnnouncement.tsx +++ b/apps/admin/app/studies/[studyId]/_components/announcement/CreateStudyAnnouncement.tsx @@ -1,7 +1,7 @@ "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"; @@ -9,7 +9,6 @@ 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] = @@ -38,24 +37,40 @@ const CreateStudyAnnouncement = ({ studyId }: { studyId: string }) => { 공지를 작성해주세요. - { - setStudyAnnouncement({ ...studyAnnouncement, title: value }); - }} - /> - { - setStudyAnnouncement({ ...studyAnnouncement, link: value }); - }} - /> + + 공지 제목 + 0 ? "typed" : "default", + })} + onChange={(e) => { + setStudyAnnouncement({ + ...studyAnnouncement, + title: e.target.value, + }); + }} + /> + + + 공지 링크 + 0 ? "typed" : "default", + })} + onChange={(e) => { + setStudyAnnouncement({ + ...studyAnnouncement, + link: e.target.value, + }); + }} + /> +