[251026] feat: HomeBanner Video FullScreen Transition Success
🕐 커밋 시간: 2025. 10. 26. 23:21:15 📊 변경 통계: • 총 파일: 2개 • 추가: +35줄 • 삭제: -3줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/actions/playActions.js ~ com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx 🔧 주요 변경 내용: • 핵심 비즈니스 로직 개선 • 소규모 기능 개선
This commit is contained in:
@@ -59,6 +59,27 @@ export const startVideoPlayer =
|
||||
}
|
||||
};
|
||||
|
||||
// 중복 재생 방지: 정말 동일한 요청인지 확인
|
||||
// 같은 배너 + 같은 modal 상태 + 같은 위치 = 정말 동일한 요청이므로 skip
|
||||
const shouldSkipVideoPlayback = (
|
||||
currentPanelInfo,
|
||||
newModalState,
|
||||
newModalContainerId,
|
||||
newBannerId
|
||||
) => {
|
||||
if (!currentPanelInfo) return false;
|
||||
|
||||
const currentBannerId = currentPanelInfo.playerState?.currentBannerId;
|
||||
const currentModal = currentPanelInfo.modal;
|
||||
const currentModalContainerId = currentPanelInfo.modalContainerId;
|
||||
|
||||
return (
|
||||
currentBannerId === newBannerId &&
|
||||
currentModal === newModalState &&
|
||||
currentModalContainerId === newModalContainerId
|
||||
);
|
||||
};
|
||||
|
||||
export const startVideoPlayerNew =
|
||||
({ modal, modalContainerId, modalClassName, spotlightDisable, useNewPlayer, bannerId, ...rest }) =>
|
||||
(dispatch, getState) => {
|
||||
@@ -76,8 +97,8 @@ export const startVideoPlayerNew =
|
||||
// playerState 업데이트: 기존 playerState와 새 데이터 병합
|
||||
const currentPlayerState = topPanel?.panelInfo?.playerState || {};
|
||||
|
||||
// 같은 배너에서 이미 비디오가 재생 중이면 return (중복 재생 방지)
|
||||
if (currentPlayerState.currentBannerId === bannerId) {
|
||||
// ✅ 정확한 비교: 같은 배너 + 같은 modal 상태 + 같은 위치일 때만 skip
|
||||
if (shouldSkipVideoPlayback(topPanel?.panelInfo, modal, modalContainerId, bannerId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,12 @@ export default function RandomUnit({
|
||||
: null
|
||||
);
|
||||
|
||||
// ✅ 현재 PlayerPanel의 modal 상태 추적
|
||||
const playerPanelInfo = useSelector((state) => {
|
||||
const playerPanel = state.panels.panels.find((p) => p.name === panel_names.PLAYER_PANEL);
|
||||
return playerPanel?.panelInfo;
|
||||
});
|
||||
|
||||
const topContentsLogInfo = useMemo(() => {
|
||||
if (randomDataRef.current) {
|
||||
const currentRandomData = randomDataRef.current;
|
||||
@@ -447,6 +453,11 @@ export default function RandomUnit({
|
||||
);
|
||||
}
|
||||
|
||||
// ✅ modal=true → modal=false로 전환 (또는 초기 로드 시 modal=false)
|
||||
// playActions의 shouldSkipVideoPlayback이 modal 상태를 확인하므로
|
||||
// 모드 전환은 중복 방지 로직을 스킵하여 정상 작동
|
||||
console.log('[RandomUnit] videoClick: current playerPanel modal state:', playerPanelInfo?.modal);
|
||||
|
||||
dispatch(
|
||||
startVideoPlayerNew({
|
||||
bannerId: spotlightId,
|
||||
@@ -472,7 +483,7 @@ export default function RandomUnit({
|
||||
|
||||
sendBannerLog(true);
|
||||
onBlur();
|
||||
}, [randomData, spotlightId, topContentsLogInfo, nowMenu, randomDataRef, sendBannerLog, onBlur]);
|
||||
}, [randomData, spotlightId, topContentsLogInfo, nowMenu, randomDataRef, sendBannerLog, onBlur, playerPanelInfo?.modal, dispatch]);
|
||||
|
||||
// 투데이즈 딜 가격 정보
|
||||
const { originalPrice, discountedPrice, discountRate, offerInfo } =
|
||||
|
||||
Reference in New Issue
Block a user