fix: IntroPanel.new.jsx 이미지변경,선택약관 팝업 GNB닫혔을때만 작동
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
import Spotlight from "@enact/spotlight";
|
||||
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
|
||||
import Spottable from "@enact/spotlight/Spottable";
|
||||
import { $L, scaleH, scaleW } from '../../../utils/helperMethods';
|
||||
import { setDefaultFocus, setShowPopup } from "../../../actions/homeActions";
|
||||
import { setDefaultFocus, setShowPopup, fetchCurrentUserHomeTerms } from "../../../actions/homeActions";
|
||||
import { changeAppStatus } from "../../../actions/commonActions";
|
||||
import { setMyPageTermsAgree } from '../../../actions/myPageActions';
|
||||
import { pushPanel } from "../../../actions/panelActions";
|
||||
@@ -63,6 +62,7 @@ export default function HomeBanner({
|
||||
state.home.termsData?.data?.terms.find(term => term.trmsTpCd === "MST00405")
|
||||
);
|
||||
const termsLoading = useSelector((state) => state.common.termsLoading);
|
||||
const isGnbOpened = useSelector((state) => state.common.isGnbOpened);
|
||||
// 선택약관 동의여부
|
||||
const introTermsAgree = useSelector((state) => state.common.introTermsAgree);
|
||||
|
||||
@@ -73,13 +73,16 @@ export default function HomeBanner({
|
||||
|
||||
// 선택약관 팝업 표시 여부
|
||||
const shouldShowOptionalTermsPopup = useMemo(() => {
|
||||
if (termsLoading || isGnbOpened) {
|
||||
return false;
|
||||
}
|
||||
const terms = termsData?.data?.terms;
|
||||
if (!terms) {
|
||||
return false;
|
||||
}
|
||||
const optionalTerm = terms.find(term => term.trmsTpCd === "MST00405");
|
||||
return optionalTerm ? optionalTerm.trmsPopFlag === 'Y' && optionalTerm.trmsAgrFlag === 'N' : false;
|
||||
}, [termsData]);
|
||||
}, [termsData, termsLoading, isGnbOpened]);
|
||||
|
||||
const handleOptionalAgree = useCallback(() => {
|
||||
console.log('handleAgree Click');
|
||||
@@ -92,6 +95,8 @@ export default function HomeBanner({
|
||||
const callback = (response) => {
|
||||
if (response.retCode === "000" || response.retCode === 0) {
|
||||
console.log('약관 동의 성공:', response);
|
||||
// 약관 정보 갱신
|
||||
dispatch(fetchCurrentUserHomeTerms());
|
||||
} else {
|
||||
console.error('약관 동의 실패:', response);
|
||||
}
|
||||
@@ -100,7 +105,7 @@ export default function HomeBanner({
|
||||
console.log('OptionalTermsConfirm - 약관 동의 API 호출 payload:', { termsList, notTermsList });
|
||||
dispatch(setMyPageTermsAgree({ termsList, notTermsList }, callback));
|
||||
|
||||
}, []);
|
||||
}, [dispatch]);
|
||||
|
||||
const handleOptionalTermsClick = useCallback(() => {
|
||||
console.log('약관 자세히 보기 클릭');
|
||||
@@ -190,7 +195,7 @@ export default function HomeBanner({
|
||||
// console.log("App.js optionalTermsTest 팝업 표시");
|
||||
// setIsOptionalConfirmVisible(true);
|
||||
// // setIsOptionalTermsVisible(true);
|
||||
// }, 3000);
|
||||
// }, 1000);
|
||||
// }, []);
|
||||
|
||||
// 약관 동의 및 선택 약관 팝업 처리
|
||||
@@ -207,7 +212,7 @@ export default function HomeBanner({
|
||||
const timer = setTimeout(() => {
|
||||
setIsOptionalConfirmVisible(true);
|
||||
// dispatch(setShowPopup({ activePopup: "optionalTermsConfirm" }));
|
||||
}, 3000); // 3000 milliseconds = 3 seconds
|
||||
}, 1000); // 3000 milliseconds = 3 seconds
|
||||
|
||||
// 컴포넌트 언마운트 시 타이머 클리어
|
||||
return () => clearTimeout(timer);
|
||||
|
||||
Reference in New Issue
Block a user