🕐 커밋 시간: 2025. 11. 15. 22:03:44 📊 변경 통계: • 총 파일: 17개 • 추가: +573줄 • 삭제: -87줄 📁 추가된 파일: + com.twin.app.shoptime/src/views/PlayerPanel/PlayerOverlay/MediaOverlayContents.jsx 📝 수정된 파일: ~ com.twin.app.shoptime/src/actions/panelActions.js ~ com.twin.app.shoptime/src/components/MediaPlayer/MediaControls.js ~ com.twin.app.shoptime/src/components/VideoPlayer/MediaPlayer.module.less ~ com.twin.app.shoptime/src/components/VideoPlayer/MediaPlayer.v2.jsx ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.v3.js ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.v3.module.less ~ com.twin.app.shoptime/src/utils/SpotlightIds.js ~ com.twin.app.shoptime/src/views/HomePanel/BestSeller/BestSeller.jsx ~ com.twin.app.shoptime/src/views/HomePanel/EventPopUpBanner/EventPopUpBanner.jsx ~ com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx ~ com.twin.app.shoptime/src/views/HomePanel/PickedForYou/PickedForYou.jsx ~ com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx ~ com.twin.app.shoptime/src/views/MainView/MainView.jsx ~ com.twin.app.shoptime/src/views/MediaPanel/MediaPanel.v3.jsx ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerOverlay/PlayerOverlayContents.jsx ~ com.twin.app.shoptime/src/views/SearchPanel/SearchResultsNew/ItemCard.jsx 🔧 함수 변경 내용: 📄 com.twin.app.shoptime/src/actions/panelActions.js (javascript): ✅ Added: updatePanel() 📄 com.twin.app.shoptime/src/components/MediaPlayer/MediaControls.js (javascript): ✅ Added: onSpotlightRight(), onSpotlightUp(), MediaControlsDecoratorHOC(), handleCancel() ❌ Deleted: onSpotlightRight(), onSpotlightUp(), MediaControlsDecoratorHOC(), handleCancel() 📄 com.twin.app.shoptime/src/components/VideoPlayer/MediaPlayer.v2.jsx (javascript): 🔄 Modified: SpotlightContainerDecorator() 📄 com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.v3.module.less (unknown): ✅ Added: position() ❌ Deleted: position() 📄 com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx (javascript): 🔄 Modified: SpotlightContainerDecorator() 📄 com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx (javascript): 🔄 Modified: getExpsOrdByLgCatCd() 📄 com.twin.app.shoptime/src/views/MediaPanel/MediaPanel.v3.jsx (javascript): 🔄 Modified: normalizeModalStyle() 📄 com.twin.app.shoptime/src/views/PlayerPanel/PlayerOverlay/PlayerOverlayContents.jsx (javascript): 🔄 Modified: SpotlightContainerDecorator(), PlayerOverlayContents() 📄 com.twin.app.shoptime/src/views/PlayerPanel/PlayerOverlay/MediaOverlayContents.jsx (javascript): ✅ Added: MediaOverlayContents() 🔧 주요 변경 내용: • 핵심 비즈니스 로직 개선 • UI 컴포넌트 아키텍처 개선 • 공통 유틸리티 함수 최적화
97 lines
3.2 KiB
JavaScript
97 lines
3.2 KiB
JavaScript
import React, { useCallback } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
import Spotlight from '@enact/spotlight';
|
|
|
|
import { pushPanel, updatePanel, navigateFromSearch } from '../../../actions/panelActions';
|
|
import TItemCardNew from '../../../components/TItemCard/TItemCard.new';
|
|
import TScroller from '../../../components/TScroller/TScroller';
|
|
import { panel_names } from '../../../utils/Config';
|
|
import { SpotlightIds } from '../../../utils/SpotlightIds';
|
|
import css from './ItemCard.module.less';
|
|
|
|
const ItemCard = ({ onClick, itemInfo, searchQuery }) => {
|
|
const dispatch = useDispatch();
|
|
const _handleItemClick = useCallback(
|
|
(patnrId, prdtId, spotlightId) => (ev) => {
|
|
// 🎯 더 확실한 방법으로 spotlight-id 가져오기
|
|
// 1. 이벤트 target에서부터 찾기
|
|
let currentSpot = null;
|
|
let target = ev.target;
|
|
|
|
while (target && target !== document.body) {
|
|
if (target.getAttribute('data-spotlight-id')) {
|
|
currentSpot = target.getAttribute('data-spotlight-id');
|
|
break;
|
|
}
|
|
target = target.parentElement;
|
|
}
|
|
|
|
// 2. 위에서 못 찾으면 전달받은 spotlightId 사용
|
|
if (!currentSpot && spotlightId) {
|
|
currentSpot = spotlightId;
|
|
}
|
|
|
|
// 3. 그래도 없으면 Spotlight.getCurrent() 사용
|
|
if (!currentSpot) {
|
|
const spotlightElement = Spotlight.getCurrent();
|
|
if (spotlightElement) {
|
|
currentSpot = spotlightElement.getAttribute('data-spotlight-id');
|
|
}
|
|
}
|
|
|
|
if (onClick) {
|
|
onClick(ev);
|
|
}
|
|
|
|
// 통합된 navigateToDetail 사용
|
|
dispatch(
|
|
navigateFromSearch({
|
|
patnrId,
|
|
prdtId,
|
|
searchQuery,
|
|
currentSpot,
|
|
additionalInfo: { tab: 0 },
|
|
})
|
|
);
|
|
},
|
|
[onClick, dispatch, searchQuery]
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<TScroller className={css.container} spotlightId={SpotlightIds.SEARCH_ITEM}>
|
|
{itemInfo.map((item, index) => {
|
|
const { thumbnail, title, dcPrice, price, soldout, contentId, euEnrgLblInfos } = item;
|
|
const tokens = contentId && contentId.split('_');
|
|
const patnrId = tokens?.[4] || '';
|
|
const prdtId = tokens?.[5] || '';
|
|
const spotlightId = 'searchItemContents' + index;
|
|
return (
|
|
<TItemCardNew
|
|
key={prdtId}
|
|
imageAlt={prdtId}
|
|
imageSource={thumbnail}
|
|
productName={title}
|
|
productId={prdtId}
|
|
onClick={_handleItemClick(patnrId, prdtId, spotlightId)}
|
|
soldoutFlag={soldout}
|
|
dcPrice={dcPrice}
|
|
originPrice={price}
|
|
spotlightId={spotlightId}
|
|
// ✅ [251026] ADD: 첫 번째 상품 카드에만 Spotlight 포커스 업 네비게이션 적용 - data-spotlight-up 속성 사용
|
|
{...(index === 0 ? { 'data-spotlight-up': 'searchtabContainer' } : {})}
|
|
label={index * 1 + 1 + ' of ' + itemInfo.length + 1}
|
|
lastLabel=" go to detail, button"
|
|
euEnrgLblInfos={euEnrgLblInfos}
|
|
/>
|
|
);
|
|
})}
|
|
</TScroller>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default ItemCard;
|