영상생성 완료 화면 및 소셜 미디어 포스팅 화면 UI수정
This commit is contained in:
1 parent
29e0c7d79c
commit
be32a04dd0
3 files changed
+64
-125
No files matched your search
@@ -44,6 +44,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
const [isChannelDropdownOpen, setIsChannelDropdownOpen] = useState(false);
|
||||
const [isPrivacyDropdownOpen, setIsPrivacyDropdownOpen] = useState(false);
|
||||
const [isLoadingAutoDescription, setIsLoadingAutoDescription] = useState(false);
|
||||
const [isHorizontalVideo, setIsHorizontalVideo] = useState(false);
|
||||
const channelDropdownRef = useRef<HTMLDivElement>(null);
|
||||
const privacyDropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -72,6 +73,16 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||
}, []);
|
||||
|
||||
// 모달 열릴 때 배경 스크롤 차단
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
} else {
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
return () => { document.body.style.overflow = ''; };
|
||||
}, [isOpen]);
|
||||
|
||||
// 소셜 계정 로드
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
@@ -297,9 +308,13 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
<div className="social-posting-video-container">
|
||||
<video
|
||||
src={video.result_movie_url}
|
||||
className="social-posting-video"
|
||||
className={`social-posting-video ${isHorizontalVideo ? 'horizontal' : 'vertical'}`}
|
||||
controls
|
||||
playsInline
|
||||
onLoadedMetadata={(e) => {
|
||||
const v = e.currentTarget;
|
||||
setIsHorizontalVideo(v.videoWidth > v.videoHeight);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,12 +37,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
const [statusMessage, setStatusMessage] = useState('');
|
||||
const [renderProgress, setRenderProgress] = useState(0);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [showControls, setShowControls] = useState(true);
|
||||
const videoRef = useRef<HTMLVideoElement>(null);
|
||||
const hasStartedGeneration = useRef(false);
|
||||
const hideControlsTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
// 소셜 미디어 포스팅 모달
|
||||
const [showSocialModal, setShowSocialModal] = useState(false);
|
||||
@@ -284,62 +279,6 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
}
|
||||
}, []);
|
||||
|
||||
const togglePlayPause = () => {
|
||||
if (!videoRef.current || !videoUrl) return;
|
||||
if (isPlaying) {
|
||||
videoRef.current.pause();
|
||||
setShowControls(true);
|
||||
if (hideControlsTimer.current) clearTimeout(hideControlsTimer.current);
|
||||
} else {
|
||||
videoRef.current.play();
|
||||
hideControlsTimer.current = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 3000);
|
||||
}
|
||||
setIsPlaying(!isPlaying);
|
||||
};
|
||||
|
||||
const handleTimeUpdate = () => {
|
||||
if (videoRef.current && videoRef.current.duration > 0) {
|
||||
setProgress((videoRef.current.currentTime / videoRef.current.duration) * 100);
|
||||
}
|
||||
};
|
||||
|
||||
const handleVideoEnded = () => {
|
||||
setIsPlaying(false);
|
||||
setProgress(0);
|
||||
setShowControls(true);
|
||||
};
|
||||
|
||||
const resetHideControlsTimer = () => {
|
||||
if (hideControlsTimer.current) {
|
||||
clearTimeout(hideControlsTimer.current);
|
||||
}
|
||||
setShowControls(true);
|
||||
if (isPlaying) {
|
||||
hideControlsTimer.current = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
const handleVideoMouseEnter = () => {
|
||||
resetHideControlsTimer();
|
||||
};
|
||||
|
||||
const handleVideoMouseMove = () => {
|
||||
resetHideControlsTimer();
|
||||
};
|
||||
|
||||
const handleVideoMouseLeave = () => {
|
||||
if (isPlaying) {
|
||||
if (hideControlsTimer.current) clearTimeout(hideControlsTimer.current);
|
||||
hideControlsTimer.current = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = () => {
|
||||
if (videoUrl) {
|
||||
const link = document.createElement('a');
|
||||
@@ -374,7 +313,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
// 비디오 해상도 계산
|
||||
const getVideoResolution = () => {
|
||||
const savedRatio = localStorage.getItem('castad_video_ratio');
|
||||
return savedRatio === 'horizontal' ? '1234×720' : '720×1234';
|
||||
return savedRatio === 'horizontal' ? '1280×720' : '720×1280';
|
||||
};
|
||||
|
||||
// 파일명 생성
|
||||
@@ -403,7 +342,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
<div className="comp2-grid">
|
||||
{/* 왼쪽: 영상 */}
|
||||
<div className="comp2-video-section">
|
||||
<div className="comp2-video-wrapper" onMouseEnter={handleVideoMouseEnter} onMouseMove={handleVideoMouseMove} onMouseLeave={handleVideoMouseLeave}>
|
||||
<div className="comp2-video-wrapper">
|
||||
{isLoading ? (
|
||||
<div className="comp2-video-loading">
|
||||
<div className="loading-spinner">
|
||||
@@ -426,47 +365,12 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
</button>
|
||||
</div>
|
||||
) : videoUrl ? (
|
||||
<>
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={videoUrl}
|
||||
className="comp2-video-player"
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
onEnded={handleVideoEnded}
|
||||
onClick={togglePlayPause}
|
||||
/>
|
||||
<div className={`comp2-video-controls ${showControls ? 'visible' : 'hidden'}`}>
|
||||
<div className="comp2-progress-bar">
|
||||
<div className="comp2-progress-fill" style={{ width: `${progress}%` }}></div>
|
||||
</div>
|
||||
<div className="comp2-controls-row">
|
||||
<button className="comp2-play-btn" onClick={togglePlayPause}>
|
||||
{isPlaying ? (
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M8 5v14l11-7z"/>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
<div className="comp2-volume-control">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>
|
||||
</svg>
|
||||
<div className="comp2-volume-bar">
|
||||
<div className="comp2-volume-fill"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="comp2-time-display">
|
||||
<span className="comp2-time-current">00:04</span>
|
||||
<span className="comp2-time-divider">/</span>
|
||||
<span className="comp2-time-total">00:34</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
<video
|
||||
src={videoUrl}
|
||||
className="comp2-video-player"
|
||||
controls
|
||||
playsInline
|
||||
/>
|
||||
) : (
|
||||
<div className="comp2-video-placeholder"></div>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user