통합로그 피드백 : shelf_shown, shelf_click 관련 수정
This commit is contained in:
@@ -119,7 +119,6 @@ export default memo(function TItemCard({
|
||||
|
||||
if (onClick) {
|
||||
onClick(e);
|
||||
|
||||
if (contextName && messageId) {
|
||||
const params = {
|
||||
contextName: contextName,
|
||||
@@ -142,7 +141,7 @@ export default memo(function TItemCard({
|
||||
curationId: curationId,
|
||||
curationTitle: curationTitle,
|
||||
};
|
||||
|
||||
console.log("###shelfContentClick", params);
|
||||
dispatch(sendLogTotalRecommend(params));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { memo, useCallback } from "react";
|
||||
import React, { memo, useCallback, useState, useRef } from "react";
|
||||
|
||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
||||
|
||||
import SectionTitle from "../../../components/SectionTitle/SectionTitle";
|
||||
import css from "./OnSaleContents.module.less";
|
||||
import OnSaleProductList from "./OnSaleProductList/OnSaleProductList";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { sendLogTotalRecommend } from "../../../actions/logActions";
|
||||
import { LOG_CONTEXT_NAME, LOG_MESSAGE_ID } from "../../../utils/Config";
|
||||
|
||||
@@ -23,10 +23,14 @@ export default memo(function OnSaleContents({
|
||||
selectedLgCatCd,
|
||||
selectedLgCatNm,
|
||||
shelfOrder,
|
||||
onShelfFocus,
|
||||
}) {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const onFocus = useCallback(() => {
|
||||
// 부모 컴포넌트에서 shelf 포커스
|
||||
const shouldDispatch = onShelfFocus ? onShelfFocus(shelfOrder) : true;
|
||||
if (shouldDispatch) {
|
||||
const params = {
|
||||
contextName: LOG_CONTEXT_NAME.ON_SALE,
|
||||
messageId: LOG_MESSAGE_ID.SHELF,
|
||||
@@ -35,8 +39,17 @@ export default memo(function OnSaleContents({
|
||||
shelfId: selectedLgCatCd,
|
||||
shelfTitle: saleNm,
|
||||
};
|
||||
console.log("###shelfListShown", params);
|
||||
dispatch(sendLogTotalRecommend(params));
|
||||
}, [selectedLgCatNm, shelfOrder, selectedLgCatCd, saleNm]);
|
||||
}
|
||||
}, [
|
||||
shelfOrder,
|
||||
selectedLgCatNm,
|
||||
selectedLgCatCd,
|
||||
saleNm,
|
||||
dispatch,
|
||||
onShelfFocus,
|
||||
]);
|
||||
|
||||
return (
|
||||
<Container
|
||||
|
||||
@@ -179,7 +179,7 @@ export default function OnSaleProductList({
|
||||
category={selectedLgCatNm}
|
||||
patnerName={patncNm}
|
||||
brandName={brndNm}
|
||||
order={contentsIndex + 1}
|
||||
order={index + 1}
|
||||
className={css.tItemCard}
|
||||
data-lg-category-code={lgCatCd}
|
||||
data-exposure-order={contentsIndex + 1}
|
||||
@@ -196,7 +196,15 @@ export default function OnSaleProductList({
|
||||
/>
|
||||
);
|
||||
},
|
||||
[contentsIndex, handleClick, saleProductInfos]
|
||||
[
|
||||
contentsIndex,
|
||||
handleClick,
|
||||
saleProductInfos,
|
||||
selectedLgCatNm,
|
||||
shelfOrder,
|
||||
shelfTitle,
|
||||
spotlightId,
|
||||
]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -53,6 +53,7 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
|
||||
const [selectedLgCatCd, setSelectedLgCatCd] = useState();
|
||||
const [selectedLgCatNm, setSelectedLgCatNm] = useState();
|
||||
const [spotlightDisabled, setSpotlightDisabled] = useState(true);
|
||||
const [currentFocusedShelf, setCurrentFocusedShelf] = useState(null);
|
||||
|
||||
const enteredThroughEventPopup = Object.keys(panelInfo).length === 1;
|
||||
const enteredThroughGNB = Object.keys(panelInfo).length === 0;
|
||||
@@ -300,6 +301,18 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleShelfFocus = useCallback(
|
||||
(shelfOrder) => {
|
||||
// 현재 포커스된 shelf와 다른 shelf에 포커스될 때만 true 반환
|
||||
if (currentFocusedShelf !== shelfOrder) {
|
||||
setCurrentFocusedShelf(shelfOrder);
|
||||
return true; // dispatch 해야 함
|
||||
}
|
||||
return false; // dispatch 하지 않음
|
||||
},
|
||||
[currentFocusedShelf]
|
||||
);
|
||||
|
||||
const handleCancel = useCallback(
|
||||
(e) => {
|
||||
if (panelInfo.nowShelf) {
|
||||
@@ -372,6 +385,7 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
|
||||
saleProductInfos={saleProductInfos}
|
||||
selectedLgCatCd={selectedLgCatCd}
|
||||
selectedLgCatNm={selectedLgCatNm}
|
||||
onShelfFocus={handleShelfFocus}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user