통합로그 피드백 : shelf_shown, shelf_click 관련 수정

This commit is contained in:
opacity@t-win.kr
2025-09-03 17:19:15 +09:00
parent 6def95216f
commit bad391e73c
4 changed files with 52 additions and 18 deletions

View File

@@ -119,7 +119,6 @@ export default memo(function TItemCard({
if (onClick) { if (onClick) {
onClick(e); onClick(e);
if (contextName && messageId) { if (contextName && messageId) {
const params = { const params = {
contextName: contextName, contextName: contextName,
@@ -142,7 +141,7 @@ export default memo(function TItemCard({
curationId: curationId, curationId: curationId,
curationTitle: curationTitle, curationTitle: curationTitle,
}; };
console.log("###shelfContentClick", params);
dispatch(sendLogTotalRecommend(params)); dispatch(sendLogTotalRecommend(params));
} }
} }
@@ -173,8 +172,8 @@ export default memo(function TItemCard({
? " " + offerInfo ? " " + offerInfo
: "" : ""
: originalPrice : originalPrice
? " Original price " + originalPrice + ", " ? " Original price " + originalPrice + ", "
: ""; : "";
const lastLabeltext = lastLabel ? lastLabel : ""; const lastLabeltext = lastLabel ? lastLabel : "";
const firstLabeltext = firstLabel ? firstLabel + " " : ""; const firstLabeltext = firstLabel ? firstLabel + " " : "";
const soldOutText = soldoutFlag === "Y" ? "Sold Out " : ""; const soldOutText = soldoutFlag === "Y" ? "Sold Out " : "";

View File

@@ -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 SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import SectionTitle from "../../../components/SectionTitle/SectionTitle"; import SectionTitle from "../../../components/SectionTitle/SectionTitle";
import css from "./OnSaleContents.module.less"; import css from "./OnSaleContents.module.less";
import OnSaleProductList from "./OnSaleProductList/OnSaleProductList"; import OnSaleProductList from "./OnSaleProductList/OnSaleProductList";
import { useDispatch } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { sendLogTotalRecommend } from "../../../actions/logActions"; import { sendLogTotalRecommend } from "../../../actions/logActions";
import { LOG_CONTEXT_NAME, LOG_MESSAGE_ID } from "../../../utils/Config"; import { LOG_CONTEXT_NAME, LOG_MESSAGE_ID } from "../../../utils/Config";
@@ -23,20 +23,33 @@ export default memo(function OnSaleContents({
selectedLgCatCd, selectedLgCatCd,
selectedLgCatNm, selectedLgCatNm,
shelfOrder, shelfOrder,
onShelfFocus,
}) { }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const onFocus = useCallback(() => { const onFocus = useCallback(() => {
const params = { // 부모 컴포넌트에서 shelf 포커스
contextName: LOG_CONTEXT_NAME.ON_SALE, const shouldDispatch = onShelfFocus ? onShelfFocus(shelfOrder) : true;
messageId: LOG_MESSAGE_ID.SHELF, if (shouldDispatch) {
category: selectedLgCatNm, const params = {
shelfLocation: shelfOrder, contextName: LOG_CONTEXT_NAME.ON_SALE,
shelfId: selectedLgCatCd, messageId: LOG_MESSAGE_ID.SHELF,
shelfTitle: saleNm, category: selectedLgCatNm,
}; shelfLocation: shelfOrder,
dispatch(sendLogTotalRecommend(params)); shelfId: selectedLgCatCd,
}, [selectedLgCatNm, shelfOrder, selectedLgCatCd, saleNm]); shelfTitle: saleNm,
};
console.log("###shelfListShown", params);
dispatch(sendLogTotalRecommend(params));
}
}, [
shelfOrder,
selectedLgCatNm,
selectedLgCatCd,
saleNm,
dispatch,
onShelfFocus,
]);
return ( return (
<Container <Container

View File

@@ -179,7 +179,7 @@ export default function OnSaleProductList({
category={selectedLgCatNm} category={selectedLgCatNm}
patnerName={patncNm} patnerName={patncNm}
brandName={brndNm} brandName={brndNm}
order={contentsIndex + 1} order={index + 1}
className={css.tItemCard} className={css.tItemCard}
data-lg-category-code={lgCatCd} data-lg-category-code={lgCatCd}
data-exposure-order={contentsIndex + 1} data-exposure-order={contentsIndex + 1}
@@ -196,7 +196,15 @@ export default function OnSaleProductList({
/> />
); );
}, },
[contentsIndex, handleClick, saleProductInfos] [
contentsIndex,
handleClick,
saleProductInfos,
selectedLgCatNm,
shelfOrder,
shelfTitle,
spotlightId,
]
); );
return ( return (

View File

@@ -53,6 +53,7 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
const [selectedLgCatCd, setSelectedLgCatCd] = useState(); const [selectedLgCatCd, setSelectedLgCatCd] = useState();
const [selectedLgCatNm, setSelectedLgCatNm] = useState(); const [selectedLgCatNm, setSelectedLgCatNm] = useState();
const [spotlightDisabled, setSpotlightDisabled] = useState(true); const [spotlightDisabled, setSpotlightDisabled] = useState(true);
const [currentFocusedShelf, setCurrentFocusedShelf] = useState(null);
const enteredThroughEventPopup = Object.keys(panelInfo).length === 1; const enteredThroughEventPopup = Object.keys(panelInfo).length === 1;
const enteredThroughGNB = Object.keys(panelInfo).length === 0; 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( const handleCancel = useCallback(
(e) => { (e) => {
if (panelInfo.nowShelf) { if (panelInfo.nowShelf) {
@@ -372,6 +385,7 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
saleProductInfos={saleProductInfos} saleProductInfos={saleProductInfos}
selectedLgCatCd={selectedLgCatCd} selectedLgCatCd={selectedLgCatCd}
selectedLgCatNm={selectedLgCatNm} selectedLgCatNm={selectedLgCatNm}
onShelfFocus={handleShelfFocus}
/> />
) )
)} )}