diff --git a/packages/web-domains/src/home/features/floating-button/containers/FloatingButtonContainer.tsx b/packages/web-domains/src/home/features/floating-button/containers/FloatingButtonContainer.tsx index 5d9eb483..e864750b 100644 --- a/packages/web-domains/src/home/features/floating-button/containers/FloatingButtonContainer.tsx +++ b/packages/web-domains/src/home/features/floating-button/containers/FloatingButtonContainer.tsx @@ -6,7 +6,7 @@ import { StartRelayQuestionButton } from '../components/StartRelayQuestionButton import { useFloatingButtonService } from '../services/useFloatingButtonService'; export const FloatingButtonContainer = () => { - const { buttonType, homeGlobalTime, handleClose, isOpen, open, meetingId } = useFloatingButtonService(); + const { buttonType, homeGlobalTime, handleClose, isOpen, open, meetingId, isOnlyOne } = useFloatingButtonService(); return (
{ padding: '0 20px', }} > - {buttonType === 'start' && } + {buttonType === 'start' && !isOnlyOne && } {buttonType === 'countdown' && }
diff --git a/packages/web-domains/src/home/features/floating-button/services/useFloatingButtonService.ts b/packages/web-domains/src/home/features/floating-button/services/useFloatingButtonService.ts index c6391c32..9e3a5fb7 100644 --- a/packages/web-domains/src/home/features/floating-button/services/useFloatingButtonService.ts +++ b/packages/web-domains/src/home/features/floating-button/services/useFloatingButtonService.ts @@ -2,6 +2,7 @@ import { useAtomValue } from 'jotai'; import { useEffect, useState } from 'react'; import { useDialogContext } from '@/common/contexts/DialogProvider'; +import { useGetGatherMemberList } from '@/home/common/apis/queries/useGetGatherMemberList'; import { HomeAtoms } from '@/home/common/atoms/home.atom'; export const useFloatingButtonService = () => { @@ -15,6 +16,13 @@ export const useFloatingButtonService = () => { const isSelectedTarget = useAtomValue(HomeAtoms.isSelectedTargetAtom); const isNextTarget = useAtomValue(HomeAtoms.isNextTargetAtom); + const { data: memberList } = useGetGatherMemberList({ + params: { meetingId: currentMeeting?.meetingId! }, + options: { + enabled: !!currentMeeting?.meetingId, + }, + }); + useEffect(() => { const showButton = isProgessingQuestion; const startButtonActive = !showButton && isSelectedTarget; @@ -41,6 +49,8 @@ export const useFloatingButtonService = () => { close(); }; + const isOnlyOne = !!memberList && memberList.contents.length < 2; + return { meetingId: currentMeeting?.meetingId, isOpen, @@ -48,5 +58,6 @@ export const useFloatingButtonService = () => { homeGlobalTime: homeGlobalTime ?? 0, open, handleClose, + isOnlyOne, }; }; diff --git a/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx b/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx index aa2dbbb4..528dfa23 100644 --- a/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx +++ b/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx @@ -4,12 +4,20 @@ import { ArrivedQuestionNotification } from '../components/ArrivedQuestionNotifi import { SelectedTargetMemberNotification } from '../components/SelectedTargetMemberNotification'; import { useNotificationService } from '../services/useNotificationService'; export const NotificationContainer = () => { - const { meetingId, notfication, handleClose, isOpen, isNotAnswerd, isNotRegistered, handleClickActionLater } = - useNotificationService(); + const { + meetingId, + notfication, + handleClose, + isOpen, + isNotAnswerd, + isNotRegistered, + handleClickActionLater, + isOnlyOne, + } = useNotificationService(); return ( <> - {notfication?.eventType === 'QUESTION_REGISTERED' && isNotAnswerd && ( + {notfication?.eventType === 'QUESTION_REGISTERED' && isNotAnswerd && !isOnlyOne && ( { onClickAnswerLater={handleClickActionLater} /> )} - {notfication?.eventType === 'TARGET_MEMBER' && isNotRegistered && ( + {notfication?.eventType === 'TARGET_MEMBER' && isNotRegistered && !isOnlyOne && ( { meetingId, ]); + const { data: memberList } = useGetGatherMemberList({ + params: { meetingId: meetingId! }, + options: { + enabled: !!meetingId, + }, + }); + const { data: notfication } = useGetNotification({ params: { meetingId: meetingId! }, options: { @@ -57,13 +65,15 @@ export const useNotificationService = () => { } }, [notfication, currentMeeting]); + const isOnlyOne = !!memberList && memberList.contents.length < 2; + return { meetingId, notfication: notfication?.contents?.[0], isOpen, handleClose, handleClickActionLater, - + isOnlyOne, isNotAnswerd: !progressingQuestionData?.isAnswered, isNotRegistered: !progressingQuestionData?.isQuestionRegistered, }; diff --git a/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveQuestion.tsx b/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveQuestion.tsx index 166a2f89..b751fe6f 100644 --- a/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveQuestion.tsx +++ b/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveQuestion.tsx @@ -20,13 +20,35 @@ const CountdownRender = dynamic( interface InActiveQuestionProps { time: number; targetMember: MemberType; + isOnlyOne: boolean; } -export const InActiveQuestion = ({ time, targetMember }: InActiveQuestionProps) => { +export const InActiveQuestion = ({ time, targetMember, isOnlyOne }: InActiveQuestionProps) => { const { name } = targetMember; const timer = getRemainTime(time); + if (isOnlyOne) { + return ( +
+
+ + + 모임원이 입장해야 시작할 수 있어요! + +
+
+ ); + } + return (
diff --git a/packages/web-domains/src/home/features/progressing-question/containers/ProgressingQuestionContainer.tsx b/packages/web-domains/src/home/features/progressing-question/containers/ProgressingQuestionContainer.tsx index 999f9d15..86cb1e5c 100644 --- a/packages/web-domains/src/home/features/progressing-question/containers/ProgressingQuestionContainer.tsx +++ b/packages/web-domains/src/home/features/progressing-question/containers/ProgressingQuestionContainer.tsx @@ -20,6 +20,7 @@ export const ProgressingQuestionContainer = () => { gatherName, progressingQuestion, meetingId, + isOnlyOne, } = useProgressingQuestionService(); return ( @@ -46,6 +47,7 @@ export const ProgressingQuestionContainer = () => { ) } diff --git a/packages/web-domains/src/home/features/progressing-question/services/useProgressingQuestionService.tsx b/packages/web-domains/src/home/features/progressing-question/services/useProgressingQuestionService.tsx index 751e6eed..a4aaa446 100644 --- a/packages/web-domains/src/home/features/progressing-question/services/useProgressingQuestionService.tsx +++ b/packages/web-domains/src/home/features/progressing-question/services/useProgressingQuestionService.tsx @@ -2,6 +2,7 @@ import dayjs from 'dayjs'; import { useSetAtom } from 'jotai'; import { useEffect, useState } from 'react'; +import { useGetGatherMemberList } from '@/home/common/apis/queries/useGetGatherMemberList'; import { useGetMyInfo } from '@/home/common/apis/queries/useGetMyInfo'; import { HomeAtoms } from '@/home/common/atoms/home.atom'; import { useSetCurrentMeeting } from '@/home/common/hooks/useSetCurrentMeeting'; @@ -22,6 +23,13 @@ export const useProgressingQuestionService = () => { options: { enabled: !!meetingId }, }); + const { data: memberList } = useGetGatherMemberList({ + params: { meetingId: meetingId! }, + options: { + enabled: !!meetingId, + }, + }); + const { data: progressingQuestion } = useGetProgressingQuestion({ params: { meetingId: meetingId! }, options: { @@ -67,7 +75,10 @@ export const useProgressingQuestionService = () => { } }, [progressingQuestion, myInfo]); + const isOnlyOne = !!memberList && memberList.contents.length < 2; + return { + isOnlyOne, meetingInfo, isOpen, meetingId,