[서치] 일반 검색 탭 미노출
- 김영진 부장과 이야기 하여 일반에서는 아직 필터 검토하지않아 빼달라고 하여 우선 일반검색에서는 미노출 처리 추후 처리 필요함
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import React, {
|
||||
useCallback,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
@@ -9,7 +14,8 @@ import upBtnImg from '../../../assets/images/btn/search_btn_up_arrow.png';
|
||||
import CustomImage from '../../components/CustomImage/CustomImage';
|
||||
import TButtonTab, { LIST_TYPE } from '../../components/TButtonTab/TButtonTab';
|
||||
import TDropDown from '../../components/TDropDown/TDropDown';
|
||||
import TVirtualGridList from '../../components/TVirtualGridList/TVirtualGridList';
|
||||
import TVirtualGridList
|
||||
from '../../components/TVirtualGridList/TVirtualGridList';
|
||||
import { $L } from '../../utils/helperMethods';
|
||||
import { SpotlightIds } from '../../utils/SpotlightIds';
|
||||
import css from './SearchResults.new.module.less';
|
||||
@@ -18,10 +24,20 @@ import ShowCard from './SearchResultsNew/ShowCard';
|
||||
|
||||
const ITEMS_PER_PAGE = 10;
|
||||
|
||||
const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, keywordClick }) => {
|
||||
const SearchResultsNew = ({
|
||||
itemInfo,
|
||||
showInfo,
|
||||
themeInfo,
|
||||
shopperHouseInfo,
|
||||
keywordClick,
|
||||
}) => {
|
||||
// ShopperHouse 데이터를 ItemCard 형식으로 변환
|
||||
const convertedShopperHouseItems = useMemo(() => {
|
||||
if (!shopperHouseInfo || !shopperHouseInfo.results || shopperHouseInfo.results.length === 0) {
|
||||
if (
|
||||
!shopperHouseInfo ||
|
||||
!shopperHouseInfo.results ||
|
||||
shopperHouseInfo.results.length === 0
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,33 +46,34 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
|
||||
return docs.map((doc) => {
|
||||
const contentId = doc.contentId;
|
||||
const tokens = contentId.split('_');
|
||||
const patnrId = tokens?.[4] || '';
|
||||
const prdtId = tokens?.[5] || '';
|
||||
const tokens = contentId.split("_");
|
||||
const patnrId = tokens?.[4] || "";
|
||||
const prdtId = tokens?.[5] || "";
|
||||
|
||||
return {
|
||||
thumbnail: doc.thumbnail || doc.imgPath || '', // 이미지 경로 (API 필드명 수정)
|
||||
title: doc.title || doc.prdtName || '', // 제목
|
||||
dcPrice: doc.dcPrice || doc.price || '', // 할인가격
|
||||
price: doc.price || '', // 원가
|
||||
soldout: doc.soldout || 'N', // 품절 여부
|
||||
thumbnail: doc.thumbnail || doc.imgPath || "", // 이미지 경로 (API 필드명 수정)
|
||||
title: doc.title || doc.prdtName || "", // 제목
|
||||
dcPrice: doc.dcPrice || doc.price || "", // 할인가격
|
||||
price: doc.price || "", // 원가
|
||||
soldout: doc.soldout || "N", // 품절 여부
|
||||
contentId, // 콘텐트 아이디
|
||||
reviewGrade: doc.reviewGrade || '', // 리뷰 점수
|
||||
partnerName: doc.partnerName || '', // 파트너 네임
|
||||
partnerLogo: doc.partnerLogo || '', // 파트너 로고 (API 명세서 추가)
|
||||
reviewGrade: doc.reviewGrade || "", // 리뷰 점수
|
||||
partnerName: doc.partnerName || "", // 파트너 네임
|
||||
partnerLogo: doc.partnerLogo || "", // 파트너 로고 (API 명세서 추가)
|
||||
rankInfo: doc.rankInfo || 0, // 랭킹 정보 (API 명세서 추가)
|
||||
patnrId, // 파트너 아이디
|
||||
prdtId, // 상품 아이디
|
||||
// results 레벨 추가 정보
|
||||
searchId: resultData.searchId || '',
|
||||
sortingType: resultData.sortingType || '',
|
||||
rangeType: resultData.rangeType || '',
|
||||
searchId: resultData.searchId || "",
|
||||
sortingType: resultData.sortingType || "",
|
||||
rangeType: resultData.rangeType || "",
|
||||
};
|
||||
});
|
||||
}, [shopperHouseInfo]);
|
||||
const getButtonTabList = () => {
|
||||
// ShopperHouse 데이터가 있으면 그것을 사용, 없으면 기존 검색 결과 사용
|
||||
const itemLength = convertedShopperHouseItems?.length || itemInfo?.length || 0;
|
||||
const itemLength =
|
||||
convertedShopperHouseItems?.length || itemInfo?.length || 0;
|
||||
const showLength = showInfo?.length || 0;
|
||||
|
||||
return [
|
||||
@@ -83,7 +100,8 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
}
|
||||
|
||||
// 현재 탭의 데이터 가져오기 - ShopperHouse 데이터 우선
|
||||
const currentData = tab === 0 ? convertedShopperHouseItems || itemInfo : showInfo;
|
||||
const currentData =
|
||||
tab === 0 ? convertedShopperHouseItems || itemInfo : showInfo;
|
||||
|
||||
// 표시할 데이터 (처음부터 visibleCount 개수만큼)
|
||||
const displayedData = useMemo(() => {
|
||||
@@ -131,8 +149,8 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
[dropDownTab]
|
||||
);
|
||||
|
||||
const SpottableLi = Spottable('li');
|
||||
const SpottableDiv = Spottable('div');
|
||||
const SpottableLi = Spottable("li");
|
||||
const SpottableDiv = Spottable("div");
|
||||
|
||||
// 맨 처음으로 이동 (위 버튼)
|
||||
const upBtnClick = () => {
|
||||
@@ -151,7 +169,8 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
// ProductCard 컴포넌트
|
||||
const renderItem = useCallback(
|
||||
({ index, ...rest }) => {
|
||||
const { bgImgPath, title, partnerLogo, partnerName, keyword } = themeInfo[index];
|
||||
const { bgImgPath, title, partnerLogo, partnerName, keyword } =
|
||||
themeInfo[index];
|
||||
return (
|
||||
<SpottableDiv
|
||||
key={`searchProduct-${index}`}
|
||||
@@ -164,7 +183,11 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
</div>
|
||||
<div className={css.productInfo}>
|
||||
<div className={css.productBrandWrapper}>
|
||||
<img src={partnerLogo} alt={partnerName} className={css.brandLogo} />
|
||||
<img
|
||||
src={partnerLogo}
|
||||
alt={partnerName}
|
||||
className={css.brandLogo}
|
||||
/>
|
||||
</div>
|
||||
<div className={css.productDetails}>
|
||||
{keyword && (
|
||||
@@ -189,7 +212,7 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
return shopperHouseInfo.results[0].relativeQuerys;
|
||||
}
|
||||
// 기본값
|
||||
return ['Puppy food', 'Dog toy', 'Fitness'];
|
||||
return ["Puppy food", "Dog toy", "Fitness"];
|
||||
}, [shopperHouseInfo]);
|
||||
|
||||
return (
|
||||
@@ -200,7 +223,11 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
{relativeQuerys.map((text, index) => {
|
||||
const handleClick = () => keywordClick(text);
|
||||
return (
|
||||
<SpottableLi key={`query-${index}`} className={css.topBoxListItem} onClick={handleClick}>
|
||||
<SpottableLi
|
||||
key={`query-${index}`}
|
||||
className={css.topBoxListItem}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{text}
|
||||
</SpottableLi>
|
||||
);
|
||||
@@ -211,7 +238,9 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
<div className={css.hotpicksSection} data-wheel-point="true">
|
||||
<div className={css.sectionHeader}>
|
||||
<div className={css.sectionIndicator} />
|
||||
<div className={css.sectionTitle}>Hot Picks ({themeInfo?.length})</div>
|
||||
<div className={css.sectionTitle}>
|
||||
Hot Picks ({themeInfo?.length})
|
||||
</div>
|
||||
</div>
|
||||
<div className={css.productList}>
|
||||
<TVirtualGridList
|
||||
@@ -234,7 +263,8 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
listType={LIST_TYPE.medium}
|
||||
spotlightId={SpotlightIds.SEARCH_TAB_CONTAINER}
|
||||
/>
|
||||
{tab === 0 && (
|
||||
{/* 2025/10/17 김영진 부장과 이야기 하여 일반에서는 아직 필터 검토하지않아 빼달라고 하여 우선 일반검색에서는 미노출 처리 추후 처리 필요함 */}
|
||||
{tab === 0 && !itemInfo?.length && (
|
||||
<TDropDown
|
||||
className={classNames(
|
||||
css.dropdown,
|
||||
@@ -256,7 +286,11 @@ const SearchResultsNew = ({ itemInfo, showInfo, themeInfo, shopperHouseInfo, key
|
||||
<div className={css.buttonContainer}>
|
||||
{hasMore && (
|
||||
<SpottableDiv onClick={downBtnClick} className={css.downBtn}>
|
||||
<CustomImage className={css.btnImg} src={downBtnImg} alt="Down arrow" />
|
||||
<CustomImage
|
||||
className={css.btnImg}
|
||||
src={downBtnImg}
|
||||
alt="Down arrow"
|
||||
/>
|
||||
</SpottableDiv>
|
||||
)}
|
||||
<SpottableDiv onClick={upBtnClick} className={css.upBtn}>
|
||||
|
||||
Reference in New Issue
Block a user