[통합로그API No.11] TrendingNow 화면 내에서 리모콘을 통해 상/하단으로 이동 시 shelf 로그 정보 수집

This commit is contained in:
dongyoungKo
2025-05-20 15:54:12 +09:00
parent 9fe89d4ac6
commit 28ddb1c2de
3 changed files with 49 additions and 7 deletions

View File

@@ -595,6 +595,7 @@ export const LOG_CONTEXT_NAME = {
FEATURED_BRANDS: "shoptime.featuredpartner", FEATURED_BRANDS: "shoptime.featuredpartner",
MYINFO: "shoptime.myinfo", MYINFO: "shoptime.myinfo",
ON_SALE: "shoptime.onsale", ON_SALE: "shoptime.onsale",
TRENDING_NOW: "shoptime.trendingnow",
}; };
export const LOG_MESSAGE_ID = { export const LOG_MESSAGE_ID = {

View File

@@ -20,6 +20,7 @@ const PopularShowIndicator = ({
onSpotlightRight, onSpotlightRight,
handleItemFocus, handleItemFocus,
handleItemClick, handleItemClick,
currentShelf,
isOnTop, isOnTop,
}) => { }) => {
const { const {
@@ -37,7 +38,8 @@ const PopularShowIndicator = ({
const isVertical = Boolean(vtctpYn === "Y"); const isVertical = Boolean(vtctpYn === "Y");
const _handleItemFocus = useCallback(() => { const _handleItemFocus = useCallback(() => {
if (handleItemFocus) handleItemFocus(LOG_MENU.TRENDING_NOW_POPULAR_SHOWS); if (handleItemFocus)
handleItemFocus(LOG_MENU.TRENDING_NOW_POPULAR_SHOWS, currentShelf);
}, [handleItemFocus]); }, [handleItemFocus]);
const _handleItemClick = useCallback(() => { const _handleItemClick = useCallback(() => {

View File

@@ -7,7 +7,7 @@ import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator"; import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import { setContainerLastFocusedElement } from "@enact/spotlight/src/container"; import { setContainerLastFocusedElement } from "@enact/spotlight/src/container";
import { sendLogGNB } from "../../actions/logActions"; import { sendLogGNB, sendLogTotalRecommend } from "../../actions/logActions";
import { getTop20Show } from "../../actions/mainActions"; import { getTop20Show } from "../../actions/mainActions";
import { pushPanel, updatePanel } from "../../actions/panelActions"; import { pushPanel, updatePanel } from "../../actions/panelActions";
import { finishVideoPreview } from "../../actions/playActions"; import { finishVideoPreview } from "../../actions/playActions";
@@ -21,7 +21,12 @@ import TItemCard, {
import TPanel from "../../components/TPanel/TPanel"; import TPanel from "../../components/TPanel/TPanel";
import TVerticalPagenator from "../../components/TVerticalPagenator/TVerticalPagenator"; import TVerticalPagenator from "../../components/TVerticalPagenator/TVerticalPagenator";
import useWhyDidYouUpdate from "../../hooks/useWhyDidYouUpdate"; import useWhyDidYouUpdate from "../../hooks/useWhyDidYouUpdate";
import { LOG_MENU, panel_names } from "../../utils/Config"; import {
LOG_CONTEXT_NAME,
LOG_MENU,
LOG_MESSAGE_ID,
panel_names,
} from "../../utils/Config";
import { $L } from "../../utils/helperMethods"; import { $L } from "../../utils/helperMethods";
import { SpotlightIds } from "../../utils/SpotlightIds"; import { SpotlightIds } from "../../utils/SpotlightIds";
import PopularShowIndicator from "./PopularShow/PopularShowIndicator"; import PopularShowIndicator from "./PopularShow/PopularShowIndicator";
@@ -62,6 +67,7 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
const cbChangePageRef = useRef(null); const cbChangePageRef = useRef(null);
const isInitialRef = useRef(true); const isInitialRef = useRef(true);
const currentSentMenuRef = useRef(null);
const focusedContainerIdRef = useRef(panelInfo?.focusedContainerId); const focusedContainerIdRef = useRef(panelInfo?.focusedContainerId);
// effect: data fetching when no data exists in the store // effect: data fetching when no data exists in the store
@@ -129,6 +135,7 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
const handleScroll = useCallback((e) => { const handleScroll = useCallback((e) => {
setShowButton(e.scrollTop === 0); setShowButton(e.scrollTop === 0);
if (e.scrollTop !== 0) dispatch(finishVideoPreview()); if (e.scrollTop !== 0) dispatch(finishVideoPreview());
}, []); }, []);
@@ -188,7 +195,7 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
); );
const handleBestSellerFocus = useCallback(() => { const handleBestSellerFocus = useCallback(() => {
handleItemFocus(LOG_MENU.TRENDING_NOW_BEST_SELLER); handleItemFocus(LOG_MENU.TRENDING_NOW_BEST_SELLER, STRING_CONF.BEST_SELLER);
}, [handleItemFocus]); }, [handleItemFocus]);
const handleItemClick = useCallback(() => { const handleItemClick = useCallback(() => {
@@ -207,9 +214,40 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
); );
}, [selectedIndex]); }, [selectedIndex]);
const handleItemFocus = useCallback((nowMenu) => { const handleItemFocus = useCallback(
setTimeout(() => dispatch(sendLogGNB(nowMenu))); (nowMenu, currentShelf) => {
}, []); setTimeout(() => dispatch(sendLogGNB(nowMenu)));
if (nowMenu !== currentSentMenuRef.current) {
let order;
let spotlightId;
switch (currentShelf) {
case STRING_CONF.POPULAR_SHOW:
order = 1;
spotlightId = SpotlightIds.TRENDING_NOW_POPULAR_SHOW;
break;
case STRING_CONF.BEST_SELLER:
order = 2;
spotlightId = SpotlightIds.TRENDING_NOW_BEST_SELLER;
break;
}
if (order && spotlightId) {
const params = {
contextName: LOG_CONTEXT_NAME.TRENDING_NOW,
messageId: LOG_MESSAGE_ID.SHELF_CLICK,
shelfLocation: order,
shelfId: spotlightId,
shelfTitle: currentShelf,
};
dispatch(sendLogTotalRecommend(params));
currentSentMenuRef.current = nowMenu;
}
}
},
[currentSentMenuRef]
);
const handleTopButtonClick = useCallback(() => { const handleTopButtonClick = useCallback(() => {
if (cbChangePageRef.current) { if (cbChangePageRef.current) {
@@ -293,6 +331,7 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
handleItemFocus={handleItemFocus} handleItemFocus={handleItemFocus}
handleItemClick={handleItemClick} handleItemClick={handleItemClick}
isOnTop={isOnTop} isOnTop={isOnTop}
currentShelf={STRING_CONF.POPULAR_SHOW}
/> />
</Container> </Container>
)} )}