diff --git a/apps/client/apis/studyDetailApi.ts b/apps/client/apis/studyDetailApi.ts
index 508e8372..7cb0183f 100644
--- a/apps/client/apis/studyDetailApi.ts
+++ b/apps/client/apis/studyDetailApi.ts
@@ -1,10 +1,7 @@
import { fetcher } from "@wow-class/utils";
import { apiPath } from "constants/apiPath";
import { tags } from "constants/tags";
-import type {
- StudyDetailDashboardDto,
- UpcomingStudyDto,
-} from "types/dtos/studyDetail";
+import type { StudyDetailDashboardDto } from "types/dtos/studyDetail";
export const studyDetailApi = {
getStudyDetailDashboard: async (studyId: number) => {
@@ -12,18 +9,7 @@ export const studyDetailApi = {
`${apiPath.studyDetail}/dashboard?studyId=${studyId}`,
{
next: { tags: [tags.studyDetailDashboard] },
- cache: "force-cache",
- }
- );
-
- return response.data;
- },
- getUpcomingStudy: async (studyId: number) => {
- const response = await fetcher.get(
- `${apiPath.studyDetail}/upcoming?studyId=${studyId}`,
- {
- next: { tags: [tags.upcomingStudy] },
- cache: "force-cache",
+ cache: "no-store",
}
);
diff --git a/apps/client/apis/studyHistoryApi.ts b/apps/client/apis/studyHistoryApi.ts
index 02e7dedd..1cac542e 100644
--- a/apps/client/apis/studyHistoryApi.ts
+++ b/apps/client/apis/studyHistoryApi.ts
@@ -9,7 +9,7 @@ export const studyHistoryApi = {
`${apiPath.studyHistory}/assignments?studyId=${studyId}`,
{
next: { tags: [tags.studyHistory] },
- cache: "force-cache",
+ cache: "no-store",
}
);
diff --git a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/AssignmentBoxButtons.tsx b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/AssignmentBoxButtons.tsx
index 32c7ab77..48a3b8d0 100644
--- a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/AssignmentBoxButtons.tsx
+++ b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/AssignmentBoxButtons.tsx
@@ -1,61 +1,34 @@
"use client";
import { Space } from "@wow-class/ui";
-import { myStudyApi } from "apis/myStudyApi";
-import { studyDetailApi } from "apis/studyDetailApi";
+import { padWithZero, parseISODate } from "@wow-class/utils";
import { studyHistoryApi } from "apis/studyHistoryApi";
import { tags } from "constants/tags";
import Link from "next/link";
-import { useEffect, useState } from "react";
+import { toast } from "react-toastify";
import type { Assignment } from "types/dtos/studyDetail";
import type { AssignmentSubmissionStatusType } from "types/entities/common/assignment";
-import { getIsAfterStartDate } from "utils/getIsAfterStartDate";
import { isDeadlinePassed } from "utils/isDeadlinePassed";
import { revalidateTagByName } from "utils/revalidateTagByName";
import { Link as LinkIcon, Reload as ReloadIcon } from "wowds-icons";
import Button from "wowds-ui/Button";
interface AssignmentBoxButtonsProps {
assignment: Assignment;
+ repositoryLink?: string;
buttonsDisabled?: boolean;
}
export const AssignmentBoxButtons = ({
- buttonsDisabled: buttonDisabledProp,
+ buttonsDisabled,
assignment,
+ repositoryLink,
}: AssignmentBoxButtonsProps) => {
- const [startDate, setStartDate] = useState("");
-
- const targetWeek = assignment.week;
-
- useEffect(() => {
- const fetchAssignmentStartDate = async () => {
- const ongoingStudyInfo = await myStudyApi.getMyOngoingStudyInfo();
-
- if (ongoingStudyInfo?.studyId) {
- const curriculumData = await myStudyApi.getStudyCurriculumList(
- ongoingStudyInfo.studyId
- );
-
- const matchingWeek = curriculumData?.find(
- (item) => item.week === targetWeek
- );
-
- if (matchingWeek) {
- setStartDate(matchingWeek.period.startDate);
- }
- }
- };
-
- fetchAssignmentStartDate();
- }, [targetWeek]);
-
- const buttonsDisabled = buttonDisabledProp || !getIsAfterStartDate(startDate);
-
return (
<>
{
- const [repositoryLink, setRepositoryLink] = useState("");
-
- useEffect(() => {
- const fetchStudyDashBoard = async () => {
- const ongoingStudyInfo = await myStudyApi.getMyOngoingStudyInfo();
- if (!ongoingStudyInfo) {
- return;
- }
- const studyDashboard = await studyDetailApi.getStudyDetailDashboard(
- ongoingStudyInfo.studyId
- );
-
- if (!studyDashboard) {
- return;
- } else {
- setRepositoryLink(studyDashboard.repositoryLink);
- }
- };
-
- fetchStudyDashBoard();
- }, []);
-
const { assignmentSubmissionStatus, submissionFailureType, submissionLink } =
assignment;
const { primaryButtonText } =
@@ -105,14 +57,13 @@ const PrimaryButton = ({
return;
}
const stroke = buttonsDisabled ? "mono100" : "primary";
- const link =
- assignmentSubmissionStatus === null ? repositoryLink : submissionLink;
-
+ const primaryButtonHref =
+ assignmentSubmissionStatus === "SUCCESS" ? submissionLink : repositoryLink;
return (
}
style={buttonStyle}
target="_blank"
@@ -126,35 +77,35 @@ const PrimaryButton = ({
const SecondaryButton = ({
assignment,
buttonsDisabled,
-}: AssignmentBoxButtonsProps) => {
+}: Omit) => {
const { assignmentSubmissionStatus, studyDetailId, deadline, committedAt } =
assignment;
+ if (isDeadlinePassed(deadline)) {
+ return (
+
+ );
+ }
const { secondaryButtonText } =
assignmentSubmissionStatus === null
? buttonTextMap.INITIAL
: buttonTextMap[assignmentSubmissionStatus];
+
const handleClickSubmissionComplete = async () => {
const response = await studyHistoryApi.submitAssignment(studyDetailId);
if (response.success) {
- //TODO: 과제 제출 이후에는 과제 상태에 대한 업데이트 필요
- //이번주 과제 조회 api, 대시보드 api revaliate
- revalidateTagByName(
- assignmentSubmissionStatus === null
- ? tags.studyDetailDashboard
- : tags.upcomingStudy
- );
+ revalidateTagByName(tags.studyDetailDashboard);
revalidateTagByName(tags.studyHistory);
+ toast.success("과제 제출이 완료되었어요.");
}
};
- if (isDeadlinePassed(deadline)) {
- return (
-
- );
- }
const stroke = buttonsDisabled ? "mono100" : "backgroundNormal";
+ const { year, month, day, hours, minutes } = parseISODate(
+ committedAt as string
+ );
+ const commitText = `최종 수정일자 ${year}년 ${month}월 ${day}일 ${padWithZero(hours)}:${padWithZero(minutes)}`;
return (
)}
+ {submissionFailureType === "UNKNOWN" && (
+
+ '위치 확인 불가' 나 '글자 수 부족' 외의 다른 이유로
+
+ 제출 실패를 한 경우에요.
+
+ 제대로 제출한 후에도 계속 '알 수 없음' 이 뜬다면,
+
+ GDSC Hongik 카카오톡 채널로 문의해주세요.
+
+ )}
diff --git a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/index.tsx b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/index.tsx
index 5104abad..7a69514b 100644
--- a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/index.tsx
+++ b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/AssignmentOverviewBox/index.tsx
@@ -1,6 +1,8 @@
import { Space } from "@wow-class/ui";
+import { myStudyApi } from "apis/myStudyApi";
import Link from "next/link";
import type { Assignment } from "types/dtos/studyDetail";
+import { getNowIsAfterStartDate } from "utils/getNowIsAfterStartDate";
import Box from "wowds-ui/Box";
import TextButton from "wowds-ui/TextButton";
@@ -11,39 +13,65 @@ import { AssignmentBoxTitle } from "./AssignmentBoxTitle";
interface AssignmentOverviewBoxProps {
assignments: Assignment[];
buttonsDisabled?: boolean;
+ repositoryLink?: string;
}
-export const AssignmentOverviewBox = ({
+export const AssignmentOverviewBox = async ({
assignments,
+ repositoryLink,
buttonsDisabled = false,
}: AssignmentOverviewBoxProps) => {
+ const myOngoingStudyInfoData = await myStudyApi.getMyOngoingStudyInfo();
+
+ if (!myOngoingStudyInfoData?.studyId) {
+ return;
+ }
+
+ const curriculumData = await myStudyApi.getStudyCurriculumList(
+ myOngoingStudyInfoData.studyId
+ );
+
return (
<>
- {assignments.map((assignment) => (
-
-
-
-
-
-
- >
- }
- />
- ))}
+ {assignments.map((assignment) => {
+ const currentCurriculum = curriculumData?.find(
+ (item) => item.week === assignment.week
+ );
+
+ const isSubmittable = getNowIsAfterStartDate(
+ String(currentCurriculum?.period.startDate)
+ );
+
+ return (
+
+
+
+
+
+
+ >
+ }
+ />
+ );
+ })}
>
);
};
diff --git a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/RepositorySubmissionBox.tsx b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/RepositorySubmissionBox.tsx
index 83db2729..2757bb47 100644
--- a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/RepositorySubmissionBox.tsx
+++ b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/RepositorySubmissionBox.tsx
@@ -66,12 +66,12 @@ export const RepositorySubmissionBox = ({
if (!repositoryUrl) {
setErrorState({
isError: true,
- errorMessage: "빈 URL은 입력할 수 없습니다.",
+ errorMessage: "빈 URL은 입력할 수 없어요.",
});
} else if (!isGithubRepositoryUrl(repositoryUrl)) {
setErrorState({
isError: true,
- errorMessage: "GitHub repository URL을 제출해야 합니다.",
+ errorMessage: "GitHub 레포지토리 URL을 입력해야 해요.",
});
} else {
setErrorState({
diff --git a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/index.tsx b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/index.tsx
index 418fe119..fbb95426 100644
--- a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/index.tsx
+++ b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentContent/index.tsx
@@ -19,34 +19,33 @@ export const AssignmentContent = async () => {
myOngoingStudyInfoData.studyId
);
- const upcomingStudy = await studyDetailApi.getUpcomingStudy(
- myOngoingStudyInfoData.studyId
- );
-
if (!studyDashboard) {
return;
}
+ if (studyDashboard.submittableAssignments.length === 0) {
+ return (
+
+ );
+ }
+
return (
{studyDashboard.isLinkEditable && (
- <>
-
-
- >
+
)}
- {!studyDashboard.isLinkEditable &&
- (upcomingStudy ? (
-
- ) : (
-
- ))}
+
);
diff --git a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentHistory/AssignmentHistoryItem.tsx b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentHistory/AssignmentHistoryItem.tsx
index e4ed7767..07563ec4 100644
--- a/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentHistory/AssignmentHistoryItem.tsx
+++ b/apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentHistory/AssignmentHistoryItem.tsx
@@ -41,11 +41,16 @@ export const AssignmentHistoryItem = ({
return (
-
+
{week}주차
-
+
{title}
{deadlineText}
@@ -53,10 +58,10 @@ export const AssignmentHistoryItem = ({
-
+
{descriptionLink ? (
-
+
) : (
"-"
@@ -66,7 +71,7 @@ export const AssignmentHistoryItem = ({
{tagText}
-
+
{assignmentSubmissionStatus === "FAILURE" &&
failMapping[submissionFailureType ?? "NONE"]}
@@ -104,9 +109,28 @@ const getTagProps = (
return assignmentSubmissionMap.CANCELLED;
};
+const weekStyle = css({
+ width: "37px",
+});
+
+const titleStyle = css({
+ "@media (max-width: 1200px)": {
+ width: "250px",
+ },
+});
const buttonContainerStyle = css({
justifyContent: "center",
textStyle: "body1",
+ minWidth: "163px",
+ "@media (max-width: 1440px) and (min-width: 1201px)": {
+ minWidth: "117px",
+ },
+ "@media (max-width: 1200px) and (min-width: 961px)": {
+ minWidth: "133px",
+ },
+ "@media (max-width: 960px)": {
+ display: "none",
+ },
});
const tagContainerStyle = css({
@@ -115,8 +139,16 @@ const tagContainerStyle = css({
width: "129px",
alignItems: "center",
flexDirection: "column",
+ "@media (max-width: 1199px)": {
+ display: "none !important",
+ },
});
+const textButtonStyle = css({
+ "@media (max-width: 960px)": {
+ display: "none",
+ },
+});
const assignmentSubmissionMap: Record<
"CANCELLED" | "FAILURE" | "SUCCESS",
{ tagText: string; tagColor: ComponentProps["color"] }
@@ -130,4 +162,5 @@ const failMapping: Record = {
WORD_COUNT_INSUFFICIENT: "글자수부족",
NOT_SUBMITTED: "미제출",
NONE: "",
+ UNKNOWN: "알수없음",
};
diff --git a/apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx b/apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx
index 0a6e350b..89064a6d 100644
--- a/apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx
+++ b/apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx
@@ -139,8 +139,9 @@ const dateStyle = css({
});
const timeCellStyle = css({
- paddingX: "28px",
- width: "178px",
+ width: "162px",
+ display: "flex",
+ paddingLeft: "28px",
textAlign: "center",
"@media (max-width: 1439px)": {
overflow: "hidden",
@@ -165,7 +166,11 @@ const textCellStyle = cva({
variants: {
type: {
mentor: {
- paddingX: "15px",
+ "@media (min-width: 1440px)": {
+ width: "103px",
+ display: "flex",
+ justifyContent: "center",
+ },
"@media (max-width: 1199px)": {
width: "fit-content",
paddingInline: "7.25px",
@@ -175,7 +180,11 @@ const textCellStyle = cva({
},
},
week: {
- paddingX: "28px",
+ "@media (min-width: 1440px)": {
+ width: "118px",
+ display: "flex",
+ justifyContent: "center",
+ },
"@media (max-width: 1199px)": {
display: "none",
},
diff --git a/apps/client/components/Navbar.tsx b/apps/client/components/Navbar.tsx
index 5b605764..172586e4 100644
--- a/apps/client/components/Navbar.tsx
+++ b/apps/client/components/Navbar.tsx
@@ -47,7 +47,7 @@ const Navbar = async () => {
alt={menu.alt}
href={menu.href}
imageUrl={menu.imageUrl}
- //items={menu.items}
+ items={menu.items}
key={menu.name}
name={menu.name}
/>
diff --git a/apps/client/components/Popover.tsx b/apps/client/components/Popover.tsx
index fbbc7580..2bc3f642 100644
--- a/apps/client/components/Popover.tsx
+++ b/apps/client/components/Popover.tsx
@@ -21,12 +21,12 @@ const Popover = ({ triggerContent, children }: PopoverProps) => {
onClose();
};
return (
-
+
{open && (
-
+
{
- const regex = /github\.com\/[^/]+\/([^/]+)\/([^/]+)/;
- const match = submissionLink.match(regex);
+export const getAssignmentGithubFolderName = (repositoryLink: string) => {
+ const regex = /github\.com\/[^/]+\/([^/]+)(?:\/([^/]+))?/;
+ const match = repositoryLink.match(regex);
if (match) {
const repoName = match[1];
- const folderName = match[2];
- return `${repoName}/${folderName}`;
+ return repoName;
}
};
diff --git a/apps/client/utils/getIsAfterStartDate.ts b/apps/client/utils/getNowIsAfterStartDate.ts
similarity index 55%
rename from apps/client/utils/getIsAfterStartDate.ts
rename to apps/client/utils/getNowIsAfterStartDate.ts
index f4c4e359..397b7028 100644
--- a/apps/client/utils/getIsAfterStartDate.ts
+++ b/apps/client/utils/getNowIsAfterStartDate.ts
@@ -1,4 +1,4 @@
-export const getIsAfterStartDate = (startDate: string): boolean => {
+export const getNowIsAfterStartDate = (startDate: string): boolean => {
const now = new Date();
const start = new Date(startDate);
return now >= start;