From 98f3b83001da72ba8020cb7ff4287d458b6bc231 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 13:14:36 +0900 Subject: [PATCH 01/13] remove console.log --- service/src/pages/joinEvent/JoinEventIntroMain.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/service/src/pages/joinEvent/JoinEventIntroMain.jsx b/service/src/pages/joinEvent/JoinEventIntroMain.jsx index df36839..b14868b 100644 --- a/service/src/pages/joinEvent/JoinEventIntroMain.jsx +++ b/service/src/pages/joinEvent/JoinEventIntroMain.jsx @@ -23,7 +23,6 @@ function JoinEventIntroMain() { const getData = async () => { try { const response = await getScenario(); - console.log(response); const { day, commonScenario } = response; setDay(day); setScenario(commonScenario); From 87612bf701bbbc4dd4b3b4680754b06cd465962d Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 14:15:01 +0900 Subject: [PATCH 02/13] yarn changed --- service/yarn.lock | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/service/yarn.lock b/service/yarn.lock index d01cd39..3f5fdc4 100644 --- a/service/yarn.lock +++ b/service/yarn.lock @@ -4434,8 +4434,16 @@ stop-iteration-iterator@^1.0.0: dependencies: internal-slot "^1.0.4" -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4515,8 +4523,14 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: - name strip-ansi-cjs +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== From e7bdaf3b8a0b732f8de7d339b536b554f0b6666a Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 14:15:13 +0900 Subject: [PATCH 03/13] =?UTF-8?q?=EB=93=9C=EB=9E=98=EA=B7=B8=20=EC=8B=9C?= =?UTF-8?q?=20=ED=8C=8C=EB=9E=80=EC=83=89=EC=9C=BC=EB=A1=9C=20=EC=B9=A0?= =?UTF-8?q?=ED=95=B4=EC=A7=80=EB=8A=94=20=EA=B1=B0=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/src/App.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/App.jsx b/service/src/App.jsx index e5f626a..4054834 100644 --- a/service/src/App.jsx +++ b/service/src/App.jsx @@ -39,7 +39,8 @@ function App() { return ( -
+ {/* 드레그 시 파란색으로 칠해지는 거 방지 */} +
{!hideHeader &&
} From df164bd7ea80c85437373deb92cb6a61ce61d047 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 14:16:27 +0900 Subject: [PATCH 04/13] change carousel smoothly --- .../src/pages/newCarIntro/NewCarCarousel.jsx | 34 +++++++++++-------- .../src/pages/newCarIntro/NewCarDetail.jsx | 12 +++++-- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/service/src/pages/newCarIntro/NewCarCarousel.jsx b/service/src/pages/newCarIntro/NewCarCarousel.jsx index 69929e0..5d4ad18 100644 --- a/service/src/pages/newCarIntro/NewCarCarousel.jsx +++ b/service/src/pages/newCarIntro/NewCarCarousel.jsx @@ -16,26 +16,32 @@ function NewCarCarousel() { return positions[(index - currentIndex + totalItems) % totalItems]; }; - const handlePrevButton = () => { + const handleCarousel = direction => { if (isButtonDisabled) return; setIsButtonDisabled(true); - setCurrentIndex(prevIndex => (prevIndex + (totalItems - 1)) % totalItems); + setCurrentIndex( + prevIndex => (prevIndex + (totalItems + direction)) % totalItems, + ); setTimeout(() => { setIsButtonDisabled(false); }, 250); }; - const handleNextButton = () => { + const moveToIndex = async targetIndex => { if (isButtonDisabled) return; setIsButtonDisabled(true); - setCurrentIndex(prevIndex => (prevIndex + 1) % totalItems); - setTimeout(() => { - setIsButtonDisabled(false); - }, 250); - }; - const handleIndicatorClick = idx => { - setCurrentIndex(idx); + let diff = targetIndex - currentIndex; + if (diff >= 3) diff = -5 + diff; + else if (diff <= -3) diff = 5 + diff; + + const direction = Math.sign(diff); + for (let i = 0; i < Math.abs(diff); i++) { + handleCarousel(direction); + await new Promise(resolve => setTimeout(resolve, 250)); + } + + setIsButtonDisabled(false); }; return ( @@ -72,7 +78,7 @@ function NewCarCarousel() { src={item.imageSrc} alt={`Car Image ${item.id}`} className="object-cover w-full h-full" - onClick={() => setCurrentIndex(idx)} + onClick={() => moveToIndex(idx)} />
))} @@ -84,7 +90,7 @@ function NewCarCarousel() {
handleIndicatorClick(idx)} + onClick={() => moveToIndex(idx)} >
))}
@@ -92,13 +98,13 @@ function NewCarCarousel() { Previous Slide handleCarousel(-1)} className="hover:cursor-pointer" /> Next Slide handleCarousel(1)} className="hover:cursor-pointer" /> diff --git a/service/src/pages/newCarIntro/NewCarDetail.jsx b/service/src/pages/newCarIntro/NewCarDetail.jsx index 0adcf36..6390a0c 100644 --- a/service/src/pages/newCarIntro/NewCarDetail.jsx +++ b/service/src/pages/newCarIntro/NewCarDetail.jsx @@ -1,10 +1,17 @@ import React from 'react'; import NewCarDetailBox from '@/pages/newCarIntro/NewCarDetailBox'; import newCarDetailData from '@/constants/newCarIntro/newCarDetailData'; +import { animationVariants } from '@/styles/FramerMotion'; +import { motion } from 'framer-motion'; function NewCarDetail() { return ( - <> +
@@ -21,12 +28,13 @@ function NewCarDetail() {
(15인치 알로이 휠, 인스퍼레이션 트림 기준)
+
{newCarDetailData.map(item => ( ))}
- + ); } From ea967d11d18333f3edd629d03311d3323f78b759 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 14:28:44 +0900 Subject: [PATCH 05/13] add alt in img tag --- service/src/constants/newCarIntro/newCarDetailData.jsx | 6 ++++++ service/src/pages/newCarIntro/NewCarDetailBox.jsx | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/service/src/constants/newCarIntro/newCarDetailData.jsx b/service/src/constants/newCarIntro/newCarDetailData.jsx index c21f722..66b5076 100644 --- a/service/src/constants/newCarIntro/newCarDetailData.jsx +++ b/service/src/constants/newCarIntro/newCarDetailData.jsx @@ -10,36 +10,42 @@ const newCarDetailData = [ id: 1, title: '실내/외 V2L (Vehicle to Load)', description: '야외/실내에서 자유로운 전자기기 사용', + alt: '캐스퍼 차량의 실내외에서 V2L을 활용하여 전자기기를 사용하는 모습', imageSrc: image1, }, { id: 2, title: '넓은 2열 공간', description: '길어진 휠 베이스', + alt: '캐스퍼의 넓어진 2열 공간을 보여주는 이미지', imageSrc: image2, }, { id: 3, title: '클러스터 & 내비게이션', description: '더 커진 10.25인치 화면', + alt: '캐스퍼의 10.25인치 화면 클러스터와 내비게이션 이미지', imageSrc: image3, }, { id: 4, title: '고속도로 주행 보조', description: '장거리 고속도로 운전도 편안하게', + alt: '캐스퍼의 고속도로 주행 보조 기능을 설명하는 이미지', imageSrc: image4, }, { id: 5, title: '서라운드 뷰 모니터', description: '좁은 길을 지날 때, 주차할 때', + alt: '캐스퍼의 서라운드 뷰 모니터를 활용하는 모습', imageSrc: image5, }, { id: 6, title: '스마트폰 무선 충전', description: 'USB 연결 없이', + alt: '캐스퍼 차량에서 스마트폰을 무선으로 충전하는 장면', imageSrc: image6, }, ]; diff --git a/service/src/pages/newCarIntro/NewCarDetailBox.jsx b/service/src/pages/newCarIntro/NewCarDetailBox.jsx index 529a1f0..8e93768 100644 --- a/service/src/pages/newCarIntro/NewCarDetailBox.jsx +++ b/service/src/pages/newCarIntro/NewCarDetailBox.jsx @@ -2,10 +2,15 @@ import React from 'react'; import PropTypes from 'prop-types'; function NewCarDetailBox({ details }) { - const { title, description, imageSrc } = details; + const { title, description, imageSrc, alt } = details; return (
- + {alt}
{title}
{description} @@ -18,6 +23,7 @@ NewCarDetailBox.propTypes = { details: PropTypes.shape({ title: PropTypes.string.isRequired, description: PropTypes.string.isRequired, + alt: PropTypes.string.isRequired, imageSrc: PropTypes.string.isRequired, }).isRequired, }; From 49fc3880fecd8191911e699a17f3a3cff58e0af9 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 15:12:12 +0900 Subject: [PATCH 06/13] change noQuizMain ment --- service/src/pages/miniquiz/NoQuizMain.jsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/service/src/pages/miniquiz/NoQuizMain.jsx b/service/src/pages/miniquiz/NoQuizMain.jsx index 194f739..888df9a 100644 --- a/service/src/pages/miniquiz/NoQuizMain.jsx +++ b/service/src/pages/miniquiz/NoQuizMain.jsx @@ -1,18 +1,16 @@ -import React, { useCallback } from 'react'; +import React from 'react'; import WhiteButton from '@/components/buttons/WhiteButton'; import { useNavigate } from 'react-router-dom'; function NoQuizMain() { - const navigate = useNavigate(); //useNavigate은 리렌더링 시에는 재생성이 되지 않음 그렇기에 useCallback 안 씀 + const navigate = useNavigate(); - const handleExit = useCallback(() => { - navigate('/event'); - }, []); + const handleExit = () => navigate('/event'); //navigate는 동일한 주소를 가지므로 useCallback을 사용할 이유가 없음 return (
- 퀴즈 정보가 없습니다. + 12시부터 13까지는 퀴즈 준비시간입니다!!!
이벤트 페이지로 돌아가시겠습니까??? From dac7c01d09151ced30d9b9f4d7d7b07a267e0ef9 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 16:02:49 +0900 Subject: [PATCH 07/13] =?UTF-8?q?add=20caution=2012~13=EB=8A=94=20?= =?UTF-8?q?=ED=80=B4=EC=A6=88=20=EC=B0=B8=EC=97=AC=20=EB=B6=88=EA=B0=80?= =?UTF-8?q?=ED=95=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/src/pages/joinEvent/MiniQuiz.jsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/service/src/pages/joinEvent/MiniQuiz.jsx b/service/src/pages/joinEvent/MiniQuiz.jsx index 7a2ca8a..972be49 100644 --- a/service/src/pages/joinEvent/MiniQuiz.jsx +++ b/service/src/pages/joinEvent/MiniQuiz.jsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import BlueButton from '@/components/buttons/BlueButton'; import miniQuizIntro1 from '@/assets/images/miniQuizIntro1.svg'; import miniQuizIntro2 from '@/assets/images/miniQuizIntro2.svg'; @@ -51,10 +51,6 @@ function MiniQuiz() { } }, [countDownStart]); - const gotoMiniQuiz = useCallback(() => { - navigate('/event/miniQuiz'); - }, []); - return (
@@ -75,7 +71,7 @@ function MiniQuiz() { miniQuizIntro3
-
+
Event2. 툴박스 얻기 @@ -90,14 +86,16 @@ function MiniQuiz() {
-
+
{`월드컵에서 알 수 있는 캐스퍼 EV에 대한 일일 미니 퀴즈를 맞추고 툴박스 아이템을 받아요. 툴박스 아이템은 응모에 한번 참여하면 사라져요.`}
+
+ *12시부터 13시까지는 퀴즈 준비시간으로 퀴즈 참여가 불가능합니다. +
navigate('/event/miniQuiz')} styles="px-2000 py-400 text-detail-2-medium" />
From ea04abc79d4f5beb52ebb99159f67be06bb4a1de Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 16:17:02 +0900 Subject: [PATCH 08/13] =?UTF-8?q?useEffect=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=8F=20=EB=B3=80=EC=88=98=EB=AA=85=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/components/header/AdminHeader.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/admin/src/components/header/AdminHeader.jsx b/admin/src/components/header/AdminHeader.jsx index ef7ee77..fe10db3 100644 --- a/admin/src/components/header/AdminHeader.jsx +++ b/admin/src/components/header/AdminHeader.jsx @@ -32,6 +32,9 @@ function AdminHeader() { } else { navigate('/login'); } + }, []); + + useEffect(() => { const getDate = async () => { const response = await getEventSchedules(); if (response.code === 'UNAUTHORIZED') { @@ -55,8 +58,7 @@ function AdminHeader() { if (!isPreviousDayDisabled) { const previousDay = new Date(dateInfo); previousDay.setDate(previousDay.getDate() - 1); - const pathSegments = location.pathname.split('/'); - const tabName = pathSegments[2]; + const [, , tabName] = location.pathname.split('/'); navigate( `/${dateFormatting(previousDay)}${tabName !== undefined ? `/${tabName}` : ''}`, ); @@ -67,8 +69,7 @@ function AdminHeader() { if (!isNextDayDisabled) { const nextDay = new Date(dateInfo); nextDay.setDate(nextDay.getDate() + 1); - const pathSegments = location.pathname.split('/'); - const tabName = pathSegments[2]; + const [, , tabName] = location.pathname.split('/'); navigate( `/${dateFormatting(nextDay)}${tabName !== undefined ? `/${tabName}` : ''}`, ); From 8cb1d0bb558a6fa04cd026ac0c99a0c38b7f3a5a Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 16:34:44 +0900 Subject: [PATCH 09/13] remove useCallback that is not useful --- service/src/components/modal/AlreadyGetCarModal.jsx | 6 ++---- service/src/components/modal/ExitModal.jsx | 6 +++--- service/src/components/modal/GetItemModal.jsx | 6 +++--- service/src/pages/joinEvent/CarCard.jsx | 6 +++--- service/src/pages/joinEvent/ToolBoxCard.jsx | 6 +++--- service/src/pages/joinEvent/WorldCup.jsx | 7 ++++--- service/src/pages/miniquiz/LoadingQuiz.jsx | 5 +++-- service/src/pages/miniquiz/MiniQuizResultMain.jsx | 4 ++-- service/src/pages/miniquiz/NoQuizMain.jsx | 13 +++++++++++-- 9 files changed, 34 insertions(+), 25 deletions(-) diff --git a/service/src/components/modal/AlreadyGetCarModal.jsx b/service/src/components/modal/AlreadyGetCarModal.jsx index a63f68a..43f1e1e 100644 --- a/service/src/components/modal/AlreadyGetCarModal.jsx +++ b/service/src/components/modal/AlreadyGetCarModal.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useCallback } from 'react'; +import React, { useContext } from 'react'; import BlueButton from '@/components/buttons/BlueButton'; import { AuthContext } from '@/context/authContext'; import { useNavigate } from 'react-router-dom'; @@ -11,9 +11,7 @@ function AlreadyGetCarModal({ close }) { const { userInfo, setUserInfo } = useContext(AuthContext); const navigate = useNavigate(); - const handleExit = useCallback(() => { - navigate('/event'); - }, [navigate]); + const handleExit = () => navigate('/event'); return ( { + const gotoBack = () => { if (game === 'worldCup') { navigate(`/event`, { state: { scrollTo: 'worldCup' } }); } else { navigate(`/event`, { state: { scrollTo: 'miniQuiz' } }); } - }, []); + }; return (
diff --git a/service/src/components/modal/GetItemModal.jsx b/service/src/components/modal/GetItemModal.jsx index 5a3df36..0e635d3 100644 --- a/service/src/components/modal/GetItemModal.jsx +++ b/service/src/components/modal/GetItemModal.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useCallback } from 'react'; +import React, { useContext } from 'react'; import BlueButton from '@/components/buttons/BlueButton'; import getCarModalImage from '@/assets/images/getCarModalImage.svg'; import getItemModalImage from '@/assets/images/getItemModalImage.svg'; @@ -13,7 +13,7 @@ function GetItemModal({ close, item }) { const { toolBoxCnt } = userInfo; const navigate = useNavigate(); - const handleParticipants = useCallback(async () => { + const handleParticipants = async () => { try { if (item === '자동차 아이템') { const result = await postParticipants(); @@ -29,7 +29,7 @@ function GetItemModal({ close, item }) { } catch (error) { console.error('WorldCup 참여 등록 API 통신 실패:', error); } - }, [navigate]); + }; return (
diff --git a/service/src/pages/joinEvent/CarCard.jsx b/service/src/pages/joinEvent/CarCard.jsx index 5b6ea86..132eaab 100644 --- a/service/src/pages/joinEvent/CarCard.jsx +++ b/service/src/pages/joinEvent/CarCard.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useCallback } from 'react'; +import React, { useContext } from 'react'; import noCarImage from '@/assets/images/noCarImage.svg'; import carImage from '@/assets/images/carImage.svg'; import BlueButton from '@/components/buttons/BlueButton'; @@ -10,9 +10,9 @@ function CarCard() { const { userInfo } = useContext(AuthContext); const navigate = useNavigate(); - const gotoWorldCup = useCallback(() => { + const gotoWorldCup = () => { navigate('/event/worldCup'); - }, []); + }; return (
diff --git a/service/src/pages/joinEvent/ToolBoxCard.jsx b/service/src/pages/joinEvent/ToolBoxCard.jsx index 247597a..f8a5627 100644 --- a/service/src/pages/joinEvent/ToolBoxCard.jsx +++ b/service/src/pages/joinEvent/ToolBoxCard.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useCallback } from 'react'; +import React, { useContext } from 'react'; import BlueButton from '@/components/buttons/BlueButton'; import noToolBoxImage from '@/assets/images/noToolBoxImage.svg'; import toolBoxImage from '@/assets/images/toolBoxImage.svg'; @@ -10,9 +10,9 @@ function ToolBoxCard() { const navigate = useNavigate(); const { userInfo } = useContext(AuthContext); - const gotoMiniQuiz = useCallback(() => { + const gotoMiniQuiz = () => { navigate('/event/miniQuiz'); - }, []); + }; return (
diff --git a/service/src/pages/joinEvent/WorldCup.jsx b/service/src/pages/joinEvent/WorldCup.jsx index 6563a50..b4a44bd 100644 --- a/service/src/pages/joinEvent/WorldCup.jsx +++ b/service/src/pages/joinEvent/WorldCup.jsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react'; +import React from 'react'; import BlueButton from '@/components/buttons/BlueButton'; import worldCupIntro1 from '@/assets/images/worldCupIntro1.svg'; import worldCupIntro2 from '@/assets/images/worldCupIntro2.svg'; @@ -8,9 +8,10 @@ import { useNavigate } from 'react-router-dom'; function WorldCup() { const navigate = useNavigate(); - const gotoWorldCup = useCallback(() => { + const gotoWorldCup = () => { navigate('/event/worldCup'); - }, []); + }; + return ( <>
diff --git a/service/src/pages/miniquiz/LoadingQuiz.jsx b/service/src/pages/miniquiz/LoadingQuiz.jsx index 588af3b..e0eb906 100644 --- a/service/src/pages/miniquiz/LoadingQuiz.jsx +++ b/service/src/pages/miniquiz/LoadingQuiz.jsx @@ -5,9 +5,10 @@ import { useNavigate } from 'react-router-dom'; function LoadingQuiz() { const navigate = useNavigate(); - const handleExit = useCallback(() => { + + const handleExit = () => { navigate('/event'); - }, [navigate]); + }; const handleRefresh = useCallback(() => { window.location.reload(); diff --git a/service/src/pages/miniquiz/MiniQuizResultMain.jsx b/service/src/pages/miniquiz/MiniQuizResultMain.jsx index d6a96cf..769d553 100644 --- a/service/src/pages/miniquiz/MiniQuizResultMain.jsx +++ b/service/src/pages/miniquiz/MiniQuizResultMain.jsx @@ -29,9 +29,9 @@ function MiniQuizResultMain({ response }) { check(); }, []); - const handleExit = useCallback(() => { + const handleExit = () => { navigate('/event', { state: { scrollTo: 'miniQuiz' } }); - }, []); + }; const closeToolBoxModal = useCallback(() => { setToolBoxModal(false); diff --git a/service/src/pages/miniquiz/NoQuizMain.jsx b/service/src/pages/miniquiz/NoQuizMain.jsx index 888df9a..e92c172 100644 --- a/service/src/pages/miniquiz/NoQuizMain.jsx +++ b/service/src/pages/miniquiz/NoQuizMain.jsx @@ -1,11 +1,20 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import WhiteButton from '@/components/buttons/WhiteButton'; import { useNavigate } from 'react-router-dom'; function NoQuizMain() { const navigate = useNavigate(); + //useNavigate는 훅이기에 랜더링될 때 navigate의 레퍼런스가 바뀜 + //따라서 useCallback으로 선언해서 의존성을 넣는 것은 child의 재렌더링을 방지할 수 없음 + /* const navigateRef = useRef(navigate); + * + *const handleExit = useCallback(() => { + * navigateRef.current('/some-path'); + *}, []); + */ + //이런 식으로 하면 되긴 하지만 이 페이지에서는 불필요한 최적화임 - const handleExit = () => navigate('/event'); //navigate는 동일한 주소를 가지므로 useCallback을 사용할 이유가 없음 + const handleExit = () => navigate('/event'); return (
From 679c3770d8f4a7d6a41211d8efef5479beb77695 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 16:37:10 +0900 Subject: [PATCH 10/13] =?UTF-8?q?changed=20link=20=EC=82=AC=EC=A0=84=20?= =?UTF-8?q?=EA=B3=84=EC=95=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/src/utils/linkToFunc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/utils/linkToFunc.js b/service/src/utils/linkToFunc.js index f8d8990..ce4b7b2 100644 --- a/service/src/utils/linkToFunc.js +++ b/service/src/utils/linkToFunc.js @@ -3,5 +3,5 @@ export const linkToFreeRide = () => { }; export const linkToPreOrder = () => { - window.open('https://casper.hyundai.com/vehicles/test-driving/intro'); + window.open('https://casper.hyundai.com/vehicles/electric/making/model'); }; From 3d3b79b21fc34885b6e5a3cb92c5351e2290fea1 Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 17:53:06 +0900 Subject: [PATCH 11/13] change admin index.html --- admin/index.html | 6 +++--- admin/public/hyundai.svg | 1 + admin/public/vite.svg | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 admin/public/hyundai.svg delete mode 100644 admin/public/vite.svg diff --git a/admin/index.html b/admin/index.html index 07bccad..6363644 100644 --- a/admin/index.html +++ b/admin/index.html @@ -1,14 +1,14 @@ - + - + - Vite + React + 현대 캐스퍼 관리자
diff --git a/admin/public/hyundai.svg b/admin/public/hyundai.svg new file mode 100644 index 0000000..beaae62 --- /dev/null +++ b/admin/public/hyundai.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/public/vite.svg b/admin/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/admin/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 81beb754bed5cb8da16e5c350d7a9967b1f1ef7d Mon Sep 17 00:00:00 2001 From: yoonc01 Date: Wed, 21 Aug 2024 17:53:36 +0900 Subject: [PATCH 12/13] =?UTF-8?q?reward=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20number=EB=A1=9C=20=EB=B3=B4=EB=82=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/components/form/InputForm.jsx | 4 ++-- admin/src/pages/reward/Reward.jsx | 7 ++++++- admin/src/pages/reward/RewardContent.jsx | 8 ++++---- service/vite.config.js | 2 -- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/admin/src/components/form/InputForm.jsx b/admin/src/components/form/InputForm.jsx index 010fc1e..f95f278 100644 --- a/admin/src/components/form/InputForm.jsx +++ b/admin/src/components/form/InputForm.jsx @@ -24,8 +24,8 @@ function InputForm({ label, id, placeholder, value, onChange }) { InputForm.propTypes = { label: PropTypes.string.isRequired, id: PropTypes.string.isRequired, - placeholder: PropTypes.string, - value: PropTypes.string.isRequired, + placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), onChange: PropTypes.func.isRequired, }; diff --git a/admin/src/pages/reward/Reward.jsx b/admin/src/pages/reward/Reward.jsx index b503631..7088962 100644 --- a/admin/src/pages/reward/Reward.jsx +++ b/admin/src/pages/reward/Reward.jsx @@ -39,14 +39,19 @@ function Reward() { const handleChange = (index, field, value) => { setModified(true); + + const newValue = + field === 'ranking' || field === 'stock' ? Number(value) : value; + setRewardData(prevState => prevState.map((item, i) => - i === index ? { ...item, [field]: value } : item, + i === index ? { ...item, [field]: newValue } : item, ), ); }; const handleSubmit = async () => { + console.log(rewardData); const formData = createFormData(rewardData); try { const response = await putAdminReward(formData); diff --git a/admin/src/pages/reward/RewardContent.jsx b/admin/src/pages/reward/RewardContent.jsx index 1ee2314..91542eb 100644 --- a/admin/src/pages/reward/RewardContent.jsx +++ b/admin/src/pages/reward/RewardContent.jsx @@ -22,8 +22,8 @@ function RewardContent({ response, onChange }) { handleInputChange(index, 'ranking', value)} /> handleInputChange(index, 'stock', value)} /> Date: Wed, 21 Aug 2024 18:11:33 +0900 Subject: [PATCH 13/13] =?UTF-8?q?select-none=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/src/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/App.jsx b/service/src/App.jsx index 5236c8b..247f0f0 100644 --- a/service/src/App.jsx +++ b/service/src/App.jsx @@ -37,7 +37,7 @@ function App() { ); return ( -
+
{!hideHeader &&
}