Skip to content

Commit

Permalink
chore: dev 머지
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 30, 2024
2 parents 78caf3b + 153759f commit 15b40bf
Show file tree
Hide file tree
Showing 34 changed files with 230 additions and 897 deletions.
2 changes: 1 addition & 1 deletion apps/admin/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ const errorPageContentStyle = css({
});

const buttonStyle = {
width: 328,
maxWidth: 328,
};
2 changes: 1 addition & 1 deletion apps/admin/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ const notFoundPageContentStyle = css({
});

const buttonStyle = {
width: 328,
maxWidth: 328,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"use client";

import { Flex } from "@styled-system/jsx";
import { Modal, Space, Text } from "@wow-class/ui";
import { useModalRoute } from "@wow-class/ui/hooks";
import { createStudyApi } from "apis/form/createStudyApi";
import { routerPath } from "constants/router/routerPath";
import { tags } from "constants/tags";
import useParseSearchParams from "hooks/useParseSearchParams";
import Image from "next/image";
import { useRouter } from "next/navigation";
import type { CreateStudyApiRequestDto } from "types/dtos/createStudy";
import { revalidateTagByName } from "utils/revalidateTagByName";
import Button from "wowds-ui/Button";

const CreatedStudyCheckModal = () => {
const { parseToJsonSearchParam } = useParseSearchParams();
const data = parseToJsonSearchParam<CreateStudyApiRequestDto>("data");
const router = useRouter();
const { closeModal } = useModalRoute();

const studyName = data.title;
const semester = `${data.academicYear}-${data.semesterType === "FIRST" ? "1" : "2"}`;

const handleClickSubmitButton = async () => {
const result = await createStudyApi.postCreateStudy(data);

if (result.success) {
await revalidateTagByName(tags.studyList);
window.alert("스터디 생성에 성공했어요.");
router.push(`${routerPath.root.href}`);
} else {
window.alert("스터디 생성에 실패했어요.");
}
};

return (
<Modal>
<Flex alignItems="center" direction="column" padding="24px" width="100%">
<Flex alignItems="center" gap="sm" justify="center" marginBottom="2px">
<Text color="primary" typo="h1">
{studyName}
</Text>
<ItemSeparator />
<Text color="primary" typo="h1">
{semester}
</Text>
</Flex>
<Text typo="h1">새로운 스터디를 개설하시겠어요?</Text>
<Space height={28} />
<Flex gap="sm" justify="center" width="21rem">
<Button variant="outline" onClick={closeModal}>
취소
</Button>
<Button onClick={handleClickSubmitButton}>개설하기</Button>
</Flex>
</Flex>
</Modal>
);
};

export default CreatedStudyCheckModal;

const ItemSeparator = () => (
<Image alt="item separator" height={6} src="/images/dot.svg" width={6} />
);
5 changes: 5 additions & 0 deletions apps/admin/app/studies/create-study/@modal/default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Default = () => {
return null;
};

export default Default;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const StudyDayOfWeekSelect = () => {
}}
>
{dayToKoreanList.map(({ text, value }) => (
<DropDownOption text={text} value={value!!} />
<DropDownOption key={`${text}`} text={text} value={value!!} />
))}
</DropDown>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const StudyFormatSelect = () => {
}}
>
<DropDownOption
value="ASSIGNMENT"
value="OFFLINE"
text={
<Flex alignItems="center" gap="md">
<Text typo="body1">오프라인 커리큘럼</Text>
Expand All @@ -42,7 +42,7 @@ const StudyFormatSelect = () => {
}
/>
<DropDownOption
value="OFFLINE"
value="ASSIGNMENT"
text={
<Flex alignItems="center" gap="md">
<Text typo="body1">과제 스터디</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ type ValuePiece = Date | string | null;
type Value = ValuePiece | [ValuePiece, ValuePiece];

const StudyTime = () => {
const { control, setValue } = useFormContext();
const { control, setValue, watch } = useFormContext();
const [value, onChange] = useState<Value>(["10:00", "11:00"]);

const isAssignmentStudy = watch("studyType") === "ASSIGNMENT";

const handleSetTime = (value: Value) => {
if (!value) return;
onChange(value);
Expand Down Expand Up @@ -47,10 +49,14 @@ const StudyTime = () => {
control={control}
name="studyStartTime"
render={() => (
<TimeRangePicker value={value} onChange={handleSetTime} />
<TimeRangePicker
disabled={isAssignmentStudy}
value={value}
onChange={handleSetTime}
/>
)}
rules={{
required: true,
required: !isAssignmentStudy,
}}
/>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import StudySemesterSelect from "./StudySemesterSelect";
import StudyStartDatePick from "./StudyStartDatePick";
import StudyTime from "./StudyTime";

const StudyBasicInfo = () => {
const StudyBasicInformation = () => {
return (
<Flex direction="column" gap="xl" maxWidth="5/6">
<Text typo="h2">스터디 기본 설정</Text>
Expand All @@ -31,4 +31,4 @@ const StudyBasicInfo = () => {
);
};

export default StudyBasicInfo;
export default StudyBasicInformation;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { routerPath } from "constants/router/routerPath";
import { redirect } from "next/navigation";

const CreatedStudyCheckPage = () => {
return redirect(routerPath.root.href);
};

export default CreatedStudyCheckPage;
5 changes: 5 additions & 0 deletions apps/admin/app/studies/create-study/default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Default = () => {
return null;
};

export default Default;
16 changes: 16 additions & 0 deletions apps/admin/app/studies/create-study/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const CreateStudyLayout = ({
children,
modal,
}: Readonly<{
children: React.ReactNode;
modal: React.ReactNode;
}>) => {
return (
<main>
{children}
{modal}
</main>
);
};

export default CreateStudyLayout;
9 changes: 7 additions & 2 deletions apps/admin/app/studies/create-study/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,25 @@ const CreateStudyPage = () => {
position="relative"
width="100%"
>
<form onSubmit={methods.handleSubmit(onSubmit)}>
<form>
<StudyNameTextField />
<Space height={48} />
<StudyMentorSelect />
<Space height={64} />
<StudyBasicInformation />
<Button
asProp={Link}
disabled={!methods.formState.isValid}
role="button"
size="sm"
style={{ position: "absolute", top: "0px", right: "0px" }}
type="submit"
href={{
pathname: `${routerPath["created-study-check"].href}`,
query: { data: JSON.stringify(methods.getValues()) },
}}
>
제출하기
개설하기
</Button>
</form>
</Flex>
Expand Down
4 changes: 4 additions & 0 deletions apps/admin/constants/router/routerPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ export const routerPath = {
description: "스터디 상세 페이지 작성을 확인하는 모달창입니다.",
href: `/detail-info-check`,
},
"created-study-check": {
description: "스터디 생성을 확인하는 모달창입니다.",
href: "create-study/created-study-check",
},
};
4 changes: 2 additions & 2 deletions apps/admin/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const middleware = async (req: NextRequest) => {
if (studyRole === "STUDENT" && manageRole === "NONE") {
const url =
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
? process.env.CLIENT_PROD_URL
: process.env.CLIENT_DEV_URL;
? process.env.NEXT_PUBLIC_CLIENT_PROD_URL
: process.env.NEXT_PUBLIC_CLIENT_DEV_URL;

return NextResponse.redirect(new URL("/auth", url));
}
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/types/dtos/createStudy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface CreateStudyApiRequestDto {
totalWeek: number;
startDate: string;
dayOfWeek: DayOfWeekType;
studyStartTime: TimeType;
studyEndTime: TimeType;
studyStartTime?: TimeType;
studyEndTime?: TimeType;
studyType: StudyType;
}
7 changes: 6 additions & 1 deletion apps/client/app/(afterLogin)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const Layout = ({ children }: { children: React.ReactNode }) => {
return (
<>
<Navbar />
<styled.main padding="54px 0 0 101px" width="calc(100vw - 351px)">
<styled.main
left="250px"
padding="54px 0 0 101px"
position="absolute"
width="calc(100vw - 351px)"
>
{children}
</styled.main>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const StudyCurriculum = async () => {
period: { startDate, endDate },
attendanceStatus,
assignmentSubmissionStatus,
sessionStatus,
curriculumStatus,
submissionLink,
},
index
Expand Down Expand Up @@ -65,7 +65,7 @@ const StudyCurriculum = async () => {
{week}주차
</Text>
</div>
{sessionStatus === "CANCELLED" ? (
{curriculumStatus === "CANCELLED" ? (
<Text as="h3" color="sub" typo="h3">
휴강 주차
</Text>
Expand Down
48 changes: 33 additions & 15 deletions apps/client/app/(afterLogin)/study-apply/_components/StudyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Link from "next/link";
import type { ComponentProps } from "react";
import type { StudyList } from "types/dtos/applyStudy";
import type { StudyType } from "types/entities/common/study";
import type { Time } from "types/entities/common/time";
import Button from "wowds-ui/Button";
import Tag from "wowds-ui/Tag";
interface StudyItemProps {
Expand All @@ -24,40 +25,51 @@ const StudyItem = ({ study, appliedStudyId }: StudyItemProps) => {
mentorName,
studyType,
dayOfWeek,
startTime: { hour: startTimeHour, minute: startTimeMinute },
endTime: { hour: endTimeHour, minute: endTimeMinute },
startTime,
endTime,
openingDate: openingDateString,
applicationEndDate: endDateString,
totalWeek,
} = study;

const openingDate = parseISODate(openingDateString);
const endDate = parseISODate(endDateString);
const studyTime = `${dayToKorean[dayOfWeek.toUpperCase()]} ${startTimeHour}:${padWithZero(startTimeMinute)} - ${
endTimeHour
}:${padWithZero(endTimeMinute)}`;

const formatTime = (startTime: Time, endTime: Time) => {
const { hour: startTimeHour, minute: startTimeMinute } = startTime;
const { hour: endTimeHour, minute: endTimeMinute } = endTime;

return `${dayToKorean[dayOfWeek.toUpperCase()]} ${startTimeHour}:${padWithZero(startTimeMinute)} - ${
endTimeHour
}:${padWithZero(endTimeMinute)}`;
};
const studyTime = startTime && endTime ? formatTime(startTime, endTime) : "-";

const isApplicable = appliedStudyId === null;
const isCancelable = appliedStudyId === studyId;
const isNotApplicable = !isApplicable && !isCancelable;
return (
<Table>
<Flex direction="column" gap="xxs" justifyContent="center">
<Flex direction="column" gap="xxs" justifyContent="center" width={334}>
<Flex className={contentStyle} gap="xs">
<Text typo="h3">{title}</Text>
<Tag color={sessionColors[studyType] ?? "green"} variant="solid1">
{studyType}
</Tag>
</Flex>
<Text color="sub" typo="body2">
{`${introduction} -`}
<Link href={notionLink ?? ""} target="_blank">
{notionLink}
</Link>
</Text>
<Link href={notionLink ?? ""} target="_blank">
<Text className={introductionLinkTextStyle} color="sub" typo="body2">
{`(${introduction})`}
</Text>
</Link>
</Flex>
<Text className={textCellStyle}>{mentorName}</Text>
<Text className={textCellStyle}>{studyTime}</Text>
<Text
className={textCellStyle}
style={{ width: "11rem", textAlign: "center" }}
>
{studyTime}
</Text>
<Text className={textCellStyle}>{totalWeek}주 코스</Text>
<Flex direction="column" textAlign="center">
<Text className={textCellStyle}>
Expand Down Expand Up @@ -102,10 +114,16 @@ const contentStyle = css({
minWidth: "313px",
});

const introductionLinkTextStyle = css({
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
});

const sessionColors: Record<StudyType, ComponentProps<typeof Tag>["color"]> = {
"과제 스터디": "green",
"온라인 세션": "blue",
"오프라인 세션": "yellow",
"온라인 커리큘럼": "blue",
"오프라인 커리큘럼": "yellow",
};

export default StudyItem;
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ const AuthErrorAfterRecruitmentPage = () => {
모집 기간에 합류 후 이용해주세요.
</p>
<div className={buttonContainerStyle}>
<Button aria-label="홈으로 이동" asProp={Link} href={routePath.landing}>
<Button
aria-label="홈으로 이동"
asProp={Link}
href={routePath.landing}
style={buttonStyle}
>
홈으로 이동
</Button>
</div>
Expand Down Expand Up @@ -79,3 +84,7 @@ const buttonContainerStyle = css({
gap: "12px",
width: "100%",
});

const buttonStyle = {
maxWidth: "328px",
};
Loading

0 comments on commit 15b40bf

Please sign in to comment.