[포유 작업]#3

- foryouaction,reducer 받는부분 변경 및 추가 .
 - 베스트셀러,픽포유,파퓰러쇼,저스트포유패널 노출 변경 및 수정 작업
 - 홈배너 데이터 불러오는부분 수정 및 변경.
This commit is contained in:
junghoon86.park
2025-11-10 19:31:07 +09:00
parent 0050f9043c
commit bde1fb4eef
9 changed files with 132 additions and 67 deletions

View File

@@ -67,11 +67,13 @@ const BestSeller = ({
const { cursorVisible } = useSelector((state) => state.common.appStatus);
const bestSellerDatas = useSelector(
(state) => state.product.bestSellerData?.bestSeller
);
const bestSellerNewDatas = useSelector(
(state) =>
state.foryou?.justForYouInfo?.shelfInfos
state.foryou?.recommendInfo?.recommendProduct
);
@@ -80,6 +82,7 @@ const BestSeller = ({
const [firstChk, setFirstChk] = useState(0);
const [bestInfos, setBestInfos] = useState(null);
const [bestItemNewData, setBestItemNewData] = useState([]);
useEffect(()=>{
setBestInfos(
@@ -89,6 +92,24 @@ const BestSeller = ({
)
},[bestSellerNewDatas])
useEffect(() => {
const recommendedData = bestInfos?.[0].productInfos?.slice(0, 2).map((item) => ({
...item,
foryou: true,
})) || [];
const recommendedPrdtIds = new Set(recommendedData.map(item => item.prdtId));
const baseData = bestSellerDatas?.filter(
(item) => !recommendedPrdtIds.has(item.prdtId)
).map((item) => ({
...item,
foryou: false,
})) || [];
setBestItemNewData([...recommendedData, ...baseData]);
}, [bestSellerDatas, bestInfos?.[0].productInfos]);
const orderStyle = useMemo(() => ({ order: order }), [order]);
useEffect(() => {
@@ -213,8 +234,8 @@ const BestSeller = ({
cbScrollTo={getScrollTo}
noScrollByWheel
>
{bestInfos &&
bestInfos?.[0].productInfos.map(
{bestItemNewData &&
bestItemNewData.map(
(
{
prdtId,
@@ -227,7 +248,7 @@ const BestSeller = ({
brndNm,
patncNm,
//catNm, 없음
//foryou,
foryou,
euEnrgLblInfos,
},
itemIndex
@@ -269,7 +290,7 @@ const BestSeller = ({
lastLabel=" go to detail, button"
euEnrgLblInfos={euEnrgLblInfos}
>
{/* {foryou === true && <Tag text={"For You"} />} */}
{foryou === true && <Tag text={"For You"} />}
</TItemCardNew>
);
}