[No Jira Issue] IF-LGSP-LOG-005 (GNB 이력) Magic Mouse 대응 (HomePanel)

1. actionTypes.js
2. homeActions.js
3. logActions.js
4. deepLinkHandler.js
5. TabLayout.jsx
6. homeReducer.js
7. HomePanel.jsx

- updateSpotlightId → updateHomeInfo
- modify the deepLinkHandler func
- modify the doSendLogGNB func
This commit is contained in:
younghoon100.park
2024-11-13 11:14:46 +09:00
parent 4c8da84f19
commit 661ea033eb
7 changed files with 28 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
import { setSecondLayerInfo } from "../actions/commonActions";
import { updateHomeInfo } from "../actions/homeActions";
import { pushPanel } from "../actions/panelActions";
import { LOG_MENU, LOG_TP_NO, panel_names } from "../utils/Config";
import { LOG_MENU, panel_names } from "../utils/Config";
//V2_진입경로코드_진입경로명_MT_노출순번
export const handleDeepLink = (contentTarget) => (dispatch, getState) => {
@@ -229,17 +229,16 @@ export const handleDeepLink = (contentTarget) => (dispatch, getState) => {
}
if (panelName) {
console.log("handleDeepLink - panelName", panelName, panelInfo);
const action =
panelName === panel_names.HOME_PANEL ? updateHomeInfo : pushPanel;
dispatch(
pushPanel({
action({
name: panelName,
panelInfo: { ...panelInfo, linkTpCd },
})
);
}
} else {
console.log("handleDeepLink - no target");
}
}
};

View File

