From ae4f007c0c267b7127e874f24c0be963b8f478fc Mon Sep 17 00:00:00 2001 From: Jeong-Ag Date: Fri, 6 Sep 2024 22:31:25 +0900 Subject: [PATCH 01/10] =?UTF-8?q?fix(member):=20=EB=82=A8=EC=9D=80=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C=20=EA=B3=84=EC=82=B0=20=EC=8B=9C=20-1?= =?UTF-8?q?=EC=9D=BC=20=EB=90=98=EC=96=B4=20=EA=B3=84=EC=82=B0=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/member/src/components/common/Notice/Notice.tsx | 2 +- apps/member/src/utils/date.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/member/src/components/common/Notice/Notice.tsx b/apps/member/src/components/common/Notice/Notice.tsx index b186708c..917ff3c8 100644 --- a/apps/member/src/components/common/Notice/Notice.tsx +++ b/apps/member/src/components/common/Notice/Notice.tsx @@ -42,7 +42,7 @@ const Notice = ({ }, )} > - D-{dDay} + {dDay === 0 ? 'D-Day' : `D-${dDay}`} ); } diff --git a/apps/member/src/utils/date.ts b/apps/member/src/utils/date.ts index 9d8a1964..1aa71613 100644 --- a/apps/member/src/utils/date.ts +++ b/apps/member/src/utils/date.ts @@ -30,7 +30,9 @@ export function toYYMMDD(date: string) { * @return {number} 오늘부터 주어진 날짜까지의 일수 차이, 절대값으로 반환됩니다. */ export function calculateDDay(date: string): number { - return Math.abs(dayjs(date).diff(dayjs(), 'day')); + return Math.abs( + dayjs(date).startOf('day').diff(dayjs().startOf('day'), 'day'), + ); } /** * 주어진 날짜를 'YY.MM.DD(dd) HH:mm' 형식으로 포맷합니다. From 2ad18e21262dc83d6f8f3a0fd51c4b14f7f443a8 Mon Sep 17 00:00:00 2001 From: Jeong-Ag Date: Fri, 6 Sep 2024 22:40:53 +0900 Subject: [PATCH 02/10] =?UTF-8?q?refactor(member):=20=ED=99=9C=EB=8F=99=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EA=B3=B5=EB=B0=B1=EB=AC=B8=EC=9E=90=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=B0=8F=20=EC=8A=A4=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EB=B0=95=EC=8A=A4=20=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityDetailSection/ActivityDetailSection.tsx | 6 +++--- .../ActivityNoticeSection/ActivityNoticeSection.tsx | 12 +++++++----- .../src/components/group/GroupCard/GroupCard.tsx | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/member/src/components/group/ActivityDetailSection/ActivityDetailSection.tsx b/apps/member/src/components/group/ActivityDetailSection/ActivityDetailSection.tsx index 431e310a..3f270134 100644 --- a/apps/member/src/components/group/ActivityDetailSection/ActivityDetailSection.tsx +++ b/apps/member/src/components/group/ActivityDetailSection/ActivityDetailSection.tsx @@ -20,14 +20,14 @@ const ActivityDetailSection = ({ data }: ActivityDetailSectionProps) => {
{data.name} -
+

{data.name}

-

{data.content}

+

{data.content}

{data.category} diff --git a/apps/member/src/components/group/ActivityNoticeSection/ActivityNoticeSection.tsx b/apps/member/src/components/group/ActivityNoticeSection/ActivityNoticeSection.tsx index 3db00634..97087fe2 100644 --- a/apps/member/src/components/group/ActivityNoticeSection/ActivityNoticeSection.tsx +++ b/apps/member/src/components/group/ActivityNoticeSection/ActivityNoticeSection.tsx @@ -18,7 +18,7 @@ interface ActivityNoticeSectionProps { interface ActivityNoticeSectionItemProps { className?: string; - onClick: (content: string) => void; + onClick: (content: string, title?: string) => void; data: ActivityBoardType; } @@ -37,9 +37,9 @@ const ActivityNoticeSection = ({ data }: ActivityNoticeSectionProps) => { const latestNotice = sortedNotices[0]; const otherNotices = sortedNotices.slice(1); - const onClickAlert = (content: string) => { + const onClickAlert = (content: string, title?: string) => { openModal({ - title: '📣 공지사항', + title: `📣 ${title}`, content: content, }); }; @@ -94,11 +94,13 @@ ActivityNoticeSection.Item = ({ >
onClick(data.content)} + onClick={() => onClick(data.content, data.title)} >

{data.title}

- {formattedDate(toKoreaISOString(data.updatedAt))} + {formattedDate( + data.updatedAt ? toKoreaISOString(data.updatedAt) : String(dayjs()), + )}

diff --git a/apps/member/src/components/group/GroupCard/GroupCard.tsx b/apps/member/src/components/group/GroupCard/GroupCard.tsx index a280ffb8..b54eaf42 100644 --- a/apps/member/src/components/group/GroupCard/GroupCard.tsx +++ b/apps/member/src/components/group/GroupCard/GroupCard.tsx @@ -88,7 +88,7 @@ const GroupCard = ({

{name}

-

+

{content}

From d0fc817415794f041dfc54c341640a60b02dc53e Mon Sep 17 00:00:00 2001 From: Jeong-Ag Date: Fri, 6 Sep 2024 22:43:53 +0900 Subject: [PATCH 03/10] =?UTF-8?q?refactor(member):=20=ED=99=9C=EB=8F=99=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=EC=97=90=EC=84=9C=20category,=20leader=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=B6=94=EA=B0=80,=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?'=EB=AF=B8=EC=84=A0=ED=83=9D'=20=EB=82=98=ED=83=80=EB=82=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/GroupApplyPage/GroupApplyPage.tsx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/member/src/pages/GroupApplyPage/GroupApplyPage.tsx b/apps/member/src/pages/GroupApplyPage/GroupApplyPage.tsx index 80a2a62a..511f1e9d 100644 --- a/apps/member/src/pages/GroupApplyPage/GroupApplyPage.tsx +++ b/apps/member/src/pages/GroupApplyPage/GroupApplyPage.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { Button } from '@clab-platforms/design-system'; @@ -17,6 +17,7 @@ import { useActivityGroupMember, useActivityGroupMemberMutation, } from '@hooks/queries'; +import { toKoreaActivityGroupCategory } from '@utils/string'; const GroupApplyPage = () => { const navigate = useNavigate(); @@ -25,11 +26,10 @@ const GroupApplyPage = () => { useActivityGroupMemberMutation(); const toast = useToast(); - const [groupID, setGroupID] = useState(0); + const [groupID, setGroupID] = useState('none'); const [reason, setReason] = useState(''); - const options = groupData.items.map((item) => ({ - name: item.name, + name: `${toKoreaActivityGroupCategory(item.category)} / ${item.name} / ${item.leaders[0].name}`, value: item.id, })); @@ -42,7 +42,7 @@ const GroupApplyPage = () => { }; const handleApplyButtonClick = () => { - if (groupID === 0 || reason.length === 0) { + if (typeof groupID !== 'number' || reason.length === 0) { return toast({ state: 'error', message: '필수 입력 사항을 모두 입력해주세요.', @@ -51,7 +51,7 @@ const GroupApplyPage = () => { activityGroupMemberMutate( { - activityGroupId: groupID, + activityGroupId: +groupID, body: { applyReason: reason, }, @@ -60,18 +60,13 @@ const GroupApplyPage = () => { ); }; - useEffect(() => { - if (groupData.items.length && groupData.items[0].id) - setGroupID(groupData.items[0].id); - }, [groupData.items]); - return (
{ - +
+
); diff --git a/apps/member/src/components/group/ActivityBoardEditModal/ActivityBoardEditModal.tsx b/apps/member/src/components/group/ActivityBoardEditModal/ActivityBoardEditModal.tsx index 06fb28da..ce678cda 100644 --- a/apps/member/src/components/group/ActivityBoardEditModal/ActivityBoardEditModal.tsx +++ b/apps/member/src/components/group/ActivityBoardEditModal/ActivityBoardEditModal.tsx @@ -21,7 +21,7 @@ interface Props { groupId: number; } interface FileUploaderProps { - uploadedFile: ResponseFile | null; + uploadedFile: Array | null; uploaderRef: React.RefObject; handleDeleteFileClick: () => void; } @@ -32,8 +32,8 @@ const ActivityBoardEditModal = ({ prevData, groupId }: Props) => { const [board, setBoard] = useState(prevData); const uploaderRef = useRef(null); - const [uploadedFile, setUploadedFile] = useState( - prevData?.files?.[0] || null, + const [uploadedFile, setUploadedFile] = useState | null>( + prevData?.files || null, ); const { activityGroupBoardPatchMutate, activityGroupBoardPatchIsPending } = useActivityGroupBoardPatchMutation(); @@ -49,7 +49,7 @@ const ActivityBoardEditModal = ({ prevData, groupId }: Props) => { }; const handleEditButtonClick = () => { const formData = new FormData(); - const file = uploaderRef.current?.files?.[0]; + const files = uploaderRef.current?.files; if (!board.title || !board.content) { return toast({ @@ -57,8 +57,10 @@ const ActivityBoardEditModal = ({ prevData, groupId }: Props) => { message: '제목과 내용을 입력해주세요.', }); } - if (file) { - formData.append(FORM_DATA_KEY, file); + if (files?.length) { + Array.from(files).forEach((file) => { + formData.append(FORM_DATA_KEY, file); + }); } activityGroupBoardPatchMutate({ @@ -70,7 +72,7 @@ const ActivityBoardEditModal = ({ prevData, groupId }: Props) => { content: board.content, dueDateTime: board.dueDateTime, }, - files: file ? formData : undefined, + files: files?.length ? formData : undefined, }); closeModal(); }; @@ -134,22 +136,28 @@ const FileUploader = ({ }: FileUploaderProps) => { return ( <> - {uploadedFile && ( -
- - {uploadedFile.originalFileName} - + {uploadedFile?.length ? ( +
+ {uploadedFile?.map((file) => ( + + ))}
+ ) : ( + )} - ); }; diff --git a/apps/member/src/components/group/ActivityNoticeEditor/ActivityNoticeEditor.tsx b/apps/member/src/components/group/ActivityNoticeEditor/ActivityNoticeEditor.tsx index ad1c1816..c4556011 100644 --- a/apps/member/src/components/group/ActivityNoticeEditor/ActivityNoticeEditor.tsx +++ b/apps/member/src/components/group/ActivityNoticeEditor/ActivityNoticeEditor.tsx @@ -59,17 +59,7 @@ const ActivityNoticeEditor = ({ groupId, data }: ActivityNoticeEditorProps) => { return ( <>
- -
- -
-
+
{

미리보기 +
diff --git a/apps/member/src/components/group/ActivityPostEditor/ActivityPostEditor.tsx b/apps/member/src/components/group/ActivityPostEditor/ActivityPostEditor.tsx index b1522195..930ffdef 100644 --- a/apps/member/src/components/group/ActivityPostEditor/ActivityPostEditor.tsx +++ b/apps/member/src/components/group/ActivityPostEditor/ActivityPostEditor.tsx @@ -66,7 +66,7 @@ const ActivityPostEditor = ({ }; const handleAddWeeklyClick = () => { const formData = new FormData(); - const file = uploaderRef.current?.files?.[0]; + const files = uploaderRef.current?.files; if (!post.title || !post.content) { return toast({ @@ -74,8 +74,10 @@ const ActivityPostEditor = ({ message: '제목, 내용은 필수 입력 요소입니다.', }); } - if (file) { - formData.append(FORM_DATA_KEY, file); + if (files?.length) { + Array.from(files).forEach((file) => { + formData.append(FORM_DATA_KEY, file); + }); } const activityBoardItem: SubmitBoardType = { @@ -87,7 +89,7 @@ const ActivityPostEditor = ({ activityGroupId: groupId, memberId: myProfile.id, body: activityBoardItem, - files: file ? formData : undefined, + files: files?.length ? formData : undefined, }, { onSuccess: () => setPost(defaultPost) }, ); @@ -109,15 +111,7 @@ const ActivityPostEditor = ({ return ( <>
- - - +
첨부 파일 - +

미리보기 @@ -155,6 +149,13 @@ const ActivityPostEditor = ({ isParticipant />
+ {activities.map((weeklyData, index) => ( @@ -166,7 +167,7 @@ const ActivityPostEditor = ({ color="orange" onClick={() => handleAssignmentEditClick(index)} > - 과제 관리 + {editAssignment[index] ? '과제 닫기' : '과제 열기'} )} - + {(!isAlreadySubmitted || editMode) && ( + + )}
); diff --git a/apps/member/src/components/group/WeeklyActivityCard/WeeklyActivityCard.tsx b/apps/member/src/components/group/WeeklyActivityCard/WeeklyActivityCard.tsx index 10117763..178a82d6 100644 --- a/apps/member/src/components/group/WeeklyActivityCard/WeeklyActivityCard.tsx +++ b/apps/member/src/components/group/WeeklyActivityCard/WeeklyActivityCard.tsx @@ -3,9 +3,11 @@ import { useNavigate } from 'react-router-dom'; import { RegularFileAltOutline } from '@clab-platforms/icon'; import File from '@components/common/File/File'; +import Image from '@components/common/Image/Image'; import { PATH_FINDER } from '@constants/path'; import useToast from '@hooks/common/useToast'; +import { isImageFile } from '@utils/api'; import { ActivityBoardType } from '@type/activity'; import type { ResponseFile } from '@type/api'; @@ -44,7 +46,6 @@ const WeeklyActivityCard = ({ }); } }; - return (
@@ -54,13 +55,29 @@ const WeeklyActivityCard = ({
-
+

{content}

- {files?.map((file) => ( - -

{file.originalFileName}

-
- ))} +
+
+ {files?.map((file) => ( +
+ {isImageFile(file.fileUrl) ? ( + {file.originalFileName} + ) : ( + + )} +
+ ))} +
{assignments?.map(({ id: assignmentId, title: assignmentTitle }) => (
{ + const { openModal } = useModal(); const { id, assignmentId } = useParams(); const { state } = useLocation(); const { data: myProfile } = useMyProfile(); @@ -37,24 +45,51 @@ const GroupAssignmentPage = () => { ); const feedback = myAssignment?.[0]; + const handleEditNoticeClick = () => { + return openModal({ + title: '수정하기', + custom: , + }); + }; + return (
- + + {isLeader && ( + + )} + - {board?.files.length !== 0 && ( -
-

첨부파일 |

- {board.files.map((file) => ( - - {file.originalFileName} - - ))} + + 종료 일시 | {formattedDate(board?.dueDateTime)} + + {board?.files && ( +
+ {board.files.map((file) => + isImageFile(file.fileUrl) ? ( + {file.originalFileName} + ) : ( + + ), + )}
)}
-

{board?.content}

+

{board?.content}

{isLeader ? ( diff --git a/apps/member/src/utils/api.ts b/apps/member/src/utils/api.ts index 8330650b..39498ff2 100644 --- a/apps/member/src/utils/api.ts +++ b/apps/member/src/utils/api.ts @@ -86,3 +86,11 @@ export function authorization(token: string | null): Record { export function isBase64(url: string): boolean { return /;base64,/.test(url); } +/** + * 주어진 파일이 이미지인지 확인합니다. + * @param {string} fileUrl - 확인할 파일입니다. + * @returns {boolean} - 파일이 이미지라면 true, 아니면 false를 반환합니다. + */ +export const isImageFile = (fileUrl: string): boolean => { + return /\.(jpg|jpeg|png|gif)$/i.test(fileUrl); +}; From 36fc6d3bcd4520f33c00b95f4f95a40d28e7089e Mon Sep 17 00:00:00 2001 From: Jeong-Ag Date: Sun, 8 Sep 2024 01:49:47 +0900 Subject: [PATCH 08/10] =?UTF-8?q?style(member):=20=ED=99=9C=EB=8F=99=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EB=AA=A8=EB=8B=AC=20=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityInfoModal/ActivityInfoModal.tsx | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/member/src/components/modal/ActivityInfoModal/ActivityInfoModal.tsx b/apps/member/src/components/modal/ActivityInfoModal/ActivityInfoModal.tsx index 98b66bd0..70502f06 100644 --- a/apps/member/src/components/modal/ActivityInfoModal/ActivityInfoModal.tsx +++ b/apps/member/src/components/modal/ActivityInfoModal/ActivityInfoModal.tsx @@ -8,6 +8,19 @@ import { createImageUrl } from '@utils/api'; interface MemberInfoModalProps { id: number; } +interface LongTextItemProps { + label: string; + text?: string; +} + +const LongTextItem = ({ label, text }: LongTextItemProps) => { + return ( +
  • + {label} + {text || '-'} +
  • + ); +}; const ActivityInfoModal = ({ id }: MemberInfoModalProps) => { const { data, isLoading } = useActivityGroup(+id); @@ -18,17 +31,22 @@ const ActivityInfoModal = ({ id }: MemberInfoModalProps) => { data; return ( -
    +
    - {name} + {name}
    - + {category} {name} {subject} - {content} - {curriculum} - {techStack} + + + {techStack || '-'}
    ); From 5b797be5ec4efaff421d21a9a4f94dd7fb1b7a13 Mon Sep 17 00:00:00 2001 From: Jeong-Ag Date: Sun, 8 Sep 2024 02:13:37 +0900 Subject: [PATCH 09/10] fix(member): export MemberStatusType --- apps/member/src/types/activity.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/member/src/types/activity.ts b/apps/member/src/types/activity.ts index f5ad34c4..a4bd3da2 100644 --- a/apps/member/src/types/activity.ts +++ b/apps/member/src/types/activity.ts @@ -8,7 +8,7 @@ import { import type { ResponseFile } from './api'; -type MemberStatusType = +export type MemberStatusType = (typeof ACTIVITY_MEMBER_STATE)[keyof typeof ACTIVITY_MEMBER_STATE]; export type ActivityGroupBoardCategoryType = (typeof ACTIVITY_BOARD_CATEGORY_STATE)[keyof typeof ACTIVITY_BOARD_CATEGORY_STATE]; From 8d3640a5a7f7bbb4f7ff087a73e440c0b9f44fc8 Mon Sep 17 00:00:00 2001 From: GwanSik Kim Date: Sun, 8 Sep 2024 02:27:35 +0900 Subject: [PATCH 10/10] Create happy-clocks-shave.md --- .changeset/happy-clocks-shave.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/happy-clocks-shave.md diff --git a/.changeset/happy-clocks-shave.md b/.changeset/happy-clocks-shave.md new file mode 100644 index 00000000..59aef5e6 --- /dev/null +++ b/.changeset/happy-clocks-shave.md @@ -0,0 +1,5 @@ +--- +"@clab-platforms/member": patch +--- + +refactor(member): 활동 2차 QA 피드백 반영 수정