-
Notifications
You must be signed in to change notification settings - Fork 2
[FEAT] 투표 에러 처리 + 종료 시 모달창 #407
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
Changes from all commits
2c95c5b
1d6f11b
e32ed33
e751cd4
f9e8ce9
8ecb50b
5966f72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ import DefaultLayout from '../../layout/defaultLayout/DefaultLayout'; | |
| import { useGetPollInfo } from '../../hooks/query/useGetPollInfo'; | ||
| import ErrorIndicator from '../../components/ErrorIndicator/ErrorIndicator'; | ||
| import useFetchEndPoll from '../../hooks/mutations/useFetchEndPoll'; | ||
| import GoToDebateEndButton from '../../components/GoToDebateEndButton/GoToDebateEndButton'; | ||
| import { useModal } from '../../hooks/useModal'; | ||
| import DialogModal from '../../components/DialogModal/DialogModal'; | ||
| export default function DebateVotePage() { | ||
| const navigate = useNavigate(); | ||
| const baseUrl = | ||
|
|
@@ -37,7 +38,20 @@ export default function DebateVotePage() { | |
| refetch, | ||
| isRefetchError, | ||
| } = useGetPollInfo(pollId, { refetchInterval: 5000, enabled: isArgsValid }); | ||
| const { openModal, closeModal, ModalWrapper } = useModal(); | ||
| const { mutate } = useFetchEndPoll(handleGoToResult); | ||
| const handleConfirmEnd = () => { | ||
| if (!isArgsValid) return; | ||
| mutate(pollId, { | ||
| onSuccess: () => { | ||
| closeModal(); | ||
| }, | ||
| onError: () => { | ||
| closeModal(); | ||
| alert('투표 종료에 실패했습니다.'); | ||
| }, | ||
| }); | ||
| }; | ||
|
Comment on lines
43
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 비동기 뮤테이션 완료 전 모달 닫기 문제
const handleConfirmEnd = () => {
if (!isArgsValid) return;
- mutate(pollId);
- closeModal();
+ mutate(pollId, {
+ onSuccess: () => {
+ closeModal();
+ },
+ onError: () => {
+ closeModal();
+ // 에러 토스트 표시 등 사용자에게 피드백 제공
+ },
+ });
};🤖 Prompt for AI Agents
jaeml06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const participants = data?.voterNames; | ||
| const isLoading = isFetching || isRefetching; | ||
|
|
@@ -114,11 +128,10 @@ export default function DebateVotePage() { | |
| </main> | ||
|
|
||
| <DefaultLayout.StickyFooterWrapper> | ||
| <div className="flex w-full max-w-[800px] flex-row items-center justify-center gap-2"> | ||
| <GoToDebateEndButton tableId={tableId} className="flex-1" /> | ||
| <div className="flex w-full max-w-[400px] flex-row items-center justify-center gap-2"> | ||
| <button | ||
| type="button" | ||
| onClick={() => mutate(pollId)} | ||
| onClick={openModal} | ||
| className="button enabled brand flex flex-1 flex-row rounded-full p-[24px]" | ||
| > | ||
| 투표 결과 보기 | ||
|
|
@@ -127,6 +140,22 @@ export default function DebateVotePage() { | |
| </DefaultLayout.StickyFooterWrapper> | ||
| </div> | ||
| </DefaultLayout.ContentContainer> | ||
| <ModalWrapper> | ||
| <DialogModal | ||
| right={{ | ||
| text: '마감하기', | ||
| onClick: handleConfirmEnd, | ||
| isBold: true, | ||
| }} | ||
| > | ||
| <div className="px-16 py-24 text-center text-black"> | ||
| <p className="text-xl font-semibold">투표를 마감하시겠습니까?</p> | ||
| <p className="mt-2 text-sm text-default-neutral"> | ||
| 투표를 마감하면 더이상 표를 받을 수 없습니다! | ||
| </p> | ||
| </div> | ||
| </DialogModal> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 궁금한 것이 버튼은 prop으로 들어가는데 모달 내부의 텍스트는 children으로 자유도가 있는데 모달 내부를 구성하는 요소들이 구분되어 들어가는 이유가 있나용?? just 궁금. 당장 리팩토링하자는 소리 아닙니다요 ~!!!!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. '정말로 종료하시겠습니까?'가 현재 시안인데 '투표를 종료하시겠습니까?'가 무엇을 종료하는지 확실히 와닿을 것 같은데, 치코는 어떻게 생각하시나요? 공감하신다면 요 내용도 함께 이야기 해주시면 어떨까욥?!!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @useon 모달 버튼을 Prop으로 넣어주는 이유는 저거 구현할 당시 모달의 생김새를 딱 저렇게 정확히 구현하기로 합의를 봤었기 때문이에요! 어차피 버튼 형태는 고정되어 있을 테니 버튼들 디자인을 최대한 동일하게 유지하기 위해 컨트롤할 수 있는 범위를 최대한 줄이자는 접근이었던 것으로 기억합니다.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 회의에서 진행했던 문구로 수정 진행했습니다. |
||
| </ModalWrapper> | ||
|
Comment on lines
+143
to
+158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 확인 모달에 취소 버튼 추가 권장 현재 모달은 "마감하기" 버튼만 제공하고 명시적인 취소 버튼이 없습니다. 사용자는 X 버튼이나 오버레이 클릭으로만 취소할 수 있는데, 이는 일반적인 확인 모달 패턴과 다릅니다. 명확한 취소 옵션을 제공하는 것이 더 나은 사용자 경험을 제공합니다. 다음과 같이 left 버튼을 추가하는 것을 권장합니다: <ModalWrapper>
<DialogModal
+ left={{
+ text: '취소',
+ onClick: closeModal,
+ isBold: false,
+ }}
right={{
text: '마감하기',
onClick: handleConfirmEnd,
isBold: true,
}}
>🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요기 리뷰처럼 취소 버튼도 명시적으로 있는게 좋겠다는 생각이 드는데 어떻게 생각하시나욥 ?!!!?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @useon, 좋은 의견이라고 생각합니다! 👍 명시적인 취소 버튼을 추가하는 것이 더 나은 사용자 경험을 제공할 것 같습니다: 장점:
다행히 <DialogModal
left={{
text: '취소',
onClick: closeModal,
isBold: false,
}}
right={{
text: '마감하기',
onClick: handleConfirmEnd,
isBold: true,
}}
>이렇게 수정하시면 좋을 것 같습니다! 🐰 |
||
| </DefaultLayout> | ||
| ); | ||
| } | ||



There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
훨씬 정교해졌네요 !!!!!! 짱짱짱 !!!