Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 나의 스터디 페이지 QA 반영 #87

Merged
merged 14 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Expand Up @@ -17,7 +17,7 @@ const CreatedStudyCheckModal = () => {
const { parseToJsonSearchParam } = useParseSearchParams();
const data = parseToJsonSearchParam<CreateStudyApiRequestDto>("data");
const router = useRouter();
const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();

const studyName = data.title;
const semester = `${data.academicYear}-${data.semesterType === "FIRST" ? "1" : "2"}`;
Expand Down Expand Up @@ -49,7 +49,7 @@ const CreatedStudyCheckModal = () => {
<Text typo="h1">새로운 스터디를 개설하시겠어요?</Text>
<Space height={28} />
<Flex gap="sm" justify="center" width="21rem">
<Button variant="outline" onClick={closeModal}>
<Button variant="outline" onClick={onClose}>
취소
</Button>
<Button onClick={handleClickSubmitButton}>개설하기</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import useSubmitStudyDetailInfo from "./_hooks/useSubmitStudyDetailInfo";

const StudyDetailInfoCheckModal = () => {
const [studyName, setStudyName] = useState("");
const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();
const { parseToNumberSearchParams, parseQueryString } =
useParseSearchParams();
const searchParams = useSearchParams();
Expand All @@ -39,7 +39,7 @@ const StudyDetailInfoCheckModal = () => {
<Modal>
<SubmitSuccessMessage studyName={studyName} success={isSuccess} />
<SubmitConfirmMessage
closeModal={closeModal}
closeModal={onClose}
handleSubmitDetailInfo={handleSubmitDetailInfo}
studyName={studyName}
success={isSuccess}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Button from "wowds-ui/Button";

const LogoutModal = () => {
const router = useRouter();
const { closeModal } = useModalRoute();
const { onClose } = useModalRoute();
const handleClickLogoutButton = async () => {
const response = await authApi.logout();
if (response.success) {
Expand All @@ -33,7 +33,7 @@ const LogoutModal = () => {
size="lg"
style={buttonStyle}
variant="outline"
onClick={closeModal}
onClick={onClose}
>
취소
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Modal, Text } from "@wow-class/ui";
import { useModalRoute } from "@wow-class/ui/hooks";
import { myStudyApi } from "apis/myStudyApi";
import useFetchAttendanceCheckModalInfoData from "hooks/useFetchAttendanceCheckModalInfoData";
import Image from "next/image";
Expand All @@ -16,35 +17,52 @@ const AttendanceCheckModal = () => {
const [error, setError] = useState(false);
const [attendanceNumber, setAttendanceNumber] = useState("");

const { onClose } = useModalRoute();

const { studyInfo } = useFetchAttendanceCheckModalInfoData();

const handleChangeAttendanceNumber = (value: string) => {
setAttendanceNumber(value);
};

const handleClickAttendanceCheckButton = async () => {
const fetchOngoingStudyInfo = async () => {
const myOngoingStudyInfoData = await myStudyApi.getMyOngoingStudyInfo();
return myOngoingStudyInfoData?.studyId || null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just ask;
그냥 반환해도 undefined가 반환되어 동일하게 처리될 것 같은데 null로 가드해주신 이유가 궁금해요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 큰 이유는 없긴 한데 undefined보다는 null이 좀 더 studyId가 없다는 걸 명시적으로 표현할 수 있지 않나 싶어서 적긴 했습니다!

};

if (!myOngoingStudyInfoData?.studyId) {
return;
}

const isValidAttendanceNumber = validateAttendanceNumber(attendanceNumber);

if (!isValidAttendanceNumber) {
return setError(true);
}
const isAttendanceNumberValid = (attendanceNumber: string) => {
return validateAttendanceNumber(attendanceNumber);
};
Comment on lines +33 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just ask;
한번 더 함수로 감싸주신 이유가 궁금합니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handleClickAttendanceCheckButton 자체가 여러 역할들을 하다보니 함수가 한 가지 일을 할 수 있도록 여러 함수로 분리했어요!


const checkAttendance = async (studyId: number, attendanceNumber: string) => {
const { success } = await myStudyApi.checkAttendance(
myOngoingStudyInfoData?.studyId,
studyId,
attendanceNumber
);
return success;
};

const handleClickAttendanceCheckButton = async () => {
const studyId = await fetchOngoingStudyInfo();
if (!studyId) return;

if (!isAttendanceNumberValid(attendanceNumber)) {
return setError(true);
}

const success = await checkAttendance(studyId, attendanceNumber);
if (!success) {
return setError(true);
}

handleAttendanceSuccess();
};

const handleAttendanceSuccess = () => {
setAttended(true);
setTimeout(() => {
onClose();
}, 500);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { parseISODate } from "@wow-class/utils";
import LinkButton from "components/LinkButton";
import { routePath } from "constants/routePath";
import Link from "next/link";
import type { ComponentProps } from "react";
import type { AssignmentSubmissionStatusType } from "types/entities/myStudy";
import Box from "wowds-ui/Box";
import Button from "wowds-ui/Button";
import Tag from "wowds-ui/Tag";

interface AssignmentStatusBoxProps {
Expand Down Expand Up @@ -63,14 +64,15 @@ const AssignmentStatusBox = ({
</Text>
</Flex>
</Flex>
<LinkButton
<Button
asProp={Link}
disabled={assignmentSubmissionStatus !== "SUCCESS"}
href={routePath["my-assignment"]}
size="lg"
style={assignmentButtonStyle}
>
나의 과제 바로가기
</LinkButton>
</Button>
</Flex>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { padWithZero, parseISODate } from "@wow-class/utils";
import LinkButton from "components/LinkButton";
import { attendanceStatusMap } from "constants/attendanceStatusMap";
import { routePath } from "constants/routePath";
import Link from "next/link";
import type { AttendanceStatusType } from "types/entities/myStudy";
import Box from "wowds-ui/Box";
import Button from "wowds-ui/Button";
import Tag from "wowds-ui/Tag";

interface AttendanceStatusBoxProps {
Expand Down Expand Up @@ -59,13 +60,14 @@ const AttendanceStatusBox = ({
</Text>
</Flex>
</Flex>
<LinkButton
<Button
asProp={Link}
href={`${routePath["attendance-check"]}`}
size="lg"
style={attendanceButtonStyle}
>
출석 체크하기
</LinkButton>
</Button>
</Flex>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ const Header = () => {
</Text>
<Link
className={introduceLinkStyle}
href={notionLink}
href={notionLink || ""}
role="button"
tabIndex={0}
target="_blank"
>
<Image
alt="link-icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const StudyAnnouncementList = async () => {
className={studyAnnouncementListBoxStyle}
href={link}
key={studyAnnounceId}
target="_blank"
style={{
backgroundColor:
index === 0 ? `${color.monoBackgroundPressed}` : "white",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { Flex } from "@styled-system/jsx";
import { Table, Text } from "@wow-class/ui";
import { formatWeekPeriod } from "@wow-class/utils";
import { myStudyApi } from "apis/myStudyApi";
import LinkButton from "components/LinkButton";
import { attendanceStatusMap } from "constants/attendanceStatusMap";
import Link from "next/link";
import type { ComponentProps } from "react";
import type { StudyDifficultyType } from "types/entities/myStudy";
import { getIsCurrentWeek } from "utils/getIsCurrentWeek";
import Button from "wowds-ui/Button";
import Tag from "wowds-ui/Tag";

const StudyCurriculum = async () => {
Expand Down Expand Up @@ -101,20 +102,22 @@ const StudyCurriculum = async () => {
>
{attendanceStatusLabel}
</Tag>
<LinkButton
<Button
aria-label="check-submitted-assignment"
asProp={Link}
disabled={assignmentSubmissionStatus === "FAILURE"}
href={submissionLink || ""}
size="sm"
style={assignmentButtonStyle}
target="_blank"
variant={
assignmentSubmissionStatus === "SUCCESS"
? "outline"
: "solid"
}
>
{assignmentButtonText}
</LinkButton>
</Button>
</Table.Right>
</Table>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/client/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const metadata: Metadata = {
title: "GDSC Hongik 스터디 서비스, 와우클래스",
description:
"와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다. 이 서비스는 정규 스터디 과제 제출, 출석 체크 등 전반적인 스터디 활동을 효율적으로 관리할 수 있는 기능을 제공합니다.",
images: ["/images/og-image.svg"],
images: ["/images/og-image.png"],
siteName: "GDSC Hongik 스터디 서비스, 와우클래스",
type: "website",
},
Expand All @@ -26,7 +26,7 @@ export const metadata: Metadata = {
title: "GDSC Hongik 스터디 서비스, 와우클래스",
description:
"와우클래스는 GDSC Hongik이 제공하는 스터디 관리 플랫폼입니다. 이 서비스는 정규 스터디 과제 제출, 출석 체크 등 전반적인 스터디 활동을 효율적으로 관리할 수 있는 기능을 제공합니다.",
images: ["/images/og-image.svg"],
images: ["/images/og-image.png"],
},
robots: {
index: true,
Expand Down
21 changes: 0 additions & 21 deletions apps/client/components/LinkButton.tsx

This file was deleted.

Loading
Loading