@@ -59,11 +59,11 @@ export const types = {
GET_THEME_HOTEL_DETAIL_INFO: "GET_THEME_HOTEL_DETAIL_INFO",
GET_THEME_MENU_SHELF_INFO: "GET_THEME_MENU_SHELF_INFO",
CLEAR_THEME_MENU_SHELF_INFO: "CLEAR_THEME_MENU_SHELF_INFO",
UPDATE_SPOTLIGHTID: "UPDATE_SPOTLIGHTID",
CLEAR_THEME_DETAIL: "CLEAR_THEME_DETAIL",
SET_DEFAULT_FOCUS: "SET_DEFAULT_FOCUS",
CHECK_ENTER_THROUGH_GNB: "CHECK_ENTER_THROUGH_GNB",
SET_DEFAULT_FOCUS: "SET_DEFAULT_FOCUS",
SET_BANNER_INDEX: "SET_BANNER_INDEX",
UPDATE_HOME_INFO: "UPDATE_HOME_INFO",
// brand actions
GET_BRAND_LIST: "GET_BRAND_LIST",

View File

@@ -256,11 +256,10 @@ export const clearThemeMenuShelfInfo = () => ({
type: types.CLEAR_THEME_MENU_SHELF_INFO,
});
// 홈패널 스팟 아이디 저장용도
export const updateSpotlightId = (currentSpot) => {
export const updateHomeInfo = (homeInfo) => {
return {
type: types.UPDATE_SPOTLIGHTID,
payload: currentSpot,
type: types.UPDATE_HOME_INFO,
payload: homeInfo,
};
};

View File

@@ -5,7 +5,6 @@ import {
formatGMTString,
getTimeDifferenceByMilliseconds,
} from "../utils/helperMethods";
import { types } from "./actionTypes";
import { setGNBMenu, setSecondLayerInfo } from "./commonActions";
export const getUrlByLogTpNo = (logTpNo) => {

View File

@@ -23,7 +23,7 @@ import shoptimeFullIcon from "../../../assets/images/icons/ic-lnb-logo-shoptime@
import { gnbOpened } from "../../actions/commonActions";
import {
checkEnterThroughGNB,
updateSpotlightId,
updateHomeInfo,
} from "../../actions/homeActions";
import { resetPanels } from "../../actions/panelActions";
import usePrevious from "../../hooks/usePrevious";
@@ -488,7 +488,7 @@ export default function TabLayout({ topPanelName, onTabActivated, panelInfo }) {
dispatch(resetPanels());
dispatch(checkEnterThroughGNB(true));
dispatch(
updateSpotlightId({
updateHomeInfo({
name: panel_names.HOME_PANEL,
panelInfo: {
currentSpot: null,
@@ -510,7 +510,7 @@ export default function TabLayout({ topPanelName, onTabActivated, panelInfo }) {
}
dispatch(
updateSpotlightId({
updateHomeInfo({
name: panel_names.HOME_PANEL,
panelInfo: {
currentSpot: null,
@@ -540,7 +540,7 @@ export default function TabLayout({ topPanelName, onTabActivated, panelInfo }) {
}
dispatch(
updateSpotlightId({
updateHomeInfo({
name: panel_names.HOME_PANEL,
panelInfo: {
currentSpot: null,

View File

@@ -18,6 +18,7 @@ const initialState = {
themeCurationInfoDataCode: null,
bannerIndices: {},
themeMenuShelfInfoData: null,
homeInfo: null,
};
export const homeReducer = (state = initialState, action) => {
@@ -120,10 +121,10 @@ export const homeReducer = (state = initialState, action) => {
};
}
case types.UPDATE_SPOTLIGHTID: {
case types.UPDATE_HOME_INFO: {
return {
...state,
spotData: action.payload,
homeInfo: action.payload,
};
}
case types.CLEAR_THEME_DETAIL: {

View File

@@ -27,7 +27,7 @@ import {
checkEnterThroughGNB,
getHomeLayout,
getHomeMainContents,
updateSpotlightId,
updateHomeInfo,
} from "../../actions/homeActions";
import { sendLogGNB } from "../../actions/logActions";
import { getSubCategory, getTop20Show } from "../../actions/mainActions";
@@ -68,7 +68,7 @@ export default function HomePanel({ isOnTop }) {
const isGnbOpened = useSelector((state) => state.common.isGnbOpened);
const homeLayoutInfo = useSelector((state) => state.home.layoutData);
const panelInfo = useSelector(
(state) => state.home.spotData?.panelInfo ?? {}
(state) => state.home.homeInfo?.panelInfo ?? {}
);
const panels = useSelector((state) => state.panels.panels);
const webOSVersion = useSelector(
@@ -124,7 +124,7 @@ export default function HomePanel({ isOnTop }) {
const isInitialRender = useRef(true);
const verticalPagenatorRef = useRef(null);
const sendedNowMenuRef = useRef(null);
const currentSentMenuRef = useRef(null);
const sortedHomeLayoutInfo = useMemo(() => {
if (homeLayoutInfo && homeLayoutInfo.homeLayoutInfo) {
@@ -160,7 +160,7 @@ export default function HomePanel({ isOnTop }) {
return;
}
dispatch(
updateSpotlightId({
updateHomeInfo({
name: panel_names.HOME_PANEL,
panelInfo: {
currentSpot: currentSpot,
@@ -205,7 +205,7 @@ export default function HomePanel({ isOnTop }) {
const doSendLogGNB = useCallback(
(containerId) => {
let nowMenu = null;
let nowMenu;
switch (containerId) {
case TEMPLATE_CODE_CONF.TOP:
nowMenu = LOG_MENU.HOME_TOP;
@@ -222,10 +222,13 @@ export default function HomePanel({ isOnTop }) {
case TEMPLATE_CODE_CONF.BEST_SELLER:
nowMenu = LOG_MENU.HOME_BEST_SELLER;
break;
default:
nowMenu = LOG_MENU.HOME_TOP;
break;
}
if (nowMenu && nowMenu !== sendedNowMenuRef.current) {
if (nowMenu && nowMenu !== currentSentMenuRef.current) {
dispatch(sendLogGNB(nowMenu));
sendedNowMenuRef.current = nowMenu;
currentSentMenuRef.current = nowMenu;
}
},
[pageSpotIds]
@@ -507,7 +510,7 @@ export default function HomePanel({ isOnTop }) {
dispatch(checkEnterThroughGNB(false));
dispatch(
updateSpotlightId({
updateHomeInfo({
name: panel_names.HOME_PANEL,
panelInfo: {
currentSpot: currentSpot,