[Log] IF-LGSP-LOG-100, 추가 시나리오 반영 (RandomUnit.jsx, RollingUnit.jsx)

This commit is contained in:
younghoon100.park
2024-07-22 16:07:31 +09:00
parent 19aa51242d
commit a9d9bd73fa
3 changed files with 225 additions and 147 deletions

View File

@@ -77,6 +77,7 @@ export default function RollingUnit({
(state) => state.home?.bannerData?.shptmTmplCd
);
const nowMenu = useSelector((state) => state.common.menu.nowMenu);
const entryMenu = useSelector((state) => state.common.menu.entryMenu);
const homeCategory = useSelector(
(state) => state.home.menuData?.data?.homeCategory
@@ -100,6 +101,31 @@ export default function RollingUnit({
const bannerDataRef = useRef(bannerData);
const rollingDataRef = useRef(rollingData);
const topContentsLogInfo = useMemo(() => {
if (curationId && curtNm) {
const currentRollingData = rollingDataRef.current[startIndex];
return {
banrNo: `${currentRollingData?.banrDpOrd}`,
banrTpNm: currentRollingData?.vtctpYn
? currentRollingData.vtctpYn === "Y"
? "Vertical"
: "Horizontal"
: "",
contId: curationId,
contNm: curtNm,
contTpNm: currentRollingData?.shptmBanrTpNm ?? "",
dspyTpNm: bannerDataRef.current?.shptmDspyTpNm ?? "",
expsOrd: bannerDataRef.current?.banrLctnNo ?? "",
linkTpCd: "",
patncNm: currentRollingData?.patncNm ?? "",
patnrId: currentRollingData?.patnrId ?? "",
tmplCd: shptmTmplCd,
};
}
return {};
}, [curationId, curtNm, shptmTmplCd, startIndex]);
useEffect(() => {
if (savedIndex !== undefined) {
setStartIndex(savedIndex);
@@ -251,6 +277,13 @@ export default function RollingUnit({
if (bannerType === "Today's Deals") {
handlePushPanel(panel_names.DETAIL_PANEL, createPanelInfo(currentData));
dispatch(
sendLogTopContents({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
})
);
return;
}
@@ -310,6 +343,14 @@ export default function RollingUnit({
default:
return;
}
dispatch(
sendLogTopContents({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
})
);
}, [
rollingData,
startIndex,
@@ -317,6 +358,7 @@ export default function RollingUnit({
dispatch,
categoryData,
handlePushPanel,
topContentsLogInfo,
]);
const videoClick = useCallback(() => {
@@ -337,7 +379,22 @@ export default function RollingUnit({
modalContainerId: null,
modalClassName: css.videoModal,
});
}, [rollingData, startIndex, bannerId, dispatch, handleStartVideoPlayer]);
dispatch(
sendLogTopContents({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
})
);
}, [
rollingData,
startIndex,
bannerId,
dispatch,
handleStartVideoPlayer,
topContentsLogInfo,
]);
// 10초 롤링
useEffect(() => {
@@ -358,32 +415,16 @@ export default function RollingUnit({
}, [rollingDataLength, rollingFocus, animate]);
useEffect(() => {
if (
bannerDataRef.current &&
rollingDataRef.current &&
nowMenu &&
nowMenu === LOG_MENU.HOME_TOP
) {
const currentRollingData = rollingDataRef.current[startIndex];
let _nowMenu = nowMenu;
let _entryMenu = entryMenu;
if (nowMenu === LOG_MENU.HOME_TOP) {
const params = {
banrNo: `${currentRollingData?.banrDpOrd}`,
banrTpNm: currentRollingData?.vtctpYn
? currentRollingData.vtctpYn === "Y"
? "Vertical"
: "Horizontal"
: "",
contId: curationId ?? "",
contNm: curtNm ?? "",
contTpNm: currentRollingData?.shptmBanrTpNm ?? "",
dspyTpNm: bannerDataRef.current?.shptmDspyTpNm ?? "",
expsOrd: bannerDataRef.current?.banrLctnNo ?? "",
inDt: formatGMTString(new Date()),
linkTpCd: "",
...topContentsLogInfo,
entryMenu: _entryMenu,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.VIEW,
patncNm: currentRollingData?.patncNm ?? "",
patnrId: currentRollingData?.patnrId ?? "",
tmplCd: shptmTmplCd,
nowMenu: _nowMenu,
};
return () => {
@@ -393,7 +434,7 @@ export default function RollingUnit({
}
};
}
}, [curationId, curtNm, nowMenu, shptmTmplCd, startIndex]);
}, [dispatch, entryMenu, nowMenu, startIndex, topContentsLogInfo]);
useEffect(() => {
if (nowMenu !== LOG_MENU.HOME_TOP) {