[지라 이슈 없음] Log, IF-LGSP-LOG-005 / GNB 클릭 이력 수정
changed files: 1. logActions.js 2. SearchPanel.jsx 3. NoSearchResult.jsx detail note: 1. sendLogGNB 함수 수정: menu와 nowMenu가 같을 경우 예외 처리 2. handleItemFocus 삭제, sendLogGNB를 담당하는 useEffect 수정 3. props handleItemFocus 삭제
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { URLS } from "../api/apiConfig";
|
||||
import { TLogEvent } from "../api/TLogEvent";
|
||||
import { LOG_TP_NO } from "../utils/Config";
|
||||
import { LOG_MENU, LOG_TP_NO } from "../utils/Config";
|
||||
import {
|
||||
formatGMTString,
|
||||
getTimeDifferenceByMilliseconds,
|
||||
@@ -410,8 +410,16 @@ export const sendLogGNB = (menu) => (dispatch, getState) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu === nowMenu || !menuMovSno) {
|
||||
return;
|
||||
if (
|
||||
![
|
||||
LOG_MENU.SEARCH_SEARCH,
|
||||
LOG_MENU.SEARCH_RESULT,
|
||||
LOG_MENU.SEARCH_BEST_SELLER,
|
||||
].includes(menu)
|
||||
) {
|
||||
if (menu === nowMenu || !menuMovSno) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const newParams = {
|
||||
|
||||
@@ -10,13 +10,13 @@ import NoSearchResultsImage from "../../../../assets/images/searchpanel/img-sear
|
||||
import { pushPanel, updatePanel } from "../../../actions/panelActions";
|
||||
import SectionTitle from "../../../components/SectionTitle/SectionTitle";
|
||||
import TItemCard from "../../../components/TItemCard/TItemCard";
|
||||
import { LOG_MENU, panel_names } from "../../../utils/Config";
|
||||
import { panel_names } from "../../../utils/Config";
|
||||
import { $L } from "../../../utils/helperMethods";
|
||||
import { SpotlightIds } from "../../../utils/SpotlightIds";
|
||||
import css from "./NoSearchResults.module.less";
|
||||
|
||||
const ContainerBasic = SpotlightContainerDecorator({ enterTo: null }, "div");
|
||||
export default function NoSearchResults({ handleItemFocus }) {
|
||||
export default function NoSearchResults() {
|
||||
const dispatch = useDispatch();
|
||||
const bestSellerDatas = useSelector(
|
||||
(state) => state.product.bestSellerData.bestSeller
|
||||
@@ -25,12 +25,6 @@ export default function NoSearchResults({ handleItemFocus }) {
|
||||
|
||||
const spotJob = useRef(new Job((func) => func(), 0));
|
||||
|
||||
const handleFocus = useCallback(() => {
|
||||
if (handleItemFocus) {
|
||||
handleItemFocus(LOG_MENU.SEARCH_BEST_SELLER);
|
||||
}
|
||||
}, [handleItemFocus]);
|
||||
|
||||
const handleCardClick = useCallback(
|
||||
(item) => () => {
|
||||
const c = Spotlight.getCurrent();
|
||||
@@ -104,7 +98,6 @@ export default function NoSearchResults({ handleItemFocus }) {
|
||||
productId={bestSeller.prdtId}
|
||||
rank={bestSeller.rankOrd}
|
||||
onClick={handleCardClick(bestSeller)}
|
||||
onFocus={handleFocus}
|
||||
isBestSeller
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -74,13 +74,19 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
|
||||
}, [loadingComplete]);
|
||||
|
||||
useEffect(() => {
|
||||
const nowMenu =
|
||||
searchPerformed && searchQuery !== null
|
||||
? LOG_MENU.SEARCH_RESULT
|
||||
: LOG_MENU.SEARCH_SEARCH;
|
||||
|
||||
dispatch(sendLogGNB(nowMenu));
|
||||
}, [searchPerformed, searchQuery]);
|
||||
if (isOnTop) {
|
||||
let menu;
|
||||
if (!searchPerformed) menu = LOG_MENU.SEARCH_SEARCH;
|
||||
else {
|
||||
if (searchQueryRef.current)
|
||||
menu =
|
||||
Object.keys(searchDatas).length > 0
|
||||
? LOG_MENU.SEARCH_RESULT
|
||||
: LOG_MENU.SEARCH_BEST_SELLER;
|
||||
}
|
||||
dispatch(sendLogGNB(menu));
|
||||
}
|
||||
}, [isOnTop, searchDatas, searchPerformed]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!searchQuery) {
|
||||
@@ -221,9 +227,6 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
|
||||
}
|
||||
}, [searchQuery, dispatch]);
|
||||
|
||||
const handleItemFocus = useCallback((nowMenu) => {
|
||||
dispatch(sendLogGNB(nowMenu));
|
||||
}, []);
|
||||
const onFocusedContainerId = useCallback(
|
||||
(containerId) => {
|
||||
setFocusedContainerId(containerId);
|
||||
@@ -303,7 +306,7 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
|
||||
isRecommendedSearchRef={isRecommendedSearchRef}
|
||||
/>
|
||||
) : (
|
||||
<NoSearchResults handleItemFocus={handleItemFocus} />
|
||||
<NoSearchResults />
|
||||
)
|
||||
) : (
|
||||
<ContainerBasic>
|
||||
|
||||
Reference in New Issue
Block a user