From b643e597edfc3473bff8a1c0dddd2a719de204f3 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:43:46 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20AdminPage=20console.log=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/src/pages/Admin/AdminPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Caecae/src/pages/Admin/AdminPage.tsx b/Caecae/src/pages/Admin/AdminPage.tsx index 67a1fbb..50a05fa 100644 --- a/Caecae/src/pages/Admin/AdminPage.tsx +++ b/Caecae/src/pages/Admin/AdminPage.tsx @@ -276,9 +276,8 @@ const AdminPage = () => {
{ - console.log(typeof findmes); const newFindMe = [...findmes]; - console.log(answer); + newFindMe[day].answers = [...newFindMe[day].answers, answer]; setFindMes(newFindMe); }} From 79e0f42dff25aad3447262b67514703b1c1f115e Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:44:08 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=EB=8D=B0=EB=AA=A8=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20hint=20=EB=B6=80=EB=B6=84=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FindingGame/FindingGame.tsx | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/Caecae/src/components/FindingGame/FindingGame.tsx b/Caecae/src/components/FindingGame/FindingGame.tsx index 24bfb1b..218d520 100644 --- a/Caecae/src/components/FindingGame/FindingGame.tsx +++ b/Caecae/src/components/FindingGame/FindingGame.tsx @@ -10,30 +10,33 @@ import wrongLottie from "@assets/animationIncorrect.json"; import { store, useExistState } from "../../shared/Hyundux"; import HintSpot from "./Hint/HintSpot.tsx"; import SmileBadge from "../common/SmileBadge/index.tsx"; +import { createStory } from "../../shared/Hyundux-saga/Story.tsx"; +import useSaga from "../../shared/Hyundux-saga/useSaga.tsx"; +import { getFindGameStory } from "../../stories/getFindingGame.tsx"; const FindingGame = () => { const state = useExistState(initFindingGameState); - const timerId = useRef(null); + // const timerId = useRef(null); + const [status, teller] = useSaga(); + status; useEffect(() => { - store.dispatch(action.init()); - timerId.current = setTimeout(() => { - store.dispatch(action.showHint()); - }, 40000); + const getFindGameRunStory = createStory(getFindGameStory, {}); + teller(action.init, [getFindGameRunStory]); + // timerId.current = setTimeout(() => { + // store.dispatch(action.showHint()); + // }, 40000); }, []); - useEffect(() => { - if (state.showingHint.length == 0) { - if (timerId.current != null) { - clearInterval(timerId.current); - } - timerId.current = setTimeout(() => { - store.dispatch(action.showHint()); - }, 40000); - } - }, [state.showingHint]); - - const imgURL = - "https://pds.joongang.co.kr/news/component/htmlphoto_mmdata/202109/01/b57fdda5-3996-430f-8bf2-65052b1d12b2.jpg"; + // useEffect(() => { + // if (state.showingHint.length == 0) { + // if (timerId.current != null) { + // clearInterval(timerId.current); + // } + // timerId.current = setTimeout(() => { + // store.dispatch(action.showHint()); + // }, 40000); + // } + // }, [state.showingHint]); const onClickAction = ( width: number, @@ -44,7 +47,7 @@ const FindingGame = () => { width; heigjht; if (state.gameStatus == "Gaming") { - store.dispatch(action.click(y, x)); + store.dispatch(action.click(y, x, width, heigjht)); } }; @@ -55,9 +58,8 @@ const FindingGame = () => { if (state.gameStatus == "Gaming") { return ( { return <>; }); - const answerElement = state.answers.map((answer, index) => { - if (state.gameStatus == "Done") { - const left = answer.x - 50; - const top = answer.y - 50; + const answerElement = state.showingAnswers.map((answer, index) => { + if (state.gameStatus == "DoneSuccess" || state.gameStatus == "DoneFail") { + const left = answer.positionX - 50; + const top = answer.positionY - 50; const rotateRadian = index == 0 ? "-13" : "8"; const bageType = index == 0 ? "orange_line" : "yellow_line"; return ( @@ -109,18 +111,19 @@ const FindingGame = () => { /> ); }); - const showingHintElement = state.showingHint.map((hintAnswer) => { - return ; - }); + + // const showingHintElement = state.showingHint.map((hintAnswer) => { + // return ; + // }); return (
Date: Thu, 15 Aug 2024 23:44:41 +0900 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=EC=8B=A4=EC=A0=9C=20=EA=B2=8C?= =?UTF-8?q?=EC=9E=84=ED=83=80=EC=9E=85=EC=97=90=20=EB=94=B0=EB=A5=B8=20HTM?= =?UTF-8?q?L=20=EB=B3=80=EA=B2=BD=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FindingGame/FindingGameInfo.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Caecae/src/components/FindingGame/FindingGameInfo.tsx b/Caecae/src/components/FindingGame/FindingGameInfo.tsx index 9be8dce..1b1fbfe 100644 --- a/Caecae/src/components/FindingGame/FindingGameInfo.tsx +++ b/Caecae/src/components/FindingGame/FindingGameInfo.tsx @@ -8,7 +8,7 @@ function modeDependency(mode: string): { tooltipTitle: string; tooltipContent: string; } { - if (mode === "pixel") { + if (mode === "PIXEL") { return { findingWord: "숨겨진 픽셀", tooltipTitle: "픽셀 디자인", @@ -31,7 +31,7 @@ const FindingGameInfo = () => { setIsTooltipShowing((prev) => !prev); } - const modeData = modeDependency("pixel"); + const modeData = modeDependency(state.gameType); const tooltip = isTooltipShowing ? ( <> @@ -53,13 +53,9 @@ const FindingGameInfo = () => { <> ); - const badges = state.answers.map((answer, index) => { + const badges = new Array(2).fill(0).map((answer, index) => { const badgeType = index == 0 ? "blue" : "orange"; - if ( - state.showingAnswers.filter( - (showingAnswer) => showingAnswer.id == answer.id - ).length !== 0 - ) { + if (state.showingAnswers.length > index) { return ( Date: Thu, 15 Aug 2024 23:45:12 +0900 Subject: [PATCH 04/11] =?UTF-8?q?fix:=20answer=EB=A5=BC=20=ED=81=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=8C?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=A1=9C=EC=A7=81=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FindingGame/FindingGameResult.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Caecae/src/components/FindingGame/FindingGameResult.tsx b/Caecae/src/components/FindingGame/FindingGameResult.tsx index 372415c..50e0d09 100644 --- a/Caecae/src/components/FindingGame/FindingGameResult.tsx +++ b/Caecae/src/components/FindingGame/FindingGameResult.tsx @@ -7,8 +7,7 @@ import { Link } from "../../shared/Hyunouter"; const FindingGameResult = () => { const state = useExistState(initFindingGameState); - const currentAnswer = state.answers[state.answerIndex]; - + const currentAnswer = state.showingAnswers[state.answerIndex]; return ( <>
@@ -24,8 +23,8 @@ const FindingGameResult = () => { className="bg-[#000000] bg-opacity-50 w-[50px] h-[50px] flex justify-center items-center" onClick={() => { const index = - (state.answers.length + state.answerIndex - 1) % - state.answers.length; + (state.showingAnswers.length + state.answerIndex - 1) % + state.showingAnswers.length; store.dispatch(action.changeShowingAnswer(index)); }} > @@ -34,7 +33,8 @@ const FindingGameResult = () => {
{ - const index = (state.answerIndex + 1) % state.answers.length; + const index = + (state.answerIndex + 1) % state.showingAnswers.length; store.dispatch(action.changeShowingAnswer(index)); }} > @@ -42,13 +42,13 @@ const FindingGameResult = () => {

{currentAnswer.title}

-

{currentAnswer.info}

+

{currentAnswer.content}

From 20cdcc6c858fab24d0f5f6917d94348c5bc49dd8 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:45:55 +0900 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20Phonenumber=EB=A5=BC=20=EB=84=A3?= =?UTF-8?q?=EC=9C=BC=EB=A9=B4=20=EC=8B=A4=ED=96=89=EB=90=98=EB=8A=94=20onc?= =?UTF-8?q?lick=ED=95=A8=EC=88=98=20props=EB=A1=9C=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PhoneNumberOverlay/PhoneNumberOverlay.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Caecae/src/components/PhoneNumberOverlay/PhoneNumberOverlay.tsx b/Caecae/src/components/PhoneNumberOverlay/PhoneNumberOverlay.tsx index 5ac33c5..4522f5b 100644 --- a/Caecae/src/components/PhoneNumberOverlay/PhoneNumberOverlay.tsx +++ b/Caecae/src/components/PhoneNumberOverlay/PhoneNumberOverlay.tsx @@ -4,9 +4,13 @@ import { store } from "../../shared/Hyundux"; interface PhoneNumberOverlayProps { type: "findCasper" | "raceCasper"; + onClick?: (phoneNumber: string) => void; } -const PhoneNumberOverlay = ({ type }: PhoneNumberOverlayProps) => { +const PhoneNumberOverlay = ({ + type, + onClick = () => {}, +}: PhoneNumberOverlayProps) => { const [timeLeft, setTimeLeft] = useState(3 * 60); // 3분을 초 단위로 변환 const [phoneNumber, setPhoneNumber] = useState(""); const [check, setCheck] = useState(false); @@ -98,13 +102,15 @@ const PhoneNumberOverlay = ({ type }: PhoneNumberOverlayProps) => {
)}
-

전화번호

+

+ 전화번호 +

@@ -112,7 +118,7 @@ const PhoneNumberOverlay = ({ type }: PhoneNumberOverlayProps) => { 개인정보 동의

-
+

1. 개인정보의 처리 목적
@@ -152,6 +158,8 @@ const PhoneNumberOverlay = ({ type }: PhoneNumberOverlayProps) => { {enterable === true ? (

{ + const parameter = phoneNumber.replace(/-/g, ""); + onClick(parameter); store.dispatch(action.nextPage()); }} className="bg-[#002C5F] h-[12%] flex items-center justify-center hover:cursor-pointer" @@ -160,7 +168,9 @@ const PhoneNumberOverlay = ({ type }: PhoneNumberOverlayProps) => {
) : (
-

개인정보를 입력해주세요

+

+ 개인정보를 입력해주세요 +

)}
From 5144a64b979354f4c675a0be8770b7388b8d8f5e Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:46:23 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20=EB=94=94=EB=B2=84=EA=B7=B8=20cons?= =?UTF-8?q?ole.log=20=EC=82=AD=EC=A0=9C=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/src/features/FindingGameLanding/OpenEvent.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/Caecae/src/features/FindingGameLanding/OpenEvent.tsx b/Caecae/src/features/FindingGameLanding/OpenEvent.tsx index f42ba8a..a25d4ac 100644 --- a/Caecae/src/features/FindingGameLanding/OpenEvent.tsx +++ b/Caecae/src/features/FindingGameLanding/OpenEvent.tsx @@ -56,7 +56,6 @@ const OpenEvent = forwardRef((props, ref) => { fetchData(); }, []); - console.log(eventStatus); let data: StatusInfo | null = null; if (eventStatus == "none") { data = { From 6d7ae69566186b922bd00ee414fda572e21ca620 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:47:02 +0900 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20=EC=A0=95=EB=8B=B5=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20action=20=EA=B5=AC=ED=98=84=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/jobs/FindingGame/FindingGameWork.tsx | 179 ++++++++++-------- 1 file changed, 103 insertions(+), 76 deletions(-) diff --git a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx index 0033155..e8d6771 100644 --- a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx +++ b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx @@ -4,25 +4,37 @@ import { Action, Reducer, } from "../../shared/Hyundux"; +import { + _Position, + GetFindFAmeIsAnswerBodyParameter, + getFindGameIsAnswerDTO, +} from "../../stories/getFindGameIsAnswer"; +import { FindGame } from "../../stories/getFindingGame"; +import Response from "../../stories/Response"; -import FindingGameAnswer from "../../types/FindingGameAnswer"; +import { CorrectAnswer } from "../../stories/getFindGameIsAnswer"; +import huynxios from "../../shared/Hyunxios"; const WORK_NAME = "FindingGame"; // state type interface FindingGamePayLoad { - gameStatus: "Gaming" | "Done"; + imageURL: ""; + gameType: "PIXEL" | "BADGE"; + gameStatus: "Gaming" | "DoneSuccess" | "DoneFail"; answerIndex: number; - answers: FindingGameAnswer[]; - showingAnswers: FindingGameAnswer[]; + ticketId: string; + showingAnswers: CorrectAnswer[]; wrongAnswers: { id: number; y: number; x: number }[]; - showingHint: FindingGameAnswer[]; + showingHint: CorrectAnswer[]; } const initFindingGameState = createState(WORK_NAME, { + imageURL: "", + gameType: "PIXEL", gameStatus: "Gaming", answerIndex: 0, - answers: [], + ticketId: "-1", showingAnswers: [], wrongAnswers: [], showingHint: [], @@ -35,66 +47,66 @@ const findingGameReducer: Reducer = { const payLoad = state.payload; switch (action.actionName) { case "init": { - // 실제로는 여기서 비동기로 answer fetch해야함 - const fetchedAnswers: FindingGameAnswer[] = [ - { - id: Math.random(), - y: 100, - x: 100, - imageURL: - "https://cdn.newautopost.co.kr/newautopost/2024/07/09121310/%EC%BA%90%EC%8A%A4%ED%8D%BC-%EC%9D%BC%EB%A0%89%ED%8A%B8%EB%A6%AD-1.jpg", - info: "알로이 휠은 강도가 높으면서도 무게가 가벼워 주행 성능과 연비를 개선하는 데 큰 도움을 줍니다. 픽셀 디자인의 휠은 캐스퍼 일렉트릭의 스타일을 돋보이게 합니다.", - title: "17인치 알로이 휠 & 타이어", - }, - { - id: Math.random(), - y: 500, - x: 500, - imageURL: - "https://www.hyundai.co.kr/image/upload/asset_library/MDA00000000000052243/d91508780929423b9999a699bafe60aa.jpg", - title: "전자식 공조 시스템", - info: "풀 오토 에어컨이 적용된 전자식 공조 시스템을 통해 자동으로 오너가 원하는 온도로 풍량을 조절하여 쾌적한 실내를 유지합니다.", - }, - ]; - - return makePayLoad(state, { answers: fetchedAnswers }); + const actionPayload = action.payload as Response; + return makePayLoad(state, { + imageURL: actionPayload.data.info.questionImageUrl, + gameType: actionPayload.data.info.answerType, + }); } case "click": { - const actionPayLoad = (action.payload || {}) as { - id: number; + const actionPayLoad = action.payload as { y: number; x: number; + width: number; + heght: number; }; - const showingAnswers: FindingGameAnswer[] = [...payLoad.showingAnswers]; - let isCorrect = false; - payLoad.answers.forEach((answer) => { - if ( - calculateRange(answer.y, answer.x, actionPayLoad.y, actionPayLoad.x) - ) { - isCorrect = true; - showingAnswers.push({ - id: answer.id, - y: answer.y, - x: answer.x, - imageURL: "", - title: "", - info: "", + + const parameter = { + answerList: [ + ...payLoad.showingAnswers.map((answer) => { + return { + positionX: answer.positionX, + positionY: answer.positionY, + } as _Position; + }), + { + positionX: actionPayLoad.x / actionPayLoad.width, + positionY: actionPayLoad.y / actionPayLoad.heght, + } as _Position, + ], + } as GetFindFAmeIsAnswerBodyParameter; + const response = await huynxios.post>( + "/api/finding/answer", + parameter + ); + + if ( + state.payload.showingAnswers.length != + response.data.correctAnswerList.length + ) { + if (response.data.correctAnswerList.length == 2) { + return makePayLoad(state, { + ticketId: response.data.ticketId, + gameStatus: + response.data.ticketId === "-1" ? "DoneFail" : "DoneSuccess", + showingAnswers: response.data.correctAnswerList, }); } - }); - if (isCorrect) { return makePayLoad(state, { - gameStatus: showingAnswers.length == 2 ? "Done" : "Gaming", - showingAnswers: showingAnswers, - showingHint: [], + showingAnswers: response.data.correctAnswerList, }); - } else { - const _wrongAnswers: { id: number; y: number; x: number }[] = [ - ...payLoad.wrongAnswers, - ]; - _wrongAnswers.push(actionPayLoad); - return makePayLoad(state, { wrongAnswers: _wrongAnswers }); } + + return makePayLoad(state, { + wrongAnswers: [ + ...state.payload.wrongAnswers, + { + id: Math.round(Math.random() * 1000), + y: actionPayLoad.y, + x: actionPayLoad.x, + }, + ], + }); } case "removeWrongAnswer": { const actionPayLoad = (action.payload || {}) as { @@ -105,23 +117,24 @@ const findingGameReducer: Reducer = { ); return makePayLoad(state, { wrongAnswers: _wrongAnswers }); } - case "showHint": { - if (state.payload.showingAnswers.length < 2) { - const idsInAnswers = new Set( - state.payload.showingAnswers.map((item) => item.id) - ); - const newHints = state.payload.answers.filter( - (item) => !idsInAnswers.has(item.id) - ); - const newShowingHints = [newHints[0]]; - return makePayLoad(state, { showingHint: newShowingHints }); - } - return state; - } + // case "showHint": { + // if (state.payload.showingAnswers.length < 2) { + // const idsInAnswers = new Set( + // state.payload.showingAnswers.map((item) => item.id) + // ); + // const newHints = state.payload.answers.filter( + // (item) => !idsInAnswers.has(item.id) + // ); + // const newShowingHints = [newHints[0]]; + // return makePayLoad(state, { showingHint: newShowingHints }); + // } + // return state; + // } case "changeShowingAnswer": { const actionPayLoad = (action.payload || {}) as { answerIndex: number; }; + return makePayLoad(state, { answerIndex: actionPayLoad.answerIndex }); } default: @@ -132,21 +145,33 @@ const findingGameReducer: Reducer = { // actions const action = { - init: (): Action => { + init: (object: object): Action => { + const payLoad = object as Response; return { type: WORK_NAME, actionName: "init", + payload: payLoad, }; }, - click: (y: number, x: number): Action => { + click: (y: number, x: number, width: number, height: number): Action => { + const payLoad = { y: y, x: x, width: width, heght: height } as { + y: number; + x: number; + width: number; + heght: number; + }; return { type: WORK_NAME, actionName: "click", - payload: { - id: Math.random(), - y: y, - x: x, - }, + payload: payLoad, + }; + }, + checkAnswer: (object: object): Action => { + const payLoad = object as Response; + return { + type: WORK_NAME, + actionName: "checkAnswer", + payload: payLoad, }; }, removeWrongAnswer: (id: number): Action => { @@ -175,6 +200,8 @@ const action = { }, }; +function postionToBodyParameter() {} + const calculateRange = ( answerY: number, answerX: number, From 5fe78b0cac236fa63af06f3759553e67d8c8bbc5 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:47:24 +0900 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20tickeId=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20overlay=20Content=20=EB=B3=80=EA=B2=BD=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/FindingGame/FindingGamePage.tsx | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/Caecae/src/pages/FindingGame/FindingGamePage.tsx b/Caecae/src/pages/FindingGame/FindingGamePage.tsx index 5266583..d103095 100644 --- a/Caecae/src/pages/FindingGame/FindingGamePage.tsx +++ b/Caecae/src/pages/FindingGame/FindingGamePage.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { ReactNode, useEffect } from "react"; import { FindingGame, FindingGameInfo } from "../../components/FindingGame"; import { findingGameReducer, @@ -12,6 +12,7 @@ import FailContent from "./Enter/FailContent"; import SuccessEnterContent from "./Enter/SuccessEnterContent"; import FindingGameResult from "../../components/FindingGame/FindingGameResult"; import PhoneNumberOverlay from "../../components/PhoneNumberOverlay/PhoneNumberOverlay"; +import huynxios from "../../shared/Hyunxios"; const FindingGamePage = () => { const [gameState, dispatch] = useWork( @@ -27,14 +28,43 @@ const FindingGamePage = () => { } }, [gameState.showingAnswers.length]); - return ( -
+ let content: ReactNode | null = null; + if (gameState.gameStatus == "DoneSuccess") { + console.log(gameState.gameStatus); + content = ( } /> - } /> + { + const response = await huynxios.post("/api/finding/register", { + ticketId: gameState.ticketId, + phone: phoneNumber, + }); + console.log(response); + }} + /> + } + /> } /> - } /> + ); + } else if (gameState.gameStatus == "DoneFail") { + console.log(gameState.gameStatus); + content = ( + + } /> + + ); + } + console.log(gameState.gameStatus); + + return ( +
+ {content}
From 4de775678cf694e171e68772df5eaf2d9712c5a1 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:48:18 +0900 Subject: [PATCH 09/11] =?UTF-8?q?feat:=20API=EC=9D=98=20=EA=B3=B5=ED=86=B5?= =?UTF-8?q?=EC=A0=81=EC=9D=B8=20Reponse=20=EA=B5=AC=ED=98=84=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/src/jobs/FindingGame/FindingGameWork.tsx | 2 +- Caecae/src/utils/Response.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Caecae/src/utils/Response.tsx diff --git a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx index e8d6771..a244e35 100644 --- a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx +++ b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx @@ -10,7 +10,7 @@ import { getFindGameIsAnswerDTO, } from "../../stories/getFindGameIsAnswer"; import { FindGame } from "../../stories/getFindingGame"; -import Response from "../../stories/Response"; +import Response from "../../utils/Response"; import { CorrectAnswer } from "../../stories/getFindGameIsAnswer"; import huynxios from "../../shared/Hyunxios"; diff --git a/Caecae/src/utils/Response.tsx b/Caecae/src/utils/Response.tsx new file mode 100644 index 0000000..1a8c216 --- /dev/null +++ b/Caecae/src/utils/Response.tsx @@ -0,0 +1,5 @@ +export default interface Response { + responseCode: number; + message: string; + data: T; +} From 1070d7021dd4aeae7f11705d5416e5bc830b5875 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:49:40 +0900 Subject: [PATCH 10/11] =?UTF-8?q?feat:=20=EA=B0=81=20API=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20story=20=EA=B5=AC=ED=98=84=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/src/stories/getFindGameIsAnswer.tsx | 35 +++++++++++++++++++ Caecae/src/stories/getFindingGame.tsx | 21 +++++++++++ .../src/stories/getFindingGameStartTime.tsx | 9 ++--- 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 Caecae/src/stories/getFindGameIsAnswer.tsx create mode 100644 Caecae/src/stories/getFindingGame.tsx diff --git a/Caecae/src/stories/getFindGameIsAnswer.tsx b/Caecae/src/stories/getFindGameIsAnswer.tsx new file mode 100644 index 0000000..e9d4780 --- /dev/null +++ b/Caecae/src/stories/getFindGameIsAnswer.tsx @@ -0,0 +1,35 @@ +import { Story } from "../shared/Hyundux-saga"; +import huynxios from "../shared/Hyunxios"; +import Response from "../utils/Response"; + +export interface GetFindFAmeIsAnswerBodyParameter { + answerList: _Position[]; +} + +export interface _Position { + positionX: number; + positionY: number; +} + +export interface getFindGameIsAnswerDTO { + correctAnswerList: CorrectAnswer[]; + ticketId: string; + startTime: number; +} +export interface CorrectAnswer { + positionX: number; + positionY: number; + descriptionImageUrl: string; + title: string; + content: string; +} + +const getFindGameStory: Story = async (object: object) => { + const response = await huynxios.post< + Response + >("/api/finding/answer", object); + console.log(response); + return response; +}; + +export { getFindGameStory }; diff --git a/Caecae/src/stories/getFindingGame.tsx b/Caecae/src/stories/getFindingGame.tsx new file mode 100644 index 0000000..a7edaa5 --- /dev/null +++ b/Caecae/src/stories/getFindingGame.tsx @@ -0,0 +1,21 @@ +import { Story } from "../shared/Hyundux-saga"; +import huynxios from "../shared/Hyunxios"; +import Response from "../utils/Response"; + +export interface FindGame { + availiable: boolean; + info: Info; +} + +export interface Info { + questionImageUrl: string; + answerType: string; +} + +const getFindGameStory: Story = async () => { + const response = await huynxios.get>("/api/finding/start"); + + return response; +}; + +export { getFindGameStory }; diff --git a/Caecae/src/stories/getFindingGameStartTime.tsx b/Caecae/src/stories/getFindingGameStartTime.tsx index e364a08..3c12014 100644 --- a/Caecae/src/stories/getFindingGameStartTime.tsx +++ b/Caecae/src/stories/getFindingGameStartTime.tsx @@ -1,10 +1,5 @@ import huynxios from "../shared/Hyunxios"; - -interface Response { - responseCode: number; - message: string; - data: Data; -} +import Response from "../utils/Response"; interface Data { findingGameInfos: FindingGameInfo[]; @@ -19,7 +14,7 @@ interface FindingGameInfo { } export default async function getFindingGameStartTime() { - const response = await huynxios.get("/api/finding/info"); + const response = await huynxios.get>("/api/finding/info"); return response; } From 800a6d84fa14e23fbac1cf6d20dcd907465c8590 Mon Sep 17 00:00:00 2001 From: pccommen Date: Thu, 15 Aug 2024 23:51:45 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20(CC-157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/src/components/FindingGame/FindingGame.tsx | 4 ++-- Caecae/src/jobs/FindingGame/FindingGameWork.tsx | 15 --------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/Caecae/src/components/FindingGame/FindingGame.tsx b/Caecae/src/components/FindingGame/FindingGame.tsx index 218d520..72add31 100644 --- a/Caecae/src/components/FindingGame/FindingGame.tsx +++ b/Caecae/src/components/FindingGame/FindingGame.tsx @@ -3,12 +3,12 @@ import { action, initFindingGameState, } from "../../jobs/FindingGame/FindingGameWork.tsx"; -import { useEffect, useRef } from "react"; +import { useEffect } from "react"; import LottieContainer from "../common/LottieContainer/index.tsx"; import correctLottie from "@assets/animationCorrect.json"; import wrongLottie from "@assets/animationIncorrect.json"; import { store, useExistState } from "../../shared/Hyundux"; -import HintSpot from "./Hint/HintSpot.tsx"; +//import HintSpot from "./Hint/HintSpot.tsx"; import SmileBadge from "../common/SmileBadge/index.tsx"; import { createStory } from "../../shared/Hyundux-saga/Story.tsx"; import useSaga from "../../shared/Hyundux-saga/useSaga.tsx"; diff --git a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx index a244e35..76ed32a 100644 --- a/Caecae/src/jobs/FindingGame/FindingGameWork.tsx +++ b/Caecae/src/jobs/FindingGame/FindingGameWork.tsx @@ -200,19 +200,4 @@ const action = { }, }; -function postionToBodyParameter() {} - -const calculateRange = ( - answerY: number, - answerX: number, - clickedY: number, - clickedX: number -) => { - return ( - Math.sqrt( - Math.pow(answerY - clickedY, 2) + Math.pow(answerX - clickedX, 2) - ) <= 100 - ); -}; - export { action, initFindingGameState, findingGameReducer };