From 0680a3d58ae4e0c76758202aa87d122ba6b0e0d1 Mon Sep 17 00:00:00 2001 From: Doeun Kim Date: Fri, 30 Aug 2024 23:23:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(web-domains):=20=EC=A7=88=EB=AC=B8=20?= =?UTF-8?q?=EB=8B=B5=EB=B3=80=20=EC=99=84=EB=A3=8C,=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EB=8B=B5=EB=B3=80=20=EC=99=84=EB=A3=8C,=20?= =?UTF-8?q?=EC=A7=88=EB=AC=B8=EC=9D=B8=20=EC=84=A0=ED=83=9D=20post=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=EC=8B=9C=20=EB=B2=84=ED=8A=BC=20=EB=A1=9C?= =?UTF-8?q?=EB=94=A9=20=EC=B2=98=EB=A6=AC=20=20(#181)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 질문 선택 post 시 버튼 loading 처리 * fix: 질문 답변 완료 시 loading 처리 --- .../answer/features/comment/containers/CommentContainer.tsx | 5 +++-- .../answer/features/comment/services/useCommentService.tsx | 6 ++++-- .../features/floating-button/components/CommentButton.tsx | 5 +++-- .../components/Questioner/Questioner.tsx | 4 ++-- .../components/QuestionerDetail/QuestionerDetail.tsx | 6 +++++- .../containers/RandomPickContainer/RandomPickContainer.tsx | 3 ++- .../hooks/mutations/usePostRelayQuestionInfo.ts | 2 +- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/web-domains/src/answer/features/comment/containers/CommentContainer.tsx b/packages/web-domains/src/answer/features/comment/containers/CommentContainer.tsx index 80be4abc..9720e12c 100644 --- a/packages/web-domains/src/answer/features/comment/containers/CommentContainer.tsx +++ b/packages/web-domains/src/answer/features/comment/containers/CommentContainer.tsx @@ -5,7 +5,8 @@ import { Comment } from '../components/Comment'; import { useCommentService } from '../services/useCommentService'; export const CommentContainer = () => { - const { comment, handleChangeComment, handleSubmit } = useCommentService(); + const { comment, handleChangeComment, handleSubmit, isSendCommentPending, isAnswerQuestionPending } = + useCommentService(); return (
{ }} > - +
); }; diff --git a/packages/web-domains/src/answer/features/comment/services/useCommentService.tsx b/packages/web-domains/src/answer/features/comment/services/useCommentService.tsx index d00c6c07..2f9f24b3 100644 --- a/packages/web-domains/src/answer/features/comment/services/useCommentService.tsx +++ b/packages/web-domains/src/answer/features/comment/services/useCommentService.tsx @@ -20,8 +20,8 @@ export const useCommentService = () => { const [comment, setComment] = useState(''); const answerList = useAtomValue(answerAtoms.answerList); const { meetingId, questionId } = useParams<{ meetingId: string; questionId: string }>(); - const { mutateAsync: sendCommentMutate } = useCommentMutation({}); - const { mutateAsync: sendAnswerMutate } = useAnswerQuestionMutation({}); + const { mutateAsync: sendCommentMutate, isPending: isSendCommentPending } = useCommentMutation({}); + const { mutateAsync: sendAnswerMutate, isPending: isAnswerQuestionPending } = useAnswerQuestionMutation({}); const setIsProgressingQuestion = useSetAtom(HomeAtoms.isProgessingQuestionAtom); const setHomeGlobalTime = useSetAtom(HomeAtoms.homeGlobalTimeAtom); @@ -87,5 +87,7 @@ export const useCommentService = () => { comment, handleSubmit, handleChangeComment, + isAnswerQuestionPending, + isSendCommentPending, }; }; diff --git a/packages/web-domains/src/answer/features/floating-button/components/CommentButton.tsx b/packages/web-domains/src/answer/features/floating-button/components/CommentButton.tsx index 638cb287..7fb76aea 100644 --- a/packages/web-domains/src/answer/features/floating-button/components/CommentButton.tsx +++ b/packages/web-domains/src/answer/features/floating-button/components/CommentButton.tsx @@ -7,9 +7,10 @@ import { Attributes, HTMLAttributes } from 'react'; interface CommentButtonProps extends Omit, 'onClick'> { disabled?: boolean; onClick?: () => void; + loading?: boolean; } -export const CommentButton = ({ disabled, onClick, ...rest }: CommentButtonProps) => { +export const CommentButton = ({ disabled, onClick, loading = false, ...rest }: CommentButtonProps) => { const buttonStyles: Attributes['css'] = { backgroundColor: disabled ? colors.grey600 : colors.black, cursor: disabled ? 'none' : 'pointer', @@ -24,7 +25,7 @@ export const CommentButton = ({ disabled, onClick, ...rest }: CommentButtonProps return (
-
diff --git a/packages/web-domains/src/relay-question/features/select-relay-question/components/Questioner/Questioner.tsx b/packages/web-domains/src/relay-question/features/select-relay-question/components/Questioner/Questioner.tsx index 0b05bd18..66c81560 100644 --- a/packages/web-domains/src/relay-question/features/select-relay-question/components/Questioner/Questioner.tsx +++ b/packages/web-domains/src/relay-question/features/select-relay-question/components/Questioner/Questioner.tsx @@ -19,7 +19,7 @@ interface QuestionerProps { export const Questioner = ({ meetingId, meetingMemberId, imageUrl, name }: QuestionerProps) => { const openModal = useModal(); - const { postRelayQuestionInfo } = usePostRelayQuestionInfo(meetingId); + const { postRelayQuestionInfo, isPending } = usePostRelayQuestionInfo(meetingId); const router = useRouter(); const searchParams = useSearchParams(); @@ -27,7 +27,7 @@ export const Questioner = ({ meetingId, meetingMemberId, imageUrl, name }: Quest const handleOpenModal = async () => { const isConfirm = await openModal({ component: QuestionerDetail, - componentProps: { imageUrl, name, isRandom: false }, + componentProps: { imageUrl, name, isRandom: false, isPending }, }); if (isConfirm) { diff --git a/packages/web-domains/src/relay-question/features/select-relay-question/components/QuestionerDetail/QuestionerDetail.tsx b/packages/web-domains/src/relay-question/features/select-relay-question/components/QuestionerDetail/QuestionerDetail.tsx index f381b9d3..2786cd9f 100644 --- a/packages/web-domains/src/relay-question/features/select-relay-question/components/QuestionerDetail/QuestionerDetail.tsx +++ b/packages/web-domains/src/relay-question/features/select-relay-question/components/QuestionerDetail/QuestionerDetail.tsx @@ -16,6 +16,7 @@ interface QuestionerDetailProps { onClose: () => void; onConfirm: () => void; onRefetch?: () => void; + isPending?: boolean; } export const QuestionerDetail = ({ @@ -25,6 +26,7 @@ export const QuestionerDetail = ({ onClose, onConfirm, onRefetch, + isPending = false, }: QuestionerDetailProps) => { return (
@@ -38,7 +40,9 @@ export const QuestionerDetail = ({ - +
{isRandom && ( diff --git a/packages/web-domains/src/relay-question/features/select-relay-question/containers/RandomPickContainer/RandomPickContainer.tsx b/packages/web-domains/src/relay-question/features/select-relay-question/containers/RandomPickContainer/RandomPickContainer.tsx index 54c87ce6..d70c0737 100644 --- a/packages/web-domains/src/relay-question/features/select-relay-question/containers/RandomPickContainer/RandomPickContainer.tsx +++ b/packages/web-domains/src/relay-question/features/select-relay-question/containers/RandomPickContainer/RandomPickContainer.tsx @@ -97,7 +97,7 @@ const QuestionerRandomPick = ({ meetingId }: Props) => { excludeMemberIds: [memberMe?.meetingMemberId!], }); - const { postRelayQuestionInfo } = usePostRelayQuestionInfo(meetingId); + const { postRelayQuestionInfo, isPending } = usePostRelayQuestionInfo(meetingId); const handleOpenModal = () => { setIsOpen(true); @@ -142,6 +142,7 @@ const QuestionerRandomPick = ({ meetingId }: Props) => { onConfirm={handleConfirmModal} onRefetch={refetchQuestioner} isRandom + isPending={isPending} /> )} diff --git a/packages/web-domains/src/relay-question/features/select-relay-question/hooks/mutations/usePostRelayQuestionInfo.ts b/packages/web-domains/src/relay-question/features/select-relay-question/hooks/mutations/usePostRelayQuestionInfo.ts index 49b47de5..3c5bd9a8 100644 --- a/packages/web-domains/src/relay-question/features/select-relay-question/hooks/mutations/usePostRelayQuestionInfo.ts +++ b/packages/web-domains/src/relay-question/features/select-relay-question/hooks/mutations/usePostRelayQuestionInfo.ts @@ -20,7 +20,7 @@ export const usePostRelayQuestionInfo = (meetingId: number) => { const { mutate: postRelayQuestionInfo, ...rest } = useMutation({ mutationFn: (payload: Payload) => _postRelayQuestionInfo({ meetingId, payload }), onError: (error: AxiosError<{ message: string }>) => { - alert(error.response?.data.message ?? '댓글 수정에 실패했습니다.'); + alert(error.response?.data.message ?? '릴레이 질문 생성에 실패했습니다.'); }, }); From 69447113b8611e40adacbf883d85aea2553afa68 Mon Sep 17 00:00:00 2001 From: leejeongho <92032081+LeeJeongHooo@users.noreply.github.com> Date: Fri, 30 Aug 2024 23:54:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix(web-domains):=20=EC=9E=90=EA=B8=B0?= =?UTF-8?q?=EC=86=8C=EA=B0=9C,=20=EC=BD=94=EB=A9=98=ED=8A=B8=20validation?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#182)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: validation 수정 * fix: 수정 validation --- .../src/answer/features/comment/components/Comment.tsx | 4 ++-- .../src/answer/features/comment/components/CommentInput.tsx | 4 ++-- .../get-meeting-info/components/TextField/TextField.tsx | 1 + .../features/get-user-info/components/Form/ExtraInfoForm.tsx | 4 ++-- .../features/get-user-info/components/Form/IntroInfoForm.tsx | 5 ++++- .../features/get-user-info/components/TextInput/TextArea.tsx | 3 ++- .../get-user-info/components/TextInput/TextInput.tsx | 1 + .../features/modify-user-info/components/ModifyIntroForm.tsx | 5 ++++- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/web-domains/src/answer/features/comment/components/Comment.tsx b/packages/web-domains/src/answer/features/comment/components/Comment.tsx index 914cb2bb..55ecae18 100644 --- a/packages/web-domains/src/answer/features/comment/components/Comment.tsx +++ b/packages/web-domains/src/answer/features/comment/components/Comment.tsx @@ -32,8 +32,8 @@ export const Comment = ({ comment, onChangeComment }: CommentProps) => { diff --git a/packages/web-domains/src/answer/features/comment/components/CommentInput.tsx b/packages/web-domains/src/answer/features/comment/components/CommentInput.tsx index 794f21b6..d00f4322 100644 --- a/packages/web-domains/src/answer/features/comment/components/CommentInput.tsx +++ b/packages/web-domains/src/answer/features/comment/components/CommentInput.tsx @@ -17,8 +17,8 @@ export const CommentInput = forwardRef( const handleChange = (e: React.ChangeEvent) => { const { value } = e.target; - setInput(value); - onChange?.(value); + setInput(value.substring(0, maxLength)); + onChange?.(value.substring(0, maxLength)); }; const handleReset = () => { diff --git a/packages/web-domains/src/new-meeting/features/get-meeting-info/components/TextField/TextField.tsx b/packages/web-domains/src/new-meeting/features/get-meeting-info/components/TextField/TextField.tsx index 888af291..b9cc8c84 100644 --- a/packages/web-domains/src/new-meeting/features/get-meeting-info/components/TextField/TextField.tsx +++ b/packages/web-domains/src/new-meeting/features/get-meeting-info/components/TextField/TextField.tsx @@ -15,6 +15,7 @@ export const TextField = forwardRef) => { if (maxLength && event.target.value.length > maxLength) { event.target.value = event.target.value.slice(0, maxLength); + return; } onChange && onChange(event); }; diff --git a/packages/web-domains/src/user/features/get-user-info/components/Form/ExtraInfoForm.tsx b/packages/web-domains/src/user/features/get-user-info/components/Form/ExtraInfoForm.tsx index 0c86d610..8375da02 100644 --- a/packages/web-domains/src/user/features/get-user-info/components/Form/ExtraInfoForm.tsx +++ b/packages/web-domains/src/user/features/get-user-info/components/Form/ExtraInfoForm.tsx @@ -56,7 +56,7 @@ export const ExtraInfoForm = () => { required: true, minLength: 1, maxLength: 15, - pattern: /^\S.*\S$/, + validate: (value) => (value.trim().length >= 1 ? true : false), })} /> { required: true, minLength: 1, maxLength: 15, - pattern: /^\S.*\S$/, + validate: (value) => (value.trim().length >= 1 ? true : false), })} />
diff --git a/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx b/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx index 01f29bab..48a73e09 100644 --- a/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx +++ b/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx @@ -68,7 +68,10 @@ export const IntroInfoForm = () => {