From 03e1569f8cfa6280e4d9f70bf2e27f92ac4f2200 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:04:10 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=ED=88=AC=ED=91=9C=20=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=88=84=EC=A0=81=20=EB=AC=B8=EC=A0=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/memory/RecordItem/PollRecord.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/memory/RecordItem/PollRecord.tsx b/src/components/memory/RecordItem/PollRecord.tsx index a21bc333..757c1d99 100644 --- a/src/components/memory/RecordItem/PollRecord.tsx +++ b/src/components/memory/RecordItem/PollRecord.tsx @@ -166,7 +166,7 @@ const PollRecord = ({ content, pollOptions, postId, shouldBlur = false, onVoteUp - {option.id} + {index + 1} {option.text} From 7d8cf563b7eeca2bf0d80d696571d83c3e140ba8 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:08:52 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=EA=B8=B0=EB=A1=9D=EC=9E=A5=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EC=82=AC=EC=A7=84=20=EB=B6=88?= =?UTF-8?q?=EB=9F=AC=EC=98=A4=EA=B8=B0=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/memory/RecordItem/RecordItem.styled.ts | 5 ++++- src/components/memory/RecordItem/RecordItem.tsx | 3 ++- src/pages/memory/Memory.tsx | 1 + src/types/memory.ts | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/memory/RecordItem/RecordItem.styled.ts b/src/components/memory/RecordItem/RecordItem.styled.ts index ac8de1da..dd293a2e 100644 --- a/src/components/memory/RecordItem/RecordItem.styled.ts +++ b/src/components/memory/RecordItem/RecordItem.styled.ts @@ -14,11 +14,14 @@ export const UserSection = styled.div` margin-bottom: 8px; `; -export const UserAvatar = styled.div` +export const UserAvatar = styled.div<{ src?: string }>` width: 36px; height: 36px; border-radius: 50%; background-color: ${colors.grey[400]}; + background-image: ${({ src }) => src ? `url(${src})` : 'none'}; + background-size: cover; + background-position: center; margin-right: 8px; `; diff --git a/src/components/memory/RecordItem/RecordItem.tsx b/src/components/memory/RecordItem/RecordItem.tsx index 71368449..7ebb67a6 100644 --- a/src/components/memory/RecordItem/RecordItem.tsx +++ b/src/components/memory/RecordItem/RecordItem.tsx @@ -39,6 +39,7 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { const { id, user, + profileImageUrl, content, likeCount, commentCount, @@ -356,7 +357,7 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { }} > - + {user} {renderPageInfo()} diff --git a/src/pages/memory/Memory.tsx b/src/pages/memory/Memory.tsx index 965d15f7..c11815f6 100644 --- a/src/pages/memory/Memory.tsx +++ b/src/pages/memory/Memory.tsx @@ -19,6 +19,7 @@ const convertPostToRecord = (post: Post): Record => { id: post.postId.toString(), user: post.nickName, userPoints: 132, + profileImageUrl: post.profileImageUrl, // 프로필 이미지 URL 추가 content: post.content, likeCount: post.likeCount, commentCount: post.commentCount, diff --git a/src/types/memory.ts b/src/types/memory.ts index d2797bc3..f8041c31 100644 --- a/src/types/memory.ts +++ b/src/types/memory.ts @@ -62,6 +62,7 @@ export interface Record { id: string; user: string; userPoints: number; + profileImageUrl: string; // 프로필 이미지 URL 추가 content: string; likeCount: number; commentCount: number; From ab9e950a51e01ba9cdceead92ff916abd9f008f5 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:14:09 +0900 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=ED=88=AC=ED=91=9C=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=20=EC=83=81=ED=83=9C=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../memory/RecordItem/PollRecord.tsx | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/memory/RecordItem/PollRecord.tsx b/src/components/memory/RecordItem/PollRecord.tsx index 757c1d99..d714ce09 100644 --- a/src/components/memory/RecordItem/PollRecord.tsx +++ b/src/components/memory/RecordItem/PollRecord.tsx @@ -141,6 +141,9 @@ const PollRecord = ({ content, pollOptions, postId, shouldBlur = false, onVoteUp } }; + // 아무도 투표하지 않았는지 확인 (모든 옵션이 0%인지 확인) + const hasVotes = currentOptions.some(option => option.percentage > 0); + return ( {content} @@ -148,7 +151,7 @@ const PollRecord = ({ content, pollOptions, postId, shouldBlur = false, onVoteUp {currentOptions.map((option, index) => ( handleOptionClick(option)} style={{ cursor: shouldBlur ? 'default' : (isVoting ? 'not-allowed' : 'pointer'), @@ -158,22 +161,24 @@ const PollRecord = ({ content, pollOptions, postId, shouldBlur = false, onVoteUp > - + {index + 1} - + {option.text} - - {option.percentage}% - + {hasVotes && ( + + {option.percentage}% + + )} ))} From b3a884196932559f9ceb32789c8e154db4b9aa76 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:20:06 +0900 Subject: [PATCH 04/11] =?UTF-8?q?fix:=20pageinput=20=EC=82=AC=EC=9D=B4=20?= =?UTF-8?q?=EA=B0=84=EA=B2=A9=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/recordwrite/PageRangeSection.styled.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/recordwrite/PageRangeSection.styled.ts b/src/components/recordwrite/PageRangeSection.styled.ts index 564078e0..87d06c11 100644 --- a/src/components/recordwrite/PageRangeSection.styled.ts +++ b/src/components/recordwrite/PageRangeSection.styled.ts @@ -39,6 +39,7 @@ export const InputWrapper = styled.div` font-size: ${typography.fontSize.sm}; font-weight: ${typography.fontWeight.regular}; font-family: ${typography.fontFamily.primary}; + width: fit-content; `; export const PageInput = styled.input<{ inputLength?: number }>` @@ -49,11 +50,12 @@ export const PageInput = styled.input<{ inputLength?: number }>` font-size: ${typography.fontSize.sm}; font-weight: ${typography.fontWeight.regular}; font-family: ${typography.fontFamily.primary}; - width: ${props => (props.inputLength ? `${Math.max(30, props.inputLength * 8 + 10)}px` : '30px')}; + width: ${props => (props.inputLength ? `${Math.max(27, props.inputLength * 8)}px` : '27px')}; padding: 0; margin: 0; caret-color: ${colors.white}; transition: width 0.2s ease; + flex-shrink: 0; &::placeholder { color: ${semanticColors.text.ghost}; @@ -77,6 +79,10 @@ export const PageSuffix = styled.span` font-family: ${typography.fontFamily.primary}; margin: 0; padding: 0; + white-space: nowrap; + display: inline-block; + flex-shrink: 0; + margin-left: 0px; `; export const OverallRangeText = styled.div` From 658d83aad9ceb51b1b474380ec132e8df002ab67 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:34:55 +0900 Subject: [PATCH 05/11] =?UTF-8?q?fix:=20=ED=81=B4=EB=A6=AD=EB=A7=8C?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=8D=94=EB=B3=B4=EA=B8=B0=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=20=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookSearchStates.tsx | 2 +- .../memory/RecordItem/RecordItem.tsx | 107 +++++------------- 2 files changed, 27 insertions(+), 82 deletions(-) diff --git a/src/components/common/BookSearchBottomSheet/BookSearchStates.tsx b/src/components/common/BookSearchBottomSheet/BookSearchStates.tsx index f67b2729..20c7c68a 100644 --- a/src/components/common/BookSearchBottomSheet/BookSearchStates.tsx +++ b/src/components/common/BookSearchBottomSheet/BookSearchStates.tsx @@ -44,7 +44,7 @@ const BookSearchStates = ({ isLoading, error, isEmpty, onClose }: BookSearchStat if (isEmpty) { return ( - 현재 등록된 책이 아닙니다. + 현재 등록된 책이 없습니다. 원하시는 책을 신청해주세요. 책 신청하기 diff --git a/src/components/memory/RecordItem/RecordItem.tsx b/src/components/memory/RecordItem/RecordItem.tsx index 7ebb67a6..b41ff663 100644 --- a/src/components/memory/RecordItem/RecordItem.tsx +++ b/src/components/memory/RecordItem/RecordItem.tsx @@ -1,4 +1,4 @@ -import { useState, useRef, useCallback } from 'react'; +import { useState, useCallback } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import type { Record } from '../../../types/memory'; import TextRecord from './TextRecord'; @@ -58,11 +58,6 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { // 전역 댓글 바텀시트 const { openCommentBottomSheet } = useCommentBottomSheetStore(); - // 길게 누르기 상태 관리 - const [isPressed, setIsPressed] = useState(false); - const longPressTimer = useRef(null); - const pressStartPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 }); - const hasTriggeredLongPress = useRef(false); // API에서 받은 isWriter 속성으로 내 기록인지 판단 const isMyRecord = isWriter ?? false; @@ -270,90 +265,40 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { openCommentBottomSheet(parseInt(id), type === 'poll' ? 'VOTE' : 'RECORD'); }, [openCommentBottomSheet, id, type]); - // 길게 누르기 이벤트 핸들러 - const handleTouchStart = useCallback( - (e: React.TouchEvent) => { - setIsPressed(true); - hasTriggeredLongPress.current = false; - pressStartPos.current = { - x: e.touches[0].clientX, - y: e.touches[0].clientY, - }; - - longPressTimer.current = setTimeout(() => { - hasTriggeredLongPress.current = true; - setIsPressed(false); - - if (isMyRecord) { - openMoreMenu({ - onEdit: handleEdit, - onDelete: handleDeleteConfirm, - onPin: handlePinConfirm, - onClose: closePopup, - type: 'post', - isWriter: true, - }); - } else { - openMoreMenu({ - onReport: handleReport, - onClose: closePopup, - }); - } - }, 800); - }, - [ - isMyRecord, - openMoreMenu, - handleReport, - handleEdit, - handleDeleteConfirm, - handlePinConfirm, - closePopup, - ], - ); - - const handleTouchMove = useCallback((e: React.TouchEvent) => { - if (!longPressTimer.current) return; - - const currentX = e.touches[0].clientX; - const currentY = e.touches[0].clientY; - const deltaX = Math.abs(currentX - pressStartPos.current.x); - const deltaY = Math.abs(currentY - pressStartPos.current.y); - - if (deltaX > 10 || deltaY > 10) { - clearTimeout(longPressTimer.current); - longPressTimer.current = null; - setIsPressed(false); - } - }, []); - - const handleTouchEnd = useCallback(() => { - if (longPressTimer.current) { - clearTimeout(longPressTimer.current); - longPressTimer.current = null; - } - setIsPressed(false); - }, []); const handleClick = useCallback(() => { - if (hasTriggeredLongPress.current) { - hasTriggeredLongPress.current = false; - return; + // 클릭으로 더보기 메뉴 표시 + if (isMyRecord) { + openMoreMenu({ + onEdit: handleEdit, + onDelete: handleDeleteConfirm, + onPin: handlePinConfirm, + onClose: closePopup, + type: 'post', + isWriter: true, + }); + } else { + openMoreMenu({ + onReport: handleReport, + onClose: closePopup, + }); } - // 모든 기록(내 기록 포함)은 이제 길게 누르기로만 더보기 메뉴 표시 - }, []); + }, [ + isMyRecord, + openMoreMenu, + handleReport, + handleEdit, + handleDeleteConfirm, + handlePinConfirm, + closePopup, + ]); return ( From 02b8bda5a2ca0914aa9fc2084cb618d52129f32f Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:40:26 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20padding:0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/createpost/PostContentSection.styled.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/createpost/PostContentSection.styled.ts b/src/components/createpost/PostContentSection.styled.ts index 4522c73f..a1ac59cf 100644 --- a/src/components/createpost/PostContentSection.styled.ts +++ b/src/components/createpost/PostContentSection.styled.ts @@ -10,7 +10,7 @@ export const TextAreaBox = styled.div` export const TextArea = styled.textarea<{ readOnly?: boolean }>` width: 100%; min-height: 100px; - background-color: ${props => props.readOnly ? '#f5f5f5' : semanticColors.background.primary}; + background-color: ${props => (props.readOnly ? '#f5f5f5' : semanticColors.background.primary)}; color: ${semanticColors.text.secondary}; font-size: ${typography.fontSize.sm}; font-weight: ${typography.fontWeight.regular}; @@ -19,7 +19,8 @@ export const TextArea = styled.textarea<{ readOnly?: boolean }>` outline: none; border: none; overflow: hidden; - cursor: ${props => props.readOnly ? 'not-allowed' : 'text'}; + cursor: ${props => (props.readOnly ? 'not-allowed' : 'text')}; + padding: 0; &::placeholder { color: ${semanticColors.text.ghost}; From cb7dc8f000ad76983bcc8c555e772e0ee95e292e Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:44:02 +0900 Subject: [PATCH 07/11] =?UTF-8?q?fix:=20=EC=98=A4=EB=8A=98=EC=9D=98=20?= =?UTF-8?q?=ED=95=9C=EB=A7=88=EB=94=94=20=EC=82=AD=EC=A0=9C=20=EC=8B=9C=20?= =?UTF-8?q?alert=20=EB=8C=80=EC=8B=A0=20=ED=86=A0=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/today-words/MessageList/MessageList.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/today-words/MessageList/MessageList.tsx b/src/components/today-words/MessageList/MessageList.tsx index 10a8b703..3f505958 100644 --- a/src/components/today-words/MessageList/MessageList.tsx +++ b/src/components/today-words/MessageList/MessageList.tsx @@ -2,6 +2,7 @@ import { useState, forwardRef, useImperativeHandle, useEffect } from 'react'; import moreIcon from '../../../assets/common/more.svg'; import type { Message } from '../../../types/today'; import MessageActionBottomSheet from './MessageActionBottomSheet'; +import { usePopupActions } from '../../../hooks/usePopupActions'; import { MessageList as StyledMessageList, DateGroup, @@ -39,6 +40,7 @@ const MessageList = forwardRef( ) => { const [selectedMessageId, setSelectedMessageId] = useState(null); const [messages, setMessages] = useState(initialMessages); + const { openSnackbar } = usePopupActions(); useEffect(() => { setMessages(initialMessages); @@ -102,7 +104,12 @@ const MessageList = forwardRef( if (selectedMessageId) { // TODO: 실제 삭제 API 연동 필요 console.log(`메시지 ID ${selectedMessageId} 삭제 요청 (API 개발 대기중)`); - alert('삭제 기능은 현재 개발 중입니다.'); + openSnackbar({ + message: '삭제 기능은 현재 개발 중입니다.', + variant: 'top', + isError: true, + onClose: () => {}, + }); } setSelectedMessageId(null); }; From 9460f493905e9397ee27599ea150796b21655945 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Wed, 20 Aug 2025 23:58:32 +0900 Subject: [PATCH 08/11] =?UTF-8?q?style:=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/group/GroupCard.tsx | 1 + src/pages/groupDetail/ParticipatedGroupDetail.styled.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/group/GroupCard.tsx b/src/components/group/GroupCard.tsx index c77af0cc..4490ae1d 100644 --- a/src/components/group/GroupCard.tsx +++ b/src/components/group/GroupCard.tsx @@ -77,6 +77,7 @@ const CoverWrapper = styled.div` const Cover = styled.img<{ cardType: 'main' | 'search' | 'modal'; isRecommend?: boolean }>` object-fit: cover; + object-position: top; flex-shrink: 0; width: ${({ cardType, isRecommend }) => (cardType === 'search' || isRecommend ? '60px' : '80px')}; height: ${({ cardType, isRecommend }) => diff --git a/src/pages/groupDetail/ParticipatedGroupDetail.styled.ts b/src/pages/groupDetail/ParticipatedGroupDetail.styled.ts index 4618571c..99d47924 100644 --- a/src/pages/groupDetail/ParticipatedGroupDetail.styled.ts +++ b/src/pages/groupDetail/ParticipatedGroupDetail.styled.ts @@ -6,7 +6,7 @@ export const ParticipatedWrapper = styled.div` position: relative; flex-direction: column; align-items: center; - justify-content: center; + justify-content: flex-start; min-width: 320px; max-width: 767px; min-height: 100vh; From 0f16f753ac9858bd41703e5e3a8caee37297c0b5 Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Thu, 21 Aug 2025 00:04:45 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20=EA=B8=B4=20=EB=8F=84=EC=84=9C?= =?UTF-8?q?=EB=AA=85=20=EA=B0=80=EB=A1=9C=20=EC=98=81=EC=97=AD=20=EA=B8=B8?= =?UTF-8?q?=EC=9D=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/group/GroupBookSection.styled.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/group/GroupBookSection.styled.ts b/src/components/group/GroupBookSection.styled.ts index 0012b6e5..09cd9b32 100644 --- a/src/components/group/GroupBookSection.styled.ts +++ b/src/components/group/GroupBookSection.styled.ts @@ -19,12 +19,20 @@ export const BookTitle = styled.h3` font-weight: ${typography.fontWeight.semibold}; margin: 0; margin-right: 12px; + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; `; export const BookAuthor = styled.span` color: ${semanticColors.text.secondary}; font-size: ${typography.fontSize.xs}; font-weight: ${typography.fontWeight.regular}; + max-width: 120px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; `; export const ChevronIcon = styled.img` @@ -37,4 +45,6 @@ export const RightSection = styled.div` display: flex; align-items: center; margin-right: -8px; + flex-shrink: 0; + gap: 8px; `; From 311eae745956b5d6362fa1c47c94241781e50cfa Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Thu, 21 Aug 2025 00:12:41 +0900 Subject: [PATCH 10/11] =?UTF-8?q?fix:=20=EB=AA=A8=EC=9E=84=EB=B0=A9=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EB=AA=A8=EC=9E=84=20=ED=99=9C?= =?UTF-8?q?=EB=8F=99=EA=B8=B0=EA=B0=84=20=EC=A1=B0=EA=B1=B4=20=EB=AF=B8?= =?UTF-8?q?=EC=B6=A9=EC=A1=B1=20=EC=8B=9C=20=EC=99=84=EB=A3=8C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityPeriodSection.tsx | 12 ++++++ src/pages/group/CreateGroup.tsx | 40 ++----------------- 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx b/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx index 8d1d3895..9b24e91d 100644 --- a/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx +++ b/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx @@ -16,6 +16,7 @@ interface ActivityPeriodSectionProps { endDate: { year: number; month: number; day: number }; onStartDateChange: (date: { year: number; month: number; day: number }) => void; onEndDateChange: (date: { year: number; month: number; day: number }) => void; + onValidationChange?: (isValid: boolean) => void; } const ActivityPeriodSection = ({ @@ -23,6 +24,7 @@ const ActivityPeriodSection = ({ endDate, onStartDateChange, onEndDateChange, + onValidationChange, }: ActivityPeriodSectionProps) => { // 현재 년도와 다음 년도 const currentYear = new Date().getFullYear(); @@ -63,6 +65,16 @@ const ActivityPeriodSection = ({ return endDateObj < startDateObj; }, [startDate, endDate]); + // 날짜 유효성 검사 결과 + const isDateValid = !isOverMaxDays && !isEndDateBeforeStart; + + // 유효성 변경 시 부모에게 알림 + useEffect(() => { + if (onValidationChange) { + onValidationChange(isDateValid); + } + }, [isDateValid, onValidationChange]); + // 오늘 날짜로 초기값 설정 const getInitialDate = () => { const today = new Date(); diff --git a/src/pages/group/CreateGroup.tsx b/src/pages/group/CreateGroup.tsx index 27be1d57..9a4722ee 100644 --- a/src/pages/group/CreateGroup.tsx +++ b/src/pages/group/CreateGroup.tsx @@ -74,6 +74,7 @@ const CreateGroup = () => { const [password, setPassword] = useState(''); const [isBookSearchOpen, setIsBookSearchOpen] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); + const [isDateValid, setIsDateValid] = useState(true); const handleBackClick = () => { navigate(-1); @@ -105,43 +106,6 @@ const CreateGroup = () => { isPublic: !isPrivate, // isPrivate의 반대값 }; - // 날짜 검증 추가 - const today = new Date(); - const startDateObj = new Date(startDate.year, startDate.month - 1, startDate.day); - const endDateObj = new Date(endDate.year, endDate.month - 1, endDate.day); - - // 시작 날짜가 오늘 이후인지 확인 - if (startDateObj <= today) { - alert('시작 날짜는 오늘 날짜 이후여야 합니다.'); - return; - } - - // 종료 날짜가 시작 날짜 이후인지 확인 - if (endDateObj <= startDateObj) { - alert('종료 날짜는 시작 날짜 이후여야 합니다.'); - return; - } - - // 요청 데이터 검증 - const validation = { - isbn: roomData.isbn.length > 0, - category: roomData.category.length > 0, - roomName: roomData.roomName.length > 0, - description: roomData.description.length > 0, - startDate: roomData.progressStartDate.length >= 8, - endDate: roomData.progressEndDate.length >= 8, - recruitCount: roomData.recruitCount >= 1 && roomData.recruitCount <= 30, - password: !isPrivate || (roomData.password !== null && /^\d{4}$/.test(roomData.password)), - }; - - const invalidFields = Object.entries(validation) - .filter(([, isValid]) => !isValid) - .map(([field]) => field); - - if (invalidFields.length > 0) { - alert(`다음 필드들을 확인해주세요: ${invalidFields.join(', ')}`); - return; - } // 방 생성 API 호출 const response = await createRoom(roomData); @@ -230,6 +194,7 @@ const CreateGroup = () => { selectedGenre !== '' && roomTitle.trim() !== '' && roomDescription.trim() !== '' && + isDateValid && // 날짜 유효성 검사 추가 (!isPrivate || (password.trim() !== '' && /^\d{4}$/.test(password.trim()))) && // 비공개방인 경우 4자리 숫자 필수 !isSubmitting; @@ -264,6 +229,7 @@ const CreateGroup = () => { endDate={endDate} onStartDateChange={setStartDate} onEndDateChange={setEndDate} + onValidationChange={setIsDateValid} /> From 275bf382b0d83e0c2a37fbd532bcd42a78b66f0f Mon Sep 17 00:00:00 2001 From: fr0gydev Date: Thu, 21 Aug 2025 00:16:25 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EB=B0=A9=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20=EB=B0=A9=20=EB=82=98=EA=B0=80=EA=B8=B0=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../groupDetail/ParticipatedGroupDetail.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pages/groupDetail/ParticipatedGroupDetail.tsx b/src/pages/groupDetail/ParticipatedGroupDetail.tsx index 30bad790..b4756947 100644 --- a/src/pages/groupDetail/ParticipatedGroupDetail.tsx +++ b/src/pages/groupDetail/ParticipatedGroupDetail.tsx @@ -44,7 +44,7 @@ import peopleIcon from '../../assets/common/darkPeople.svg'; import styled from '@emotion/styled'; const ParticipatedGroupDetail = () => { - const { openConfirm } = usePopupActions(); + const { openConfirm, openSnackbar } = usePopupActions(); const navigate = useNavigate(); const { roomId } = useParams<{ roomId: string }>(); @@ -103,7 +103,12 @@ const ParticipatedGroupDetail = () => { disc: '방을 삭제하게 되면\n독서메이트들과의 추억이 사라집니다.', onConfirm: () => { console.log('방 삭제 확정'); - navigate('/group'); + openSnackbar({ + message: '삭제 기능은 현재 개발 중입니다.', + variant: 'top', + isError: true, + onClose: () => {}, + }); }, }); }; @@ -114,7 +119,12 @@ const ParticipatedGroupDetail = () => { disc: '방을 나가시게 되면\n독서메이트들과의 추억이 사라집니다.', onConfirm: () => { console.log('방 나가기 확정'); - navigate('/group'); + openSnackbar({ + message: '나가기 기능은 현재 개발 중입니다.', + variant: 'top', + isError: true, + onClose: () => {}, + }); }, }); };