From a0e14530edb8593f4efa5a79c9173ee683ad3c2c Mon Sep 17 00:00:00 2001 From: Jong Date: Sun, 18 Aug 2024 10:27:43 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20webDomain=20basePath=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95=20(#107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 환경변수 못부르는 문제 수정 * fix: countdown hydration error fix * fix: 환경변수 설정 위치 변경 * chore: why * chore: test * fix: 질문등록해도 릴레이질문 등록 모달 노출 제거 * chore:test * chore:test * chore: remove console --- .github/workflows/deploy-integration.yml | 4 +- .../components/Countdown/AnswerCountdown.tsx | 45 +++++++++++++++ .../AnswerCountdownRender.tsx} | 44 +------------- .../containers/AnswerClosingContainer.tsx | 2 +- .../services/useAnswerClosingService.ts | 1 + .../ProgressingQuestionContainer.tsx | 2 +- .../KakaoShare/generateKakaoShare.utils.ts | 2 +- .../web-domains/src/common/getWebdomain.ts | 12 ---- .../src/common/utils/getWebDomain.ts | 13 +++-- .../queries/useGetTopPreviousQuestionList.ts | 1 - .../containers/NotificationContainer.tsx | 4 +- .../services/useNotificationService.ts | 1 + .../QuestionInfo/InActiveCountdownRender.tsx | 50 ++++++++++++++++ .../QuestionInfo/InActiveQuestion.tsx | 57 ++++++------------- .../CurrentRelayQuestionCountContainer.tsx | 3 +- .../ShareNextQuestionerContainer.tsx | 3 +- 16 files changed, 132 insertions(+), 112 deletions(-) create mode 100644 packages/web-domains/src/answer/common/components/Countdown/AnswerCountdown.tsx rename packages/web-domains/src/answer/common/components/{AnswerCountdown.tsx => Countdown/AnswerCountdownRender.tsx} (51%) delete mode 100644 packages/web-domains/src/common/getWebdomain.ts create mode 100644 packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveCountdownRender.tsx diff --git a/.github/workflows/deploy-integration.yml b/.github/workflows/deploy-integration.yml index 9643f61d..5af49588 100644 --- a/.github/workflows/deploy-integration.yml +++ b/.github/workflows/deploy-integration.yml @@ -53,11 +53,11 @@ jobs: destination-repository-name: ${{needs.variable.outputs.DESTINATION_REPOSITORY}} user-email: ${{secrets.EMAIL}} commit-message: 'chore: ${{inputs.user_name}} deploy ${{inputs.stage}}' - target-branch: ${{inputs.stage == 'prodction' && 'main' || 'main' }} + target-branch: ${{inputs.stage == 'production' && 'main' || 'main' }} - name: get deploy information id: deploy-information run: echo "target-repository=${{needs.variable.outputs.DESTINATION_REPOSITORY}}" >> "$GITHUB_OUTPUT" | - echo "target-branch=${{inputs.stage == 'prodction' && 'main' || 'main' }}" >> "$GITHUB_OUTPUT" + echo "target-branch=${{inputs.stage == 'production' && 'main' || 'main' }}" >> "$GITHUB_OUTPUT" info: name: get deploy information runs-on: ubuntu-latest diff --git a/packages/web-domains/src/answer/common/components/Countdown/AnswerCountdown.tsx b/packages/web-domains/src/answer/common/components/Countdown/AnswerCountdown.tsx new file mode 100644 index 00000000..5cc06f12 --- /dev/null +++ b/packages/web-domains/src/answer/common/components/Countdown/AnswerCountdown.tsx @@ -0,0 +1,45 @@ +import { Txt } from '@sambad/sds/components'; +import { colors } from '@sambad/sds/theme'; +import dayjs from 'dayjs'; +import dynamic from 'next/dynamic'; +import { HTMLAttributes } from 'react'; +import Countdown from 'react-countdown'; + +import { getRemainTime } from '../../../../home/common/utils/getRemainTime'; + +interface AnswerCountDownProps extends HTMLAttributes { + timer: string | number | Date; +} + +const CountdownRender = dynamic(() => import('./AnswerCountdownRender.tsx').then((mod) => mod.AnswerCountdownRender), { + ssr: true, +}); + +export const AnswerCountDown = ({ timer, ...rest }: AnswerCountDownProps) => { + const remainTime = getRemainTime(timer); + + const isTenminuteleft = remainTime <= dayjs().minute(10).valueOf(); + + return ( +
+ + 마감까지 남은 시간 + + ( + + )} + /> +
+ ); +}; diff --git a/packages/web-domains/src/answer/common/components/AnswerCountdown.tsx b/packages/web-domains/src/answer/common/components/Countdown/AnswerCountdownRender.tsx similarity index 51% rename from packages/web-domains/src/answer/common/components/AnswerCountdown.tsx rename to packages/web-domains/src/answer/common/components/Countdown/AnswerCountdownRender.tsx index 99a2644a..7bfefb48 100644 --- a/packages/web-domains/src/answer/common/components/AnswerCountdown.tsx +++ b/packages/web-domains/src/answer/common/components/Countdown/AnswerCountdownRender.tsx @@ -1,45 +1,7 @@ -import { Txt } from '@sambad/sds/components'; -import { borderRadiusVariants, colors, shadow } from '@sambad/sds/theme'; -import dayjs from 'dayjs'; -import { HTMLAttributes } from 'react'; -import Countdown from 'react-countdown'; +import { Txt } from '@sds/components'; +import { colors, borderRadiusVariants, shadow } from '@sds/theme'; -import { getRemainTime } from '../../../home/common/utils/getRemainTime'; - -interface AnswerCountDownProps extends HTMLAttributes { - timer: string | number | Date; -} - -export const AnswerCountDown = ({ timer, ...rest }: AnswerCountDownProps) => { - const remainTime = getRemainTime(timer); - - const isTenminuteleft = remainTime <= dayjs().minute(10).valueOf(); - - return ( -
- - 마감까지 남은 시간 - - ( - - )} - /> -
- ); -}; - -const CountdownRender = ({ +export const AnswerCountdownRender = ({ hours, minutes, seconds, diff --git a/packages/web-domains/src/answer/features/answer-closing/containers/AnswerClosingContainer.tsx b/packages/web-domains/src/answer/features/answer-closing/containers/AnswerClosingContainer.tsx index d75a68aa..768b7179 100644 --- a/packages/web-domains/src/answer/features/answer-closing/containers/AnswerClosingContainer.tsx +++ b/packages/web-domains/src/answer/features/answer-closing/containers/AnswerClosingContainer.tsx @@ -2,7 +2,7 @@ import { KakaoShareModal } from '@/common'; -import { AnswerCountDown } from '../../../common/components/AnswerCountdown'; +import { AnswerCountDown } from '../../../common/components/Countdown/AnswerCountdown'; import { ClosingButton } from '../../floating-button/components/ClosingButton'; import { ClosingMessage } from '../components/ClosingMessage'; import { useAnswerClosingService } from '../services/useAnswerClosingService'; diff --git a/packages/web-domains/src/answer/features/answer-closing/services/useAnswerClosingService.ts b/packages/web-domains/src/answer/features/answer-closing/services/useAnswerClosingService.ts index 8ec58fcb..b12e0d44 100644 --- a/packages/web-domains/src/answer/features/answer-closing/services/useAnswerClosingService.ts +++ b/packages/web-domains/src/answer/features/answer-closing/services/useAnswerClosingService.ts @@ -8,6 +8,7 @@ export const useAnswerClosingService = () => { const { close, isOpen } = useDialogContext(); const answerGlobalTime = useAtomValue(answerAtoms.answerGlobalTime); const basePath = getWebDomain(); + return { answerGlobalTime: answerGlobalTime ?? 0, isOpen, diff --git a/packages/web-domains/src/answer/features/progressing-question/containers/ProgressingQuestionContainer.tsx b/packages/web-domains/src/answer/features/progressing-question/containers/ProgressingQuestionContainer.tsx index 6ab5010a..67668808 100644 --- a/packages/web-domains/src/answer/features/progressing-question/containers/ProgressingQuestionContainer.tsx +++ b/packages/web-domains/src/answer/features/progressing-question/containers/ProgressingQuestionContainer.tsx @@ -3,7 +3,7 @@ import { Txt } from '@sambad/sds/components'; import { colors } from '@sambad/sds/theme'; -import { AnswerCountDown } from '../../../common/components/AnswerCountdown'; +import { AnswerCountDown } from '../../../common/components/Countdown/AnswerCountdown'; import { StartButton } from '../../floating-button/components/StartButton'; import { QuestionInfo } from '../components/QuestionInfo'; import { ResponseGuageBar } from '../components/ResponseGuageBar'; diff --git a/packages/web-domains/src/common/components/KakaoShare/generateKakaoShare.utils.ts b/packages/web-domains/src/common/components/KakaoShare/generateKakaoShare.utils.ts index b1838600..ffc5763f 100644 --- a/packages/web-domains/src/common/components/KakaoShare/generateKakaoShare.utils.ts +++ b/packages/web-domains/src/common/components/KakaoShare/generateKakaoShare.utils.ts @@ -12,7 +12,7 @@ interface ShareToKakaoProps { export const generateKakaoShare = ({ shareLink, shareImageUrl, shareDescription }: ShareToKakaoProps) => { const { Kakao } = window; - console.log(shareLink); + Kakao.Share.sendDefault({ objectType: 'feed', content: { diff --git a/packages/web-domains/src/common/getWebdomain.ts b/packages/web-domains/src/common/getWebdomain.ts deleted file mode 100644 index 9da36e29..00000000 --- a/packages/web-domains/src/common/getWebdomain.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const getWebDomain = () => { - const NEXT_PUBLIC_STAGE = process.env.NEXT_PUBLIC_STAGE; - - switch (NEXT_PUBLIC_STAGE) { - case 'production': - return 'https://moring.one'; - case 'development': - return 'https://dev.moring.one'; - } - - return 'https://local.moring.one:3000'; -}; diff --git a/packages/web-domains/src/common/utils/getWebDomain.ts b/packages/web-domains/src/common/utils/getWebDomain.ts index 9da36e29..44aba4fb 100644 --- a/packages/web-domains/src/common/utils/getWebDomain.ts +++ b/packages/web-domains/src/common/utils/getWebDomain.ts @@ -1,11 +1,12 @@ +const STAGE = process.env.NEXT_PUBLIC_STAGE; + export const getWebDomain = () => { - const NEXT_PUBLIC_STAGE = process.env.NEXT_PUBLIC_STAGE; + if (STAGE === 'production') { + return 'https://moring.one'; + } - switch (NEXT_PUBLIC_STAGE) { - case 'production': - return 'https://moring.one'; - case 'development': - return 'https://dev.moring.one'; + if (STAGE === 'development') { + return 'https://dev.moring.one'; } return 'https://local.moring.one:3000'; diff --git a/packages/web-domains/src/home/common/apis/queries/useGetTopPreviousQuestionList.ts b/packages/web-domains/src/home/common/apis/queries/useGetTopPreviousQuestionList.ts index 78b51eb5..4fdb3c1a 100644 --- a/packages/web-domains/src/home/common/apis/queries/useGetTopPreviousQuestionList.ts +++ b/packages/web-domains/src/home/common/apis/queries/useGetTopPreviousQuestionList.ts @@ -65,7 +65,6 @@ export async function getTopPreviousQuestionList( Cookie: cookie?.toString(), }, }); - console.log(data); return data; } 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 3427108f..826babb8 100644 --- a/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx +++ b/packages/web-domains/src/home/features/notification/containers/NotificationContainer.tsx @@ -4,14 +4,14 @@ import { ArrivedQuestionNotification } from '../components/ArrivedQuestionNotifi import { SelectedTargetMemberNotification } from '../components/SelectedTargetMemberNotification'; import { useNotificationService } from '../services/useNotificationService'; export const NotificationContainer = () => { - const { notfication, handleClose, isOpen, isNotAnswerd } = useNotificationService(); + const { notfication, handleClose, isOpen, isNotAnswerd, isNotRegistered } = useNotificationService(); return ( <> {notfication?.eventType === 'QUESTION_REGISTERED' && isNotAnswerd && ( )} - {notfication?.eventType === 'TARGET_MEMBER' && ( + {notfication?.eventType === 'TARGET_MEMBER' && isNotRegistered && ( )} diff --git a/packages/web-domains/src/home/features/notification/services/useNotificationService.ts b/packages/web-domains/src/home/features/notification/services/useNotificationService.ts index 6f9985f7..8f456c01 100644 --- a/packages/web-domains/src/home/features/notification/services/useNotificationService.ts +++ b/packages/web-domains/src/home/features/notification/services/useNotificationService.ts @@ -53,5 +53,6 @@ export const useNotificationService = () => { handleClose, isRefetching, isNotAnswerd: !progressingQuestionData?.isAnswered, + isNotRegistered: !progressingQuestionData?.isQuestionRegistered, }; }; diff --git a/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveCountdownRender.tsx b/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveCountdownRender.tsx new file mode 100644 index 00000000..6022007c --- /dev/null +++ b/packages/web-domains/src/home/features/progressing-question/components/QuestionInfo/InActiveCountdownRender.tsx @@ -0,0 +1,50 @@ +'use client'; + +import { Txt } from '@sds/components'; +import { borderRadiusVariants, colors } from '@sds/theme'; + +export const InActiveCountdownRender = ({ + hours, + minutes, + seconds, +}: { + hours: number; + minutes: number; + seconds: number; +}) => { + const renderHours = hours < 10 ? `0${hours}` : `${hours}`; + const renderMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`; + const renderseconds = seconds < 10 ? `0${seconds}` : `${seconds}`; + + return ( +
+ + {renderHours} + + + : + + + {renderMinutes} + + + : + + + {renderseconds} + +
+ ); +}; 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 1559e4af..166a2f89 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 @@ -1,7 +1,8 @@ 'use client'; import { Txt } from '@sambad/sds/components'; -import { borderRadiusVariants, colors } from '@sambad/sds/theme'; +import { colors } from '@sambad/sds/theme'; +import dynamic from 'next/dynamic'; import Countdown from 'react-countdown'; import { ClockIcon } from '../../../../../common/asset/clock'; @@ -9,6 +10,13 @@ import { MemberType } from '../../../../common/apis/schema/useGetProgressingQues import { Avatar } from '../../../../common/components/Avatar/Avatar'; import { getRemainTime } from '../../../../common/utils/getRemainTime'; +const CountdownRender = dynamic( + () => import('./InActiveCountdownRender.tsx').then((mod) => mod.InActiveCountdownRender), + { + ssr: true, + }, +); + interface InActiveQuestionProps { time: number; targetMember: MemberType; @@ -20,52 +28,19 @@ export const InActiveQuestion = ({ time, targetMember }: InActiveQuestionProps) const timer = getRemainTime(time); return ( -
+
{name}님의 질문을 기다리고 있어요 - + ( + + )} + />
); }; - -const CountdownRender = ({ hours, minutes, seconds }: { hours: number; minutes: number; seconds: number }) => { - const renderHours = hours < 10 ? `0${hours}` : `${hours}`; - const renderMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`; - const renderseconds = seconds < 10 ? `0${seconds}` : `${seconds}`; - - return ( -
- - {renderHours} - - - : - - - {renderMinutes} - - - : - - - {renderseconds} - -
- ); -}; diff --git a/packages/web-domains/src/relay-question/features/share-group/containers/CurrentRelayQuestionCountContainer/CurrentRelayQuestionCountContainer.tsx b/packages/web-domains/src/relay-question/features/share-group/containers/CurrentRelayQuestionCountContainer/CurrentRelayQuestionCountContainer.tsx index b85a0f7b..d8421e7b 100644 --- a/packages/web-domains/src/relay-question/features/share-group/containers/CurrentRelayQuestionCountContainer/CurrentRelayQuestionCountContainer.tsx +++ b/packages/web-domains/src/relay-question/features/share-group/containers/CurrentRelayQuestionCountContainer/CurrentRelayQuestionCountContainer.tsx @@ -5,8 +5,7 @@ import { colors, size } from '@sambad/sds/theme'; import Link from 'next/link'; import { useState } from 'react'; -import { KakaoShareModal } from '@/common'; -import { getWebDomain } from '@/common/getWebdomain'; +import { KakaoShareModal, getWebDomain } from '@/common'; import { findCurrentMeetingId } from '@/relay-question/utils/findCurrentMeetingId'; import { ShareGroupBackground } from '../../../../assets/ShareGroupBackground'; diff --git a/packages/web-domains/src/relay-question/features/share-next-questioner/containers/ShareNextQuestionerContainer/ShareNextQuestionerContainer.tsx b/packages/web-domains/src/relay-question/features/share-next-questioner/containers/ShareNextQuestionerContainer/ShareNextQuestionerContainer.tsx index 4574bc12..9e52e6c8 100644 --- a/packages/web-domains/src/relay-question/features/share-next-questioner/containers/ShareNextQuestionerContainer/ShareNextQuestionerContainer.tsx +++ b/packages/web-domains/src/relay-question/features/share-next-questioner/containers/ShareNextQuestionerContainer/ShareNextQuestionerContainer.tsx @@ -5,8 +5,7 @@ import { colors, size } from '@sambad/sds/theme'; import Link from 'next/link'; import { useState } from 'react'; -import { KakaoShareModal } from '@/common'; -import { getWebDomain } from '@/common/getWebdomain'; +import { KakaoShareModal, getWebDomain } from '@/common'; import { useActiveQuestionQuery } from '@/relay-question/features/share-group/hooks/useActiveQuestionQuery'; import { useMyMeetingsQuery } from '@/relay-question/features/start-relay-question/hooks/queries/useMyMeetingsQuery'; import { findCurrentMeetingId } from '@/relay-question/utils/findCurrentMeetingId';