From 6d65381f2cfe53a85c5e7f2ca5d885c97a2d5d4f Mon Sep 17 00:00:00 2001 From: yooshnn Date: Wed, 14 Aug 2024 15:07:54 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[SBL-95]=20=EC=B5=9C=EC=A2=85=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/s/[surveyId]/p/page.tsx | 8 +++++- src/components/survey-details/index.tsx | 20 +++++++++++--- .../survey-p/farewell/Farewell.module.css | 1 + src/components/survey-p/farewell/Farewell.tsx | 2 +- .../survey-p/ui/navigator/Navigator.tsx | 16 +++++++++--- src/components/survey-result/index.tsx | 4 +-- src/utils/dates.ts | 26 ++++++++++++++++++- 7 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/app/s/[surveyId]/p/page.tsx b/src/app/s/[surveyId]/p/page.tsx index 30bf116..8298b7c 100644 --- a/src/app/s/[surveyId]/p/page.tsx +++ b/src/app/s/[surveyId]/p/page.tsx @@ -28,6 +28,7 @@ export default function Page({ params }: { params: { surveyId: string } }) { const { data: survey, isLoading, isError, refetch } = useSurveysProgress(surveyId); const mutation = useSurveysResponse(surveyId); const [surveyState] = useState(getSurveyState(surveyId)); + const [isSubmitting, setIsSubmitting] = useState(false); const { history: initialHistory, responses: initialResponses } = useMemo(() => { return loadInteractions(surveyId); @@ -131,6 +132,7 @@ export default function Page({ params }: { params: { surveyId: string } }) { if (!userResponse) return; const visitorId = visitorData?.visitorId || undefined; + setIsSubmitting(true); mutation.mutate( { ...userResponse, visitorId }, @@ -142,6 +144,7 @@ export default function Page({ params }: { params: { surveyId: string } }) { }, onError: (error) => { showToast('error', (error.cause as ErrorCause).message); + setIsSubmitting(false); }, } ); @@ -153,10 +156,13 @@ export default function Page({ params }: { params: { surveyId: string } }) { setUserResponse(null)} - nextText="제출" + nextText={isSubmitting ? '제출 중...' : '제출'} nextAction={onSubmit} + disablePrev={isSubmitting} + disableNext={isSubmitting} centered /> + {isSubmitting} ); } diff --git a/src/components/survey-details/index.tsx b/src/components/survey-details/index.tsx index e35ab1d..c409c84 100644 --- a/src/components/survey-details/index.tsx +++ b/src/components/survey-details/index.tsx @@ -7,7 +7,7 @@ import Wrapper from '@/components/layout/Wrapper'; import Button from '@/components/ui/button/Button'; import Tooltip from '@/components/ui/tooltip/Tooltip'; import type { SurveysDetailsResponse } from '@/services/surveys/types'; -import { yymmdd } from '@/utils/dates'; +import { convertToKst } from '@/utils/dates'; import { writeClipboard } from '@/utils/misc'; import styles from './index.module.css'; @@ -34,7 +34,18 @@ interface Props { export default function DetailsViewer({ data, surveyId, state }: Props) { const router = useRouter(); - const { title, description, status, finishedAt, currentParticipants, targetParticipants, rewards, thumbnail } = data; + const { + title, + description, + status, + finishedAt: rawFinishedAt, + currentParticipants, + targetParticipants, + rewards, + thumbnail, + } = data; + + const finishedAt = convertToKst(rawFinishedAt); const copyUrl = () => { writeClipboard(window.location.href); @@ -50,6 +61,7 @@ export default function DetailsViewer({ data, surveyId, state }: Props) { <>
+ {/* eslint-disable-next-line @next/next/no-img-element */}

{title}

@@ -92,7 +104,9 @@ export default function DetailsViewer({ data, surveyId, state }: Props) {
-
{yymmdd(finishedAt)} 자동 마감
+
+ {finishedAt.year}년 {finishedAt.month}월 {finishedAt.date}일 {finishedAt.hour}시 자동 마감 +
diff --git a/src/components/survey-p/farewell/Farewell.module.css b/src/components/survey-p/farewell/Farewell.module.css index 902518e..1dd327e 100644 --- a/src/components/survey-p/farewell/Farewell.module.css +++ b/src/components/survey-p/farewell/Farewell.module.css @@ -32,6 +32,7 @@ .title { padding: 8px; margin-bottom: 8px; + font-weight: 500; } .message { diff --git a/src/components/survey-p/farewell/Farewell.tsx b/src/components/survey-p/farewell/Farewell.tsx index d1036d6..a77d518 100644 --- a/src/components/survey-p/farewell/Farewell.tsx +++ b/src/components/survey-p/farewell/Farewell.tsx @@ -11,7 +11,7 @@ export default function Farewell({ message }: Props) {

응답 완료!

-
제작자의 메시지
+
<제작자의 메시지>
{message}
제출하면 설문 참여가 완료됩니다.
diff --git a/src/components/survey-p/ui/navigator/Navigator.tsx b/src/components/survey-p/ui/navigator/Navigator.tsx index 624baa8..df788e1 100644 --- a/src/components/survey-p/ui/navigator/Navigator.tsx +++ b/src/components/survey-p/ui/navigator/Navigator.tsx @@ -7,17 +7,27 @@ interface Props { nextAction: () => void; backText: string; nextText: string; + disablePrev?: boolean; + disableNext?: boolean; centered?: true; } -export default function Navigator({ backAction, nextAction, backText, nextText, centered }: Props) { +export default function Navigator({ + backAction, + nextAction, + backText, + nextText, + disablePrev, + disableNext, + centered, +}: Props) { return (
- -
diff --git a/src/components/survey-result/index.tsx b/src/components/survey-result/index.tsx index d2ef2cc..00337e9 100644 --- a/src/components/survey-result/index.tsx +++ b/src/components/survey-result/index.tsx @@ -12,9 +12,9 @@ export default function SurveyResult({ surveyId, reward }: Props) {

추첨 결과

{!reward &&
아쉽게도 낙첨되셨습니다.
} {reward &&
{reward} 당첨!
} - {reward && ( + {reward && surveyId === 'c7b29789-54e9-46b6-a896-5ab29e5a30a6' && (
- 📅 2024년 8월 18일까지 리워드를 지급할 예정입니다. + 📅 2024년 8월 19일까지 리워드를 지급할 예정입니다.
)}
diff --git a/src/utils/dates.ts b/src/utils/dates.ts index 2d736c3..1e51a6c 100644 --- a/src/utils/dates.ts +++ b/src/utils/dates.ts @@ -20,6 +20,30 @@ function dateParser(dateString: string) { return { valid: true, sign, dayDiff, hourDiff, minuteDiff }; } +function convertToKst(dateString: string) { + const inputDate = new Date(dateString); + + if (Number.isNaN(inputDate.getTime())) { + return { + year: 'invalid', + month: 'invalid', + date: 'invalid', + hour: 'invalid', + minute: 'invalid', + }; + } + + const kstDate = new Date(inputDate.toLocaleString('en-US', { timeZone: 'Asia/Seoul' })); + + return { + year: kstDate.getFullYear(), + month: kstDate.getMonth() + 1, + date: kstDate.getDate(), + hour: kstDate.getHours(), + minute: kstDate.getMinutes(), + }; +} + function yymmdd(dateString: string): string { const inputDate = new Date(dateString); @@ -47,4 +71,4 @@ function dateReader(dateString: string): string { return `마감된 설문`; } -export { dateParser, yymmdd, dateReader }; +export { dateParser, yymmdd, dateReader, convertToKst }; From 4faa90f79904f210dfc69af9b2dfb92806990301 Mon Sep 17 00:00:00 2001 From: yooshnn Date: Wed, 14 Aug 2024 15:10:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[SBL-95]=202=EC=B0=A8=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=ED=91=9C=EC=8B=9C=20=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=98=A4=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 --- src/components/survey-result/index.tsx | 32 +++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/components/survey-result/index.tsx b/src/components/survey-result/index.tsx index 00337e9..bcc621d 100644 --- a/src/components/survey-result/index.tsx +++ b/src/components/survey-result/index.tsx @@ -12,24 +12,28 @@ export default function SurveyResult({ surveyId, reward }: Props) {

추첨 결과

{!reward &&
아쉽게도 낙첨되셨습니다.
} {reward &&
{reward} 당첨!
} - {reward && surveyId === 'c7b29789-54e9-46b6-a896-5ab29e5a30a6' && ( + {reward && (
📅 2024년 8월 19일까지 리워드를 지급할 예정입니다.
)} -
-
-

설문이용 이용 경험에 대해 이야기해주세요!

- - https://forms.gle/zrCakugWRjredYq89 - -

- 위 설문까지 답변해 주신 분들 중 세 분을 추첨해 -
- 가장 많은 선택을 받은 치킨 기프티콘을 드립니다. -

-
-
+ {surveyId === 'c7b29789-54e9-46b6-a896-5ab29e5a30a6' && ( + <> +
+
+

설문이용 이용 경험에 대해 이야기해주세요!

+ + https://forms.gle/zrCakugWRjredYq89 + +

+ 위 설문까지 답변해 주신 분들 중 세 분을 추첨해 +
+ 가장 많은 선택을 받은 치킨 기프티콘을 드립니다. +

+
+
+ + )}
설문조사 첫 페이지로 설문이용 메인으로