feat(p2v): 무빙 포스터·롱컷 통합 및 상세·소셜 기능 연결
This commit is contained in:
1 parent
cd71f6d9d3
commit
c06018d88c
42 files changed
+3020
-1610
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { VideoListItem } from '../types/api';
|
||||
import { useOverlayClose } from '../hooks/useOverlayClose';
|
||||
import ContentDetailContent from './ContentDetailContent';
|
||||
import { isP2vContent } from '../utils/p2vApi';
|
||||
|
||||
interface P2vViewerModalProps {
|
||||
/** null 이면 닫힘 */
|
||||
item: VideoListItem | null;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* P2V(무빙 포스터·롱컷) 콘텐츠 재생 모달 — `SsulViewerModal` 과 같은 백드롭 래퍼.
|
||||
*
|
||||
* 공개 상세 API 를 사용하며 공유 상세 화면과 같은 소셜 기능을 제공한다.
|
||||
*/
|
||||
const P2vViewerModal: React.FC<P2vViewerModalProps> = ({ item, onClose }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!item) return;
|
||||
const prev = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') onClose();
|
||||
};
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
return () => {
|
||||
document.body.style.overflow = prev;
|
||||
document.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, [item, onClose]);
|
||||
|
||||
const overlayCloseHandlers = useOverlayClose(onClose);
|
||||
|
||||
if (!item || !isP2vContent(item.type)) return null;
|
||||
|
||||
return (
|
||||
<div className="video-detail-overlay" {...overlayCloseHandlers}>
|
||||
<div className="video-detail-modal-box" onClick={(e) => e.stopPropagation()}>
|
||||
<ContentDetailContent
|
||||
key={`${item.type}-${item.video_id}`}
|
||||
contentId={String(item.video_id)}
|
||||
contentType={item.type}
|
||||
isModal
|
||||
onClose={onClose}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default P2vViewerModal;
|
||||
Reference in new issue
Block a user