Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5b7529f17 | ||
|
|
c659f8c2f9 | ||
|
|
c06018d88c |
No files matched your search
@@ -7,6 +7,7 @@ import SocialConnectError from './pages/Social/SocialConnectError';
|
|||||||
import YouTubeOAuthCallback from './pages/Social/YouTubeOAuthCallback';
|
import YouTubeOAuthCallback from './pages/Social/YouTubeOAuthCallback';
|
||||||
import VideoDetailPage from './components/VideoDetailPage';
|
import VideoDetailPage from './components/VideoDetailPage';
|
||||||
import SsulDetailPage from './pages/Ssulbox/SsulDetailPage';
|
import SsulDetailPage from './pages/Ssulbox/SsulDetailPage';
|
||||||
|
import P2vDetailPage from './pages/P2v/P2vDetailPage';
|
||||||
import { kakaoCallback, saveTokens, storeUtmFromUrl, trackViewContent, trackCompleteRegistration } from './utils/api';
|
import { kakaoCallback, saveTokens, storeUtmFromUrl, trackViewContent, trackCompleteRegistration } from './utils/api';
|
||||||
import { clearSessionStorage } from './utils/storageKeys';
|
import { clearSessionStorage } from './utils/storageKeys';
|
||||||
import { NAV } from './components/navItems';
|
import { NAV } from './components/navItems';
|
||||||
@@ -154,6 +155,14 @@ const App: React.FC = () => {
|
|||||||
return <SsulDetailPage contentId={ssulDetailMatch[1]} />;
|
return <SsulDetailPage contentId={ssulDetailMatch[1]} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const p2vDetailMatch = pathname.match(/^\/p2v\/(f1|playreel)\/(\d+)\/?$/);
|
||||||
|
if (p2vDetailMatch) {
|
||||||
|
return <P2vDetailPage
|
||||||
|
contentId={p2vDetailMatch[2]}
|
||||||
|
contentType={p2vDetailMatch[1] === 'f1' ? 'p2v_video' : 'p2v_playreel'}
|
||||||
|
/>;
|
||||||
|
}
|
||||||
|
|
||||||
// 카카오 콜백 처리 중 로딩 화면 표시
|
// 카카오 콜백 처리 중 로딩 화면 표시
|
||||||
if (isProcessingCallback) {
|
if (isProcessingCallback) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const ContentCardSocialActions: React.FC<ContentCardSocialActionsProps> = ({
|
|||||||
commentCount,
|
commentCount,
|
||||||
initialLikeCount,
|
initialLikeCount,
|
||||||
initialIsLiked = false,
|
initialIsLiked = false,
|
||||||
}) => {
|
}: ContentCardSocialActionsProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [likeCount, setLikeCount] = useState(initialLikeCount);
|
const [likeCount, setLikeCount] = useState(initialLikeCount);
|
||||||
|
|||||||
@@ -0,0 +1,489 @@
|
|||||||
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import {
|
||||||
|
API_URL,
|
||||||
|
deleteComment,
|
||||||
|
getSsulContentById,
|
||||||
|
getUserMe,
|
||||||
|
getVideoComments,
|
||||||
|
isLoggedIn,
|
||||||
|
postVideoComment,
|
||||||
|
toggleVideoLike,
|
||||||
|
} from '../utils/api';
|
||||||
|
import type { SsulDetailItem } from '../utils/api';
|
||||||
|
import { CommentItem, P2vContentType, UserMeResponse } from '../types/api';
|
||||||
|
import { buildContentShareUrl, tryNativeShare } from '../utils/nativeShare';
|
||||||
|
import LoginPromptModal from './LoginPromptModal';
|
||||||
|
import { isSafeHttpUrl } from '../utils/url';
|
||||||
|
import { getP2vContentById } from '../utils/p2vApi';
|
||||||
|
|
||||||
|
interface ContentDetailContentProps {
|
||||||
|
contentId: string;
|
||||||
|
contentType: 'ssul' | P2vContentType;
|
||||||
|
isModal?: boolean;
|
||||||
|
onClose?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type DetailContent = Pick<SsulDetailItem,
|
||||||
|
'video_url' | 'store_name' | 'official_site_url' | 'created_at' | 'like_count' | 'is_liked_by_me'
|
||||||
|
> & { poster_url?: string | null };
|
||||||
|
|
||||||
|
/** Shared public detail UI for Ssulbox and P2V content. */
|
||||||
|
const ContentDetailContent: React.FC<ContentDetailContentProps> = ({
|
||||||
|
contentId,
|
||||||
|
contentType,
|
||||||
|
isModal = false,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const authed = isLoggedIn();
|
||||||
|
|
||||||
|
const [content, setContent] = useState<DetailContent | null>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const [likeCount, setLikeCount] = useState(0);
|
||||||
|
const [isLiked, setIsLiked] = useState(false);
|
||||||
|
const [likeSubmitting, setLikeSubmitting] = useState(false);
|
||||||
|
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
const [isLandscape, setIsLandscape] = useState(false);
|
||||||
|
const [showSiteOverlay, setShowSiteOverlay] = useState(false);
|
||||||
|
const [showLoginModal, setShowLoginModal] = useState(false);
|
||||||
|
|
||||||
|
const [comments, setComments] = useState<CommentItem[]>([]);
|
||||||
|
const [commentsTotal, setCommentsTotal] = useState(0);
|
||||||
|
const [commentsPage, setCommentsPage] = useState(1);
|
||||||
|
const [commentsHasNext, setCommentsHasNext] = useState(false);
|
||||||
|
const [commentsLoading, setCommentsLoading] = useState(false);
|
||||||
|
const [commentInput, setCommentInput] = useState('');
|
||||||
|
const [commentSubmitting, setCommentSubmitting] = useState(false);
|
||||||
|
const commentTextareaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
|
||||||
|
const [currentUser, setCurrentUser] = useState<UserMeResponse | null>(null);
|
||||||
|
|
||||||
|
const fetchComments = useCallback(
|
||||||
|
async (page: number, append = false) => {
|
||||||
|
setCommentsLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await getVideoComments(contentId, page, 20, contentType);
|
||||||
|
const sorted = [...res.items].sort(
|
||||||
|
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
||||||
|
);
|
||||||
|
setComments((prev) => (append ? [...prev, ...sorted] : sorted));
|
||||||
|
setCommentsTotal(res.total);
|
||||||
|
setCommentsHasNext(res.has_next);
|
||||||
|
setCommentsPage(page);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch content comments:', err);
|
||||||
|
} finally {
|
||||||
|
setCommentsLoading(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[contentId, contentType]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchContent = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
setError(null);
|
||||||
|
setShowSiteOverlay(false);
|
||||||
|
try {
|
||||||
|
const data = contentType === 'ssul'
|
||||||
|
? await getSsulContentById(contentId)
|
||||||
|
: await getP2vContentById(contentType, contentId).then((item) => ({
|
||||||
|
...item, store_name: item.title,
|
||||||
|
}));
|
||||||
|
setContent(data);
|
||||||
|
setLikeCount(data.like_count);
|
||||||
|
setIsLiked(data.is_liked_by_me);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch content:', err);
|
||||||
|
setError(t('ado2Contents.loadFailed'));
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
setIsLandscape(false);
|
||||||
|
fetchContent();
|
||||||
|
fetchComments(1);
|
||||||
|
}, [contentId, contentType, fetchComments, t]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!authed) return;
|
||||||
|
getUserMe().then(setCurrentUser).catch((err) => {
|
||||||
|
console.error('Failed to fetch current user:', err);
|
||||||
|
});
|
||||||
|
}, [authed]);
|
||||||
|
|
||||||
|
const formatDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return t('videoDetail.dateFormat', {
|
||||||
|
year: date.getFullYear(),
|
||||||
|
month: date.getMonth() + 1,
|
||||||
|
day: date.getDate(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatCommentDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(
|
||||||
|
date.getDate()
|
||||||
|
).padStart(2, '0')}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ID 가 같아도 콘텐츠 종류에 맞는 공유 경로로 연다.
|
||||||
|
const shareUrl = buildContentShareUrl(API_URL, contentId, contentType);
|
||||||
|
|
||||||
|
const handleCopyLink = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(shareUrl);
|
||||||
|
} catch {
|
||||||
|
// clipboard API 미지원 환경에서는 무시
|
||||||
|
}
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => setCopied(false), 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleShareButtonClick = async () => {
|
||||||
|
const handled = await tryNativeShare({
|
||||||
|
title: content?.store_name ?? t('videoDetail.kakaoDefaultTitle'),
|
||||||
|
url: shareUrl,
|
||||||
|
});
|
||||||
|
if (handled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await handleCopyLink();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLike = async () => {
|
||||||
|
if (!authed) {
|
||||||
|
setShowLoginModal(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (likeSubmitting) return;
|
||||||
|
const prevLiked = isLiked;
|
||||||
|
const prevCount = likeCount;
|
||||||
|
setLikeSubmitting(true);
|
||||||
|
setIsLiked(!prevLiked);
|
||||||
|
setLikeCount(prevLiked ? prevCount - 1 : prevCount + 1);
|
||||||
|
try {
|
||||||
|
const result = await toggleVideoLike(contentId, contentType);
|
||||||
|
setIsLiked(result.is_liked);
|
||||||
|
setLikeCount(result.like_count);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to toggle content like:', err);
|
||||||
|
setIsLiked(prevLiked);
|
||||||
|
setLikeCount(prevCount);
|
||||||
|
} finally {
|
||||||
|
setLikeSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleHeaderAction = () => {
|
||||||
|
onClose?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCommentFocus = () => {
|
||||||
|
if (!authed) setShowLoginModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCommentSubmit = async () => {
|
||||||
|
if (!authed) {
|
||||||
|
setShowLoginModal(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!commentInput.trim() || commentSubmitting) return;
|
||||||
|
setCommentSubmitting(true);
|
||||||
|
try {
|
||||||
|
await postVideoComment(contentId, commentInput.trim(), undefined, contentType);
|
||||||
|
setCommentInput('');
|
||||||
|
if (commentTextareaRef.current) {
|
||||||
|
commentTextareaRef.current.style.height = 'auto';
|
||||||
|
}
|
||||||
|
await fetchComments(1);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to post content comment:', err);
|
||||||
|
} finally {
|
||||||
|
setCommentSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteComment = async (commentId: number) => {
|
||||||
|
try {
|
||||||
|
await deleteComment(commentId);
|
||||||
|
await fetchComments(commentsPage);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to delete content comment:', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderCommentContent = (content_: string | null, isDeleted: boolean) => {
|
||||||
|
if (isDeleted) {
|
||||||
|
return (
|
||||||
|
<span style={{ color: '#6B9EA0', fontStyle: 'italic' }}>
|
||||||
|
{t('videoDetail.deletedComment')}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return content_;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={isModal ? 'video-detail-modal-content' : 'video-detail-page-content'}>
|
||||||
|
{/* 헤더 */}
|
||||||
|
<div className="video-detail-header">
|
||||||
|
{isModal ? (
|
||||||
|
<>
|
||||||
|
{/* 제목이 없으면 space-between 인 헤더에서 닫기 버튼이 왼쪽으로 붙는다.
|
||||||
|
문구는 ADO2 상세와 같은 키를 쓴다 — 통합 목록에서 열리는 같은
|
||||||
|
모달이므로 콘텐츠 종류에 따라 제목이 바뀌면 오히려 어색하다. */}
|
||||||
|
<h2 className="video-detail-modal-title">{t('sidebar.ado2Contents')}</h2>
|
||||||
|
<button className="video-detail-close-btn" onClick={handleHeaderAction} aria-label={t('videoDetail.closeAriaLabel')}>
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<button className="video-detail-back-btn" onClick={handleHeaderAction}>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<path d="M13 4l-6 6 6 6" />
|
||||||
|
</svg>
|
||||||
|
{t('sidebar.ado2Contents')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="video-detail-body">
|
||||||
|
{loading ? (
|
||||||
|
<div className="ado2-contents-loading">
|
||||||
|
<div className="loading-spinner"></div>
|
||||||
|
<p>{t('ado2Contents.loading')}</p>
|
||||||
|
</div>
|
||||||
|
) : error ? (
|
||||||
|
<div className="ado2-contents-error"><p>{error}</p></div>
|
||||||
|
) : content ? (
|
||||||
|
<div className={`video-detail-content ${isLandscape ? 'landscape' : ''}`}>
|
||||||
|
<div className="video-detail-player-wrap">
|
||||||
|
<video
|
||||||
|
src={content.video_url}
|
||||||
|
poster={content.poster_url ?? undefined}
|
||||||
|
controls
|
||||||
|
autoPlay
|
||||||
|
playsInline
|
||||||
|
controlsList="nodownload"
|
||||||
|
onContextMenu={(e) => e.preventDefault()}
|
||||||
|
className="video-detail-player"
|
||||||
|
onLoadedMetadata={(e) => {
|
||||||
|
const v = e.currentTarget;
|
||||||
|
setIsLandscape(v.videoWidth > v.videoHeight);
|
||||||
|
}}
|
||||||
|
onTimeUpdate={(e) => {
|
||||||
|
if (!content.official_site_url) return;
|
||||||
|
const v = e.currentTarget;
|
||||||
|
// 영상 종료 3초 전부터 공식 홈페이지 오버레이 노출
|
||||||
|
setShowSiteOverlay(
|
||||||
|
Number.isFinite(v.duration) && v.duration - v.currentTime <= 3
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{showSiteOverlay && isSafeHttpUrl(content.official_site_url) && (
|
||||||
|
<a
|
||||||
|
href={content.official_site_url as string}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="video-site-overlay"
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<circle cx="12" cy="12" r="10"/>
|
||||||
|
<line x1="2" y1="12" x2="22" y2="12"/>
|
||||||
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
|
||||||
|
</svg>
|
||||||
|
<span className="video-site-overlay-text">
|
||||||
|
<strong>{content.store_name}</strong>
|
||||||
|
{t('videoDetail.siteOverlayLabel')}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="video-detail-info">
|
||||||
|
<h2 className="video-detail-store">
|
||||||
|
{content.store_name || t('ssulbox.viewer.untitled')}
|
||||||
|
</h2>
|
||||||
|
<p className="video-detail-date">{formatDate(content.created_at)}</p>
|
||||||
|
|
||||||
|
{/* 좋아요 + 공유 */}
|
||||||
|
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
||||||
|
<button
|
||||||
|
className={`video-detail-like-btn ${isLiked ? 'liked' : ''}`}
|
||||||
|
onClick={handleLike}
|
||||||
|
disabled={likeSubmitting}
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill={isLiked ? 'currentColor' : 'none'} stroke="currentColor" strokeWidth="2">
|
||||||
|
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
||||||
|
</svg>
|
||||||
|
{likeCount}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="video-detail-copy-btn"
|
||||||
|
onClick={handleShareButtonClick}
|
||||||
|
title={t('videoDetail.share')}
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<circle cx="18" cy="5" r="3" /><circle cx="6" cy="12" r="3" /><circle cx="18" cy="19" r="3" />
|
||||||
|
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" /><line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
||||||
|
</svg>
|
||||||
|
{copied ? t('videoDetail.copied') : t('videoDetail.share')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 댓글 섹션 */}
|
||||||
|
<div className="video-detail-comments">
|
||||||
|
<div className="video-detail-comments-header">
|
||||||
|
<h3 className="video-detail-comments-title">{t('videoDetail.commentsTitle')}</h3>
|
||||||
|
<span className="video-detail-comments-count">{commentsTotal}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{authed && currentUser && (
|
||||||
|
<div className="video-detail-comment-profile">
|
||||||
|
{currentUser.profile_image_url && (
|
||||||
|
<img
|
||||||
|
src={currentUser.profile_image_url}
|
||||||
|
alt={currentUser.nickname}
|
||||||
|
className="video-detail-comment-avatar"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<span className="video-detail-comment-nickname">{currentUser.nickname}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="video-detail-comment-input-wrap">
|
||||||
|
<textarea
|
||||||
|
ref={commentTextareaRef}
|
||||||
|
className="video-detail-comment-input"
|
||||||
|
placeholder={authed ? t('videoDetail.commentPlaceholder') : t('videoDetail.commentLoginRequired')}
|
||||||
|
maxLength={500}
|
||||||
|
rows={1}
|
||||||
|
value={commentInput}
|
||||||
|
onChange={(e) => {
|
||||||
|
setCommentInput(e.target.value);
|
||||||
|
e.target.style.height = 'auto';
|
||||||
|
e.target.style.height = `${e.target.scrollHeight}px`;
|
||||||
|
}}
|
||||||
|
onFocus={handleCommentFocus}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
handleCommentSubmit();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
disabled={!authed}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-submit"
|
||||||
|
onClick={handleCommentSubmit}
|
||||||
|
disabled={!authed || !commentInput.trim() || commentSubmitting}
|
||||||
|
>
|
||||||
|
{commentSubmitting ? t('videoDetail.commentSubmitting') : t('videoDetail.commentSubmit')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{comments.length === 0 && !commentsLoading ? (
|
||||||
|
<p className="video-detail-comments-empty">{t('videoDetail.noComments')}</p>
|
||||||
|
) : (
|
||||||
|
<ul className="video-detail-comment-list">
|
||||||
|
{comments.map((c) => (
|
||||||
|
<li key={c.id} className="video-detail-comment-item">
|
||||||
|
{c.profile_image_url && (
|
||||||
|
<img
|
||||||
|
src={c.profile_image_url}
|
||||||
|
alt={c.nickname || t('videoDetail.anonymous')}
|
||||||
|
className="video-detail-comment-avatar"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="video-detail-comment-body">
|
||||||
|
<span className="video-detail-comment-nickname">
|
||||||
|
{c.nickname || t('videoDetail.anonymous')}
|
||||||
|
</span>
|
||||||
|
<p className="video-detail-comment-text">
|
||||||
|
{renderCommentContent(c.content, c.is_deleted)}
|
||||||
|
</p>
|
||||||
|
<div className="video-detail-comment-bottom">
|
||||||
|
<span className="video-detail-comment-date">{formatCommentDate(c.created_at)}</span>
|
||||||
|
{c.is_mine && !c.is_deleted && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-delete"
|
||||||
|
onClick={() => handleDeleteComment(c.id)}
|
||||||
|
>
|
||||||
|
{t('videoDetail.deleteComment')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{c.replies && c.replies.length > 0 && (
|
||||||
|
<ul className="video-detail-reply-list">
|
||||||
|
{c.replies.map((r) => (
|
||||||
|
<li key={r.id} className="video-detail-reply-item">
|
||||||
|
{r.profile_image_url && (
|
||||||
|
<img
|
||||||
|
src={r.profile_image_url}
|
||||||
|
alt={r.nickname || t('videoDetail.anonymous')}
|
||||||
|
className="video-detail-comment-avatar small"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="video-detail-comment-body">
|
||||||
|
<span className="video-detail-comment-nickname">
|
||||||
|
{r.nickname || t('videoDetail.anonymous')}
|
||||||
|
</span>
|
||||||
|
<p className="video-detail-comment-text">
|
||||||
|
{renderCommentContent(r.content, r.is_deleted)}
|
||||||
|
</p>
|
||||||
|
<div className="video-detail-comment-bottom">
|
||||||
|
<span className="video-detail-comment-date">{formatCommentDate(r.created_at)}</span>
|
||||||
|
{r.is_mine && !r.is_deleted && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-delete"
|
||||||
|
onClick={() => handleDeleteComment(r.id)}
|
||||||
|
>
|
||||||
|
{t('videoDetail.deleteComment')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{commentsHasNext && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comments-more"
|
||||||
|
onClick={() => fetchComments(commentsPage + 1, true)}
|
||||||
|
disabled={commentsLoading}
|
||||||
|
>
|
||||||
|
{commentsLoading ? t('videoDetail.loadingComments') : t('videoDetail.loadMoreComments')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showLoginModal && (
|
||||||
|
<LoginPromptModal onClose={() => setShowLoginModal(false)} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ContentDetailContent;
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { P2vLicense } from '../utils/p2vApi';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 스타일 템플릿의 배포 등급 표시.
|
|
||||||
*
|
|
||||||
* 왜 카드마다 붙이나 — 퍼블릭 도메인 명화와 영화 포스터가 한 그리드에 섞여 있어
|
|
||||||
* 페이지 배너로는 **어느 결과물이 공개 가능한지** 구분되지 않는다. 경고 문구는
|
|
||||||
* 실제로 고른 순간에만 띄운다(항상 떠 있으면 아무도 안 읽는다).
|
|
||||||
*/
|
|
||||||
|
|
||||||
const CLASS: Record<P2vLicense, string> = {
|
|
||||||
'public-domain': 'ok',
|
|
||||||
'internal-only': 'warn',
|
|
||||||
// 내부 전용과 색을 나눈다 — 해제 조건도, 책임 주체도 다르다
|
|
||||||
'user-uploaded': 'unknown',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const LicenseBadge: React.FC<{ license: P2vLicense }> = ({ license }) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const variant = CLASS[license] ?? CLASS['internal-only'];
|
|
||||||
return (
|
|
||||||
<span className={`p2v-license p2v-license--${variant}`}>
|
|
||||||
{t(`poster.styling.license.${license}`)}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 내부 전용 템플릿을 고른 순간의 경고 */
|
|
||||||
export const InternalOnlyWarning: React.FC<{ note?: string }> = ({ note }) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
return (
|
|
||||||
<div className="p2v-notice p2v-notice--warn">
|
|
||||||
<b>{t('poster.styling.internalOnlyTitle')}</b>
|
|
||||||
{' — '}
|
|
||||||
{note || t('poster.styling.internalOnlyBody')}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 사용자가 올린 레퍼런스 고지 — 남의 저작물일 수 있다 */
|
|
||||||
export const UserReferenceNotice: React.FC = () => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
return <div className="p2v-notice p2v-notice--unknown">{t('poster.styling.userRefNotice')}</div>;
|
|
||||||
};
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { getP2vKey, setP2vKey } from '../utils/p2vApi';
|
|
||||||
|
|
||||||
interface P2vKeyGateProps {
|
|
||||||
/** 키를 저장한 뒤 호출 — 호출부가 실패했던 요청을 다시 태운다 */
|
|
||||||
onSaved: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* P2V 접근 키 입력.
|
|
||||||
*
|
|
||||||
* P2V 웹은 401 에서 `window.prompt` 를 띄우지만(내부 도구라 그걸로 충분했다),
|
|
||||||
* castad 안에서는 제품 화면 한가운데라 시스템 다이얼로그가 튀어나오면 어색하다.
|
|
||||||
* 디자인 시스템 문법(민트 테두리 알림 + pill 입력)으로 인라인 처리한다.
|
|
||||||
*/
|
|
||||||
const P2vKeyGate: React.FC<P2vKeyGateProps> = ({ onSaved }) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [value, setValue] = useState(getP2vKey());
|
|
||||||
|
|
||||||
const save = () => {
|
|
||||||
if (!value.trim()) return;
|
|
||||||
setP2vKey(value);
|
|
||||||
onSaved();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="p2v-keygate">
|
|
||||||
<p className="p2v-keygate__title">{t('poster.key.title')}</p>
|
|
||||||
<p className="p2v-keygate__desc">{t('poster.key.desc')}</p>
|
|
||||||
<div className="p2v-keygate__row">
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
className="p2v-input"
|
|
||||||
placeholder={t('poster.key.placeholder')}
|
|
||||||
value={value}
|
|
||||||
onChange={(e) => setValue(e.target.value)}
|
|
||||||
onKeyDown={(e) => e.key === 'Enter' && save()}
|
|
||||||
autoComplete="off"
|
|
||||||
/>
|
|
||||||
<button type="button" className="p2v-btn-mint" disabled={!value.trim()} onClick={save}>
|
|
||||||
{t('poster.key.save')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default P2vKeyGate;
|
|
||||||
@@ -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;
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { BookIcon, StorefrontIcon } from './pipelineIcons';
|
import { BookIcon, PosterVideoIcon, StorefrontIcon } from './pipelineIcons';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 생성할 콘텐츠 종류. 진입 화면에서 고르면 이후 플로우 전체가 갈린다.
|
* 생성할 콘텐츠 종류. 진입 화면에서 고르면 이후 플로우 전체가 갈린다.
|
||||||
*
|
*
|
||||||
* poster·styling 은 castad 백엔드가 아니라 **P2V 서버(:8010)** 를 쓴다(utils/p2vApi.ts).
|
* poster·playreel 은 castad 백엔드의 `/p2v/*` 를 쓴다(utils/p2vApi.ts, utils/playreelApi.ts).
|
||||||
*/
|
*/
|
||||||
export type Pipeline = 'ado2' | 'ssul' | 'poster' | 'styling';
|
export type Pipeline = 'ado2' | 'ssul' | 'poster' | 'playreel';
|
||||||
|
|
||||||
/** 유효한 파이프라인 값인가 — localStorage 복원 때 쓴다 */
|
/** 유효한 파이프라인 값인가 — localStorage 복원 때 쓴다 */
|
||||||
export const PIPELINES: readonly Pipeline[] = ['ado2', 'ssul', 'poster', 'styling'];
|
export const PIPELINES: readonly Pipeline[] = ['ado2', 'ssul', 'poster', 'playreel'];
|
||||||
|
|
||||||
export const isPipeline = (value: unknown): value is Pipeline =>
|
export const isPipeline = (value: unknown): value is Pipeline =>
|
||||||
typeof value === 'string' && (PIPELINES as readonly string[]).includes(value);
|
typeof value === 'string' && (PIPELINES as readonly string[]).includes(value);
|
||||||
@@ -23,7 +23,7 @@ interface PipelineTabsProps {
|
|||||||
const TABS: { id: Pipeline; labelKey: string; Icon: React.FC<{ size?: number }> }[] = [
|
const TABS: { id: Pipeline; labelKey: string; Icon: React.FC<{ size?: number }> }[] = [
|
||||||
{ id: 'ado2', labelKey: 'pipelineTabs.ado2', Icon: StorefrontIcon },
|
{ id: 'ado2', labelKey: 'pipelineTabs.ado2', Icon: StorefrontIcon },
|
||||||
{ id: 'ssul', labelKey: 'pipelineTabs.ssul', Icon: BookIcon },
|
{ id: 'ssul', labelKey: 'pipelineTabs.ssul', Icon: BookIcon },
|
||||||
// 'poster', 'styling' 탭은 메뉴에서 숨김 (Pipeline 타입/로직은 유지)
|
{ id: 'poster', labelKey: 'pipelineTabs.poster', Icon: PosterVideoIcon },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,11 +44,13 @@ const TABS: { id: Pipeline; labelKey: string; Icon: React.FC<{ size?: number }>
|
|||||||
*/
|
*/
|
||||||
const PipelineTabs: React.FC<PipelineTabsProps> = ({ value, onChange }) => {
|
const PipelineTabs: React.FC<PipelineTabsProps> = ({ value, onChange }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
// 롱컷은 무빙 포스터 안의 두 번째 갈래라 별도 탭이 없다. 그 안에 있을 때도 무빙 포스터 탭을 켠다
|
||||||
|
const active: Pipeline = value === 'playreel' ? 'poster' : value;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="pipeline-tabs"
|
className="pipeline-tabs"
|
||||||
data-active={value}
|
data-active={active}
|
||||||
role="tablist"
|
role="tablist"
|
||||||
aria-label={t('pipelineTabs.ariaLabel')}
|
aria-label={t('pipelineTabs.ariaLabel')}
|
||||||
>
|
>
|
||||||
@@ -57,7 +59,7 @@ const PipelineTabs: React.FC<PipelineTabsProps> = ({ value, onChange }) => {
|
|||||||
key={id}
|
key={id}
|
||||||
type="button"
|
type="button"
|
||||||
role="tab"
|
role="tab"
|
||||||
aria-selected={value === id}
|
aria-selected={active === id}
|
||||||
className="pipeline-tab"
|
className="pipeline-tab"
|
||||||
onClick={() => onChange(id)}
|
onClick={() => onChange(id)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { getSocialAccounts, uploadToSocial, waitForUploadComplete, TokenExpiredError, handleSocialReconnect, getAutoSeoYoutube } from '../utils/api';
|
import { getSocialAccounts, uploadToSocial, waitForUploadComplete, TokenExpiredError, handleSocialReconnect, getAutoSeoYoutube } from '../utils/api';
|
||||||
import { SocialAccount, VideoListItem, SocialUploadStatusResponse } from '../types/api';
|
import { SocialAccount, SocialUploadableItem, SocialUploadStatusResponse } from '../types/api';
|
||||||
import UploadProgressModal, { UploadStatus } from './UploadProgressModal';
|
import UploadProgressModal, { UploadStatus } from './UploadProgressModal';
|
||||||
import { useOverlayClose } from '../hooks/useOverlayClose';
|
import { useOverlayClose } from '../hooks/useOverlayClose';
|
||||||
|
|
||||||
interface SocialPostingModalProps {
|
interface SocialPostingModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
video: VideoListItem | null;
|
video: SocialUploadableItem | null;
|
||||||
onGoToCalendar?: () => void;
|
onGoToCalendar?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,8 +199,8 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
|||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const seoKey =
|
const seoKey =
|
||||||
video?.type === 'ssul'
|
video && video.type !== 'video'
|
||||||
? `ssul:${video.video_id}`
|
? `${video.type}:${video.video_id}`
|
||||||
: video?.task_id || null;
|
: video?.task_id || null;
|
||||||
const expired = now - loadedAtRef.current > SEO_CACHE_TTL;
|
const expired = now - loadedAtRef.current > SEO_CACHE_TTL;
|
||||||
|
|
||||||
@@ -244,20 +244,20 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
|||||||
/**
|
/**
|
||||||
* 제목·설명·태그 자동 채움.
|
* 제목·설명·태그 자동 채움.
|
||||||
*
|
*
|
||||||
* `seoKey` 는 호출부가 만든 캐시 키다(ADO2=task_id, 썰박스=`ssul:{id}`).
|
* `seoKey` 는 호출부가 만든 캐시 키다(ADO2=task_id, 썰박스=`ssul:{id}`, 무빙 포스터=`p2v_video:{id}`).
|
||||||
* 백엔드에 보낼 식별자는 종류마다 다르다 — ADO2 는 task_id(UUID), 썰박스는
|
* 백엔드에 보낼 식별자는 종류마다 다르다 — ADO2 는 task_id(UUID), 썰박스·무빙 포스터는
|
||||||
* ssul_content.id 문자열이며, 서버가 content_type 으로 어느 테이블을 볼지 가른다.
|
* 콘텐츠 id 문자열이며, 서버가 content_type 으로 어느 테이블을 볼지 가른다.
|
||||||
*/
|
*/
|
||||||
const loadAutocomplete = async (seoKey: string) => {
|
const loadAutocomplete = async (seoKey: string) => {
|
||||||
if (!video) return;
|
if (!video) return;
|
||||||
const isSsul = video.type === 'ssul';
|
const byContentId = video.type !== 'video';
|
||||||
if (!isSsul && !video.task_id) return;
|
if (!byContentId && !video.task_id) return;
|
||||||
|
|
||||||
setIsLoadingAutoDescription(true);
|
setIsLoadingAutoDescription(true);
|
||||||
try {
|
try {
|
||||||
const requestPayload = {
|
const requestPayload = {
|
||||||
content_type: video.type,
|
content_type: video.type,
|
||||||
task_id: isSsul ? String(video.video_id) : video.task_id,
|
task_id: byContentId ? String(video.video_id) : video.task_id,
|
||||||
};
|
};
|
||||||
const autoSeoResponse = await getAutoSeoYoutube(requestPayload);
|
const autoSeoResponse = await getAutoSeoYoutube(requestPayload);
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,3 @@ export const PosterVideoIcon: React.FC<IconProps> = ({ size = 24 }) => (
|
|||||||
<path d="M10.5 9v6l4.2-3z" fill="currentColor" />
|
<path d="M10.5 9v6l4.2-3z" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
/** 포스터 스타일 — 화풍 재해석 → 팔레트 */
|
|
||||||
export const PaletteIcon: React.FC<IconProps> = ({ size = 24 }) => (
|
|
||||||
<svg {...base(size)} aria-hidden="true">
|
|
||||||
<path d="M12 3a9 9 0 1 0 0 18 1.8 1.8 0 0 0 1.35-3 1.8 1.8 0 0 1 1.35-3H17a4 4 0 0 0 4-4c0-4.42-4.03-8-9-8z" />
|
|
||||||
<circle cx="7.6" cy="12.4" r="1.1" fill="currentColor" stroke="none" />
|
|
||||||
<circle cx="9.8" cy="8.2" r="1.1" fill="currentColor" stroke="none" />
|
|
||||||
<circle cx="14.6" cy="7.6" r="1.1" fill="currentColor" stroke="none" />
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
+5
-95
@@ -1,97 +1,7 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { P2vJob, getPosterJob, isP2vActive } from '../utils/p2vApi';
|
||||||
import {
|
import { UsePolledJobResult, usePolledJob } from './usePolledJob';
|
||||||
P2vAuthError,
|
|
||||||
P2vJob,
|
|
||||||
P2vNotFoundError,
|
|
||||||
getPosterJob,
|
|
||||||
getStylingJob,
|
|
||||||
isP2vActive,
|
|
||||||
} from '../utils/p2vApi';
|
|
||||||
|
|
||||||
interface UseP2vJobResult {
|
/** 무빙 포스터 잡 폴링. 검수 대기·완료·실패에서는 멈춘다 */
|
||||||
job: P2vJob | null;
|
export function useP2vJob(id: string | null): UsePolledJobResult<P2vJob> {
|
||||||
error: string | null;
|
return usePolledJob(id, getPosterJob, isP2vActive);
|
||||||
/** 401 — 화면이 접근 키 입력을 띄워야 한다 */
|
|
||||||
authNeeded: boolean;
|
|
||||||
/** 404 — 서버에 없는 잡이다. 호출부가 화면을 처음으로 되돌려야 한다 */
|
|
||||||
notFound: boolean;
|
|
||||||
/** 즉시 1회 조회하고, 멈춰 있던 폴링을 다시 켠다 (승인·재시도 직후에 쓴다) */
|
|
||||||
refresh: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const POLL_INTERVAL = 2500;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* P2V 잡 폴링 훅.
|
|
||||||
*
|
|
||||||
* castad 에는 웹소켓이 없고 썰박스도 폴링(`waitForSsulComplete`)이라 같은 방식을 쓴다.
|
|
||||||
* 다만 썰박스는 "끝날 때까지 기다리는" 재귀 함수인 반면 이쪽은 **중간 상태를 계속
|
|
||||||
* 그려야** 한다 — 검수 게이트에서 멈춰 사용자 입력을 기다리기 때문이다.
|
|
||||||
*
|
|
||||||
* 폴링은 queued/running 에서만 돈다. awaiting_review·done·failed 는 사용자가 뭔가
|
|
||||||
* 하기 전까지 절대 안 바뀌므로 계속 두드리면 서버만 때린다. 승인·재시도 후에는
|
|
||||||
* 호출부가 refresh() 로 다시 켠다.
|
|
||||||
*/
|
|
||||||
export function useP2vJob(kind: 'f1' | 'f2', id: string | null): UseP2vJobResult {
|
|
||||||
const [job, setJob] = useState<P2vJob | null>(null);
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
const [authNeeded, setAuthNeeded] = useState(false);
|
|
||||||
const [notFound, setNotFound] = useState(false);
|
|
||||||
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
||||||
|
|
||||||
const stop = useCallback(() => {
|
|
||||||
if (timerRef.current) {
|
|
||||||
clearInterval(timerRef.current);
|
|
||||||
timerRef.current = null;
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const fetchOnce = useCallback(async (jobId: string) => {
|
|
||||||
try {
|
|
||||||
const next = kind === 'f1' ? await getPosterJob(jobId) : await getStylingJob(jobId);
|
|
||||||
setJob(next);
|
|
||||||
setError(null);
|
|
||||||
setAuthNeeded(false);
|
|
||||||
setNotFound(false);
|
|
||||||
if (!isP2vActive(next)) stop();
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof P2vAuthError) {
|
|
||||||
setAuthNeeded(true);
|
|
||||||
stop(); // 키가 없으면 계속 두드려봐야 401만 쌓인다
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e instanceof P2vNotFoundError) {
|
|
||||||
setNotFound(true);
|
|
||||||
stop(); // 없는 잡은 다시 생기지 않는다
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setError((e as Error).message);
|
|
||||||
}
|
|
||||||
}, [kind, stop]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!id) {
|
|
||||||
setJob(null);
|
|
||||||
setError(null);
|
|
||||||
setNotFound(false);
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 잡이 바뀌면 이전 잡의 상태가 한 틱 남아 보이므로 먼저 비운다
|
|
||||||
setJob(null);
|
|
||||||
setNotFound(false);
|
|
||||||
fetchOnce(id);
|
|
||||||
timerRef.current = setInterval(() => fetchOnce(id), POLL_INTERVAL);
|
|
||||||
return stop;
|
|
||||||
}, [id, fetchOnce, stop]);
|
|
||||||
|
|
||||||
const refresh = useCallback(() => {
|
|
||||||
if (!id) return;
|
|
||||||
fetchOnce(id);
|
|
||||||
if (!timerRef.current) {
|
|
||||||
timerRef.current = setInterval(() => fetchOnce(id), POLL_INTERVAL);
|
|
||||||
}
|
|
||||||
}, [id, fetchOnce]);
|
|
||||||
|
|
||||||
return { job, error, authNeeded, notFound, refresh };
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { PlayreelJob, getPlayreelJob } from '../utils/playreelApi';
|
||||||
|
import { UsePolledJobResult, usePolledJob } from './usePolledJob';
|
||||||
|
|
||||||
|
const isActive = (job: PlayreelJob): boolean => job.status === 'queued' || job.status === 'running';
|
||||||
|
|
||||||
|
/** 롱컷 잡 폴링. 검수 게이트(awaiting_review)에서는 멈춘다 */
|
||||||
|
export function usePlayreelJob(id: string | null): UsePolledJobResult<PlayreelJob> {
|
||||||
|
return usePolledJob(id, getPlayreelJob, isActive);
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { P2vNotFoundError } from '../utils/p2vApi';
|
||||||
|
|
||||||
|
export interface UsePolledJobResult<T> {
|
||||||
|
job: T | null;
|
||||||
|
error: string | null;
|
||||||
|
/** 404 — 서버에 없는 잡이다. 호출부가 화면을 처음으로 되돌려야 한다 */
|
||||||
|
notFound: boolean;
|
||||||
|
/** 즉시 1회 조회하고, 멈춰 있던 폴링을 다시 켠다 (승인·재시도 직후에 쓴다) */
|
||||||
|
refresh: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const POLL_INTERVAL = 2500;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* P2V 잡 폴링 훅(무빙 포스터·롱컷 공용).
|
||||||
|
*
|
||||||
|
* castad 에는 웹소켓이 없고 썰박스도 폴링(`waitForSsulComplete`)이라 같은 방식을 쓴다.
|
||||||
|
* 다만 썰박스는 "끝날 때까지 기다리는" 재귀 함수인 반면 이쪽은 **중간 상태를 계속
|
||||||
|
* 그려야** 한다 — 검수 게이트에서 멈춰 사용자 입력을 기다리기 때문이다.
|
||||||
|
*
|
||||||
|
* 폴링은 활성(`isActive`) 상태에서만 돈다. 검수 대기·완료·실패는 사용자가 뭔가
|
||||||
|
* 하기 전까지 절대 안 바뀌므로 계속 두드리면 서버만 때린다. 승인·재시도 후에는
|
||||||
|
* 호출부가 refresh() 로 다시 켠다.
|
||||||
|
*
|
||||||
|
* `fetchJob`·`isActive` 는 모듈 상수여야 한다 — 바뀌면 폴링이 다시 시작된다.
|
||||||
|
*/
|
||||||
|
export function usePolledJob<T>(
|
||||||
|
id: string | null,
|
||||||
|
fetchJob: (id: string) => Promise<T>,
|
||||||
|
isActive: (job: T) => boolean,
|
||||||
|
): UsePolledJobResult<T> {
|
||||||
|
const [job, setJob] = useState<T | null>(null);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const [notFound, setNotFound] = useState(false);
|
||||||
|
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||||
|
|
||||||
|
const stop = useCallback(() => {
|
||||||
|
if (timerRef.current) {
|
||||||
|
clearInterval(timerRef.current);
|
||||||
|
timerRef.current = null;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const fetchOnce = useCallback(async (jobId: string) => {
|
||||||
|
try {
|
||||||
|
const next = await fetchJob(jobId);
|
||||||
|
setJob(next);
|
||||||
|
setError(null);
|
||||||
|
setNotFound(false);
|
||||||
|
if (!isActive(next)) stop();
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof P2vNotFoundError) {
|
||||||
|
setNotFound(true);
|
||||||
|
stop(); // 없는 잡은 다시 생기지 않는다
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setError((e as Error).message);
|
||||||
|
}
|
||||||
|
}, [fetchJob, isActive, stop]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!id) {
|
||||||
|
setJob(null);
|
||||||
|
setError(null);
|
||||||
|
setNotFound(false);
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 잡이 바뀌면 이전 잡의 상태가 한 틱 남아 보이므로 먼저 비운다
|
||||||
|
setJob(null);
|
||||||
|
setNotFound(false);
|
||||||
|
fetchOnce(id);
|
||||||
|
timerRef.current = setInterval(() => fetchOnce(id), POLL_INTERVAL);
|
||||||
|
return stop;
|
||||||
|
}, [id, fetchOnce, stop]);
|
||||||
|
|
||||||
|
const refresh = useCallback(() => {
|
||||||
|
if (!id) return;
|
||||||
|
fetchOnce(id);
|
||||||
|
if (!timerRef.current) {
|
||||||
|
timerRef.current = setInterval(() => fetchOnce(id), POLL_INTERVAL);
|
||||||
|
}
|
||||||
|
}, [id, fetchOnce]);
|
||||||
|
|
||||||
|
return { job, error, notFound, refresh };
|
||||||
|
}
|
||||||
+230
-21
@@ -605,12 +605,11 @@
|
|||||||
"ado2": "ADO2",
|
"ado2": "ADO2",
|
||||||
"ssul": "Ssulbox",
|
"ssul": "Ssulbox",
|
||||||
"poster": "Moving Poster",
|
"poster": "Moving Poster",
|
||||||
"styling": "Poster Styling",
|
|
||||||
"desc": {
|
"desc": {
|
||||||
"ado2": "One business URL becomes a brand analysis, lyrics, music and a short-form video.",
|
"ado2": "One business URL becomes a brand analysis, lyrics, music and a short-form video.",
|
||||||
"ssul": "Weaves a business into a historical story people watch to the end.",
|
"ssul": "Weaves a business into a historical story people watch to the end.",
|
||||||
"poster": "One event poster becomes a short-form video with narration, music and camera moves.",
|
"poster": "One event poster becomes a short-form video with narration, music and camera moves.",
|
||||||
"styling": "Reinterprets a poster in the visual language of paintings and film posters."
|
"playreel": "One show ticket page link becomes a 30-second vertical trailer, with checks at key moments."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ssulbox": {
|
"ssulbox": {
|
||||||
@@ -632,6 +631,61 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"poster": {
|
"poster": {
|
||||||
|
"start": {
|
||||||
|
"title": "How do you want to start?",
|
||||||
|
"subtitle": "Choose by what you have. Both end as 9:16 vertical videos.",
|
||||||
|
"badge": "With the detail page",
|
||||||
|
"back": "‹ Choose again",
|
||||||
|
"comingSoon": "Coming soon",
|
||||||
|
"image": {
|
||||||
|
"title": "Start with an image",
|
||||||
|
"desc": "A single poster comes alive from its original first frame as an 8–15 sec moving poster",
|
||||||
|
"flow": {
|
||||||
|
"first": "Start with the original poster",
|
||||||
|
"move": "Add motion to flames, water and lights",
|
||||||
|
"narration": "Add title and date narration with music"
|
||||||
|
},
|
||||||
|
"facts": {
|
||||||
|
"need": {
|
||||||
|
"label": "You need",
|
||||||
|
"value": "1 image"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"label": "Check",
|
||||||
|
"value": "1 time"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"label": "Time",
|
||||||
|
"value": "About 3 min"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cta": "Upload poster"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"title": "Start with a show page",
|
||||||
|
"desc": "One ticket page link becomes a 30-sec trailer with casting, schedule and story",
|
||||||
|
"flow": {
|
||||||
|
"first": "Start with a moving poster · 8 sec",
|
||||||
|
"move": "Introduce the story, cast and schedule",
|
||||||
|
"narration": "Finish with booking details and a QR code"
|
||||||
|
},
|
||||||
|
"facts": {
|
||||||
|
"need": {
|
||||||
|
"label": "You need",
|
||||||
|
"value": "Ticket page URL"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"label": "Check",
|
||||||
|
"value": "5 times"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"label": "Time",
|
||||||
|
"value": "About 15 min"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cta": "Enter link"
|
||||||
|
}
|
||||||
|
},
|
||||||
"steps": {
|
"steps": {
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
"analyze": "Analyze",
|
"analyze": "Analyze",
|
||||||
@@ -639,12 +693,6 @@
|
|||||||
"render": "Generate",
|
"render": "Generate",
|
||||||
"done": "Done"
|
"done": "Done"
|
||||||
},
|
},
|
||||||
"key": {
|
|
||||||
"title": "P2V access key required",
|
|
||||||
"desc": "The poster pipeline runs on a separate server. The key you enter is stored in this browser.",
|
|
||||||
"placeholder": "P2V_ACCESS_KEY",
|
|
||||||
"save": "Save"
|
|
||||||
},
|
|
||||||
"dropzone": {
|
"dropzone": {
|
||||||
"cta": "Drop a poster here\nor click to choose",
|
"cta": "Drop a poster here\nor click to choose",
|
||||||
"formats": "JPG · PNG · WEBP · GIF\nNo resolution limit",
|
"formats": "JPG · PNG · WEBP · GIF\nNo resolution limit",
|
||||||
@@ -655,6 +703,8 @@
|
|||||||
"create": {
|
"create": {
|
||||||
"step": "STEP 1 · Upload poster",
|
"step": "STEP 1 · Upload poster",
|
||||||
"namePlaceholder": "Event name (leave blank to auto-detect)",
|
"namePlaceholder": "Event name (leave blank to auto-detect)",
|
||||||
|
"cost": "Cost",
|
||||||
|
"costValue": "3 credits",
|
||||||
"submit": "Create short-form",
|
"submit": "Create short-form",
|
||||||
"submitting": "Uploading…"
|
"submitting": "Uploading…"
|
||||||
},
|
},
|
||||||
@@ -666,7 +716,7 @@
|
|||||||
"phaseAnalyze": "Analyzing",
|
"phaseAnalyze": "Analyzing",
|
||||||
"phaseRender": "Generating",
|
"phaseRender": "Generating",
|
||||||
"failTitle": "Generation failed",
|
"failTitle": "Generation failed",
|
||||||
"retry": "Retry",
|
"refunded": "Generation failed and the credits used were refunded. Please start a new one.",
|
||||||
"discard": "Start over",
|
"discard": "Start over",
|
||||||
"discardConfirm": "This deletes the job and every generated video, audio and analysis file. This cannot be undone."
|
"discardConfirm": "This deletes the job and every generated video, audio and analysis file. This cannot be undone."
|
||||||
},
|
},
|
||||||
@@ -689,20 +739,179 @@
|
|||||||
"downloadThumb": "Still JPG",
|
"downloadThumb": "Still JPG",
|
||||||
"downloadVideo": "Download MP4",
|
"downloadVideo": "Download MP4",
|
||||||
"new": "Start a new poster"
|
"new": "Start a new poster"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"playreel": {
|
||||||
|
"auto": {
|
||||||
|
"title": "Auto-approval settings",
|
||||||
|
"done": "Step {{step}} {{name}} was auto-approved.",
|
||||||
|
"gate": "Step {{step}} · {{name}}",
|
||||||
|
"fetch_confirm": "Use the details and default sections read from the page as they are",
|
||||||
|
"narration_confirm": "Continue with the generated lines and the default voice",
|
||||||
|
"switchLabel": "Auto-approve {{name}}",
|
||||||
|
"lockedTitle": "Steps 2 · 4 · 5",
|
||||||
|
"lockedDesc": "These steps cannot be undone, so they always need your check",
|
||||||
|
"working": "Auto-approving step {{step}} {{name}}",
|
||||||
|
"hint": "You can turn this off on the start screen.",
|
||||||
|
"failed": "Auto-approval failed — please review it yourself. {{message}}"
|
||||||
},
|
},
|
||||||
"styling": {
|
"steps": {
|
||||||
"internalScope": "Internal demo only. Because of reference licensing, results must not be published externally or used commercially (public-domain artworks excepted).",
|
"input": "Link",
|
||||||
"templates": "Style templates",
|
"prepare": "Collect",
|
||||||
"myPoster": "My poster",
|
"review": "Review",
|
||||||
"result": "Result",
|
"render": "Generate",
|
||||||
"converting": "Converting (about 30s)",
|
"done": "Done"
|
||||||
"formats": "Output format",
|
},
|
||||||
"submit": "Convert style",
|
"create": {
|
||||||
"license": {
|
"step": "STEP 1 · Show page link",
|
||||||
"public-domain": "Publishable",
|
"placeholder": "Paste the show's ticket page link",
|
||||||
"internal-only": "Internal only",
|
"recognized": "Product {{id}} recognized",
|
||||||
"user-uploaded": "Rights unverified"
|
"unsupported": "This link is not supported yet. Enter a show ticket page link.",
|
||||||
|
"submit": "Create trailer",
|
||||||
|
"submitting": "Reading the page…"
|
||||||
|
},
|
||||||
|
"stages": {
|
||||||
|
"fetch": "Fetch",
|
||||||
|
"split": "Sections",
|
||||||
|
"upscale": "Upscale",
|
||||||
|
"analyze": "Analyze",
|
||||||
|
"motion": "Motion",
|
||||||
|
"narration": "Narration",
|
||||||
|
"tts": "Voice",
|
||||||
|
"bgm": "Music",
|
||||||
|
"i2v": "Generate",
|
||||||
|
"hybrid": "Overlay",
|
||||||
|
"compose": "Compose",
|
||||||
|
"review": "Review"
|
||||||
|
},
|
||||||
|
"running": {
|
||||||
|
"fetch": "Fetching the poster and details from the page",
|
||||||
|
"split": "Splitting the detail page into sections",
|
||||||
|
"upscale": "Enhancing the poster (about 1 min)",
|
||||||
|
"analyze": "Finding elements that can move",
|
||||||
|
"motion": "Writing the motion prompt",
|
||||||
|
"narration": "Writing the narration",
|
||||||
|
"tts": "Reading the narration aloud",
|
||||||
|
"bgm": "Composing background music (may take a few minutes)",
|
||||||
|
"i2v": "Animating the poster (5–8 min)",
|
||||||
|
"hybrid": "Re-applying the original lettering",
|
||||||
|
"compose": "Composing with the page scroll",
|
||||||
|
"review": "Running automatic checks"
|
||||||
|
},
|
||||||
|
"making": {
|
||||||
|
"title": "Creating your trailer",
|
||||||
|
"preparing": "Preparing",
|
||||||
|
"queued": "Queued",
|
||||||
|
"wait": "The next review request will appear here. The job keeps running if you close the window.",
|
||||||
|
"failTitle": "Generation failed",
|
||||||
|
"refunded": "Generation failed and the credits used were refunded. Please start a new one.",
|
||||||
|
"discard": "Start over",
|
||||||
|
"discardConfirm": "This deletes the job and all generated video, audio and analysis files. This cannot be undone."
|
||||||
|
},
|
||||||
|
"gate": {
|
||||||
|
"progress": "Review {{step}} / {{total}} · {{name}}",
|
||||||
|
"next": "Next · {{next}} · {{eta}}",
|
||||||
|
"approve": "Approve and continue",
|
||||||
|
"approveFinal": "Approve and save",
|
||||||
|
"approveClip": "Continue with this clip",
|
||||||
|
"working": "Working…",
|
||||||
|
"back": "‹ Previous step",
|
||||||
|
"redo": "Regenerate"
|
||||||
|
},
|
||||||
|
"gates": {
|
||||||
|
"fetch_confirm": {
|
||||||
|
"name": "Collection check",
|
||||||
|
"title": "Check this is the right show and choose what to include",
|
||||||
|
"why": "The video is built from details taken from the page. The casting schedule is always included.",
|
||||||
|
"next": "Poster enhancement · element analysis",
|
||||||
|
"eta": "about 2 min"
|
||||||
|
},
|
||||||
|
"analysis_confirm": {
|
||||||
|
"name": "Motion check",
|
||||||
|
"title": "Choose what moves in the poster",
|
||||||
|
"why": "Approving starts video generation and cannot be undone. Title, logo and figures stay exactly as in the original.",
|
||||||
|
"next": "Kling 3.0 video generation",
|
||||||
|
"eta": "about 5–8 min"
|
||||||
|
},
|
||||||
|
"narration_confirm": {
|
||||||
|
"name": "Narration check",
|
||||||
|
"title": "Check the narration and the voice",
|
||||||
|
"why": "These sentences are read exactly as written. The casting schedule notice and the date/CTA lines are required.",
|
||||||
|
"next": "Voice synthesis · music generation",
|
||||||
|
"eta": "about 3 min"
|
||||||
|
},
|
||||||
|
"clip_confirm": {
|
||||||
|
"name": "Clip review",
|
||||||
|
"title": "Check the generated scene",
|
||||||
|
"why": "This is the result of an automatic check that the title is intact. Regenerating starts over from the beginning.",
|
||||||
|
"next": "Original lettering overlay · page scroll composition",
|
||||||
|
"eta": "about 5 min"
|
||||||
|
},
|
||||||
|
"final_confirm": {
|
||||||
|
"name": "Final review",
|
||||||
|
"title": "Check the finished trailer",
|
||||||
|
"why": "Approving locks this version and saves it to My Contents. Later changes become a new version.",
|
||||||
|
"next": "Save · download",
|
||||||
|
"eta": "instant"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"fetch": {
|
||||||
|
"info": "Show details",
|
||||||
|
"field": {
|
||||||
|
"title": "Title",
|
||||||
|
"date_text": "Dates",
|
||||||
|
"place": "Venue"
|
||||||
|
},
|
||||||
|
"cast": "Cast · {{cast}}",
|
||||||
|
"sections": "Where to start scrolling the detail page",
|
||||||
|
"sectionsHelp": "The detail page is scrolled continuously from the chosen point. Pieces are not cut and pasted.",
|
||||||
|
"sectionsCount": "{{chosen}} of {{total}} selected · the casting schedule is always included.",
|
||||||
|
"lowRes": "The poster is only {{width}}px wide. It is enhanced 2x in the next step. If you have the original file, uploading it in Moving Poster looks sharper.",
|
||||||
|
"poster": "Poster"
|
||||||
|
},
|
||||||
|
"analysis": {
|
||||||
|
"movable": "Elements that move",
|
||||||
|
"movableHelp": "The camera does not move. Only elements like light, smoke and fabric come alive.",
|
||||||
|
"fixed": "Keep as original",
|
||||||
|
"fixedHelp": "Original pixels are laid back over the generated frames. The title never changes by a single pixel.",
|
||||||
|
"model": "Generation model",
|
||||||
|
"modelValue": "Kling 3.0 pro · 8 sec",
|
||||||
|
"ipRisk": "This is a known IP (e.g. Disney). Other models have been rejected by copyright filters, so only Kling is used. If it fails, an artwork push-in is used instead.",
|
||||||
|
"noQr": "The poster has no QR code, so the ending band QR is generated from the product page link.",
|
||||||
|
"grid": "Element analysis (5% grid)"
|
||||||
|
},
|
||||||
|
"narration": {
|
||||||
|
"lines": "Narration · {{count}} lines",
|
||||||
|
"voice": "Voice",
|
||||||
|
"sampleMissing": "Sample coming soon",
|
||||||
|
"estimate": "Estimated length",
|
||||||
|
"seconds": "{{value}}s",
|
||||||
|
"target": "Target {{min}}–{{max}}s",
|
||||||
|
"adjust": "shorten or lengthen the lines"
|
||||||
|
},
|
||||||
|
"clip": {
|
||||||
|
"missing": "Generated 8-sec clip",
|
||||||
|
"titleCheck": "Title integrity check",
|
||||||
|
"passed": "Passed · title deviation {{mae}}",
|
||||||
|
"failed": "Failed · title deviation {{mae}}",
|
||||||
|
"criteria": "Threshold 4.0 or less, compared pixel by pixel with the original title.",
|
||||||
|
"frames": "Frames at 5 points",
|
||||||
|
"redoNote": "Regenerating repeats video generation from the start. The original-lettering overlay on this clip is not redone."
|
||||||
|
},
|
||||||
|
"final": {
|
||||||
|
"missing": "Finished video {{seconds}}s",
|
||||||
|
"checks": "Automatic checks",
|
||||||
|
"proof": "Proof sheet",
|
||||||
|
"version": "Approving locks this as v{{version}}."
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"title": "Trailer ready",
|
||||||
|
"videoMissing": "The video file could not be found.",
|
||||||
|
"fileName": "File name",
|
||||||
|
"source": "Source ·",
|
||||||
|
"sourceLink": "Open the show page →",
|
||||||
|
"download": "Download MP4",
|
||||||
|
"new": "Create a new trailer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+230
-37
@@ -605,12 +605,11 @@
|
|||||||
"ado2": "ADO2",
|
"ado2": "ADO2",
|
||||||
"ssul": "썰박스",
|
"ssul": "썰박스",
|
||||||
"poster": "무빙 포스터",
|
"poster": "무빙 포스터",
|
||||||
"styling": "포스터 스타일링",
|
|
||||||
"desc": {
|
"desc": {
|
||||||
"ado2": "업체 URL 하나로 브랜드를 분석해 가사·음악·숏폼 영상까지 자동 제작합니다.",
|
"ado2": "업체 URL 하나로 브랜드를 분석해 가사·음악·숏폼 영상까지 자동 제작합니다.",
|
||||||
"ssul": "유명 역사 스토리에 업체 셀링포인트를 녹여 흥미로운 숏폼 콘텐츠를 만듭니다.",
|
"ssul": "유명 역사 스토리에 업체 셀링포인트를 녹여 흥미로운 숏폼 콘텐츠를 만듭니다.",
|
||||||
"poster": "포스터가 나레이션, 음악, 애니메이션을 추가한 숏폼 콘텐츠로 나옵니다.",
|
"poster": "포스터가 나레이션, 음악, 애니메이션을 추가한 숏폼 콘텐츠로 나옵니다.",
|
||||||
"styling": "포스터를 유명 영화의 한 장면 · 고전화 · 영화 포스터 스타일로 재해석합니다."
|
"playreel": "공연 상품페이지 주소 하나로 30초 세로 예고편을 만듭니다. 중요한 순간마다 확인을 요청합니다."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ssulbox": {
|
"ssulbox": {
|
||||||
@@ -681,6 +680,61 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"poster": {
|
"poster": {
|
||||||
|
"start": {
|
||||||
|
"title": "어떻게 시작할까요?",
|
||||||
|
"subtitle": "가진 것에 따라 고르세요. 둘 다 9:16 세로 영상으로 완성됩니다.",
|
||||||
|
"badge": "상세페이지까지",
|
||||||
|
"back": "‹ 다시 선택",
|
||||||
|
"comingSoon": "준비 중",
|
||||||
|
"image": {
|
||||||
|
"title": "이미지로 시작하기",
|
||||||
|
"desc": "포스터 한 장이 첫 프레임 그대로 살아나는 8~15초 무빙포스터",
|
||||||
|
"flow": {
|
||||||
|
"first": "포스터 원본으로 시작",
|
||||||
|
"move": "불꽃·물결·조명에 움직임 추가",
|
||||||
|
"narration": "제목·일시 나레이션과 음악 추가"
|
||||||
|
},
|
||||||
|
"facts": {
|
||||||
|
"need": {
|
||||||
|
"label": "필요한 것",
|
||||||
|
"value": "이미지 1장"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"label": "확인",
|
||||||
|
"value": "1회"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"label": "시간",
|
||||||
|
"value": "약 3분"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cta": "포스터 올리기"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"title": "공연상품페이지로 시작하기",
|
||||||
|
"desc": "상품페이지 주소 하나로 캐스팅·일정·줄거리까지 담긴 30초 예고편",
|
||||||
|
"flow": {
|
||||||
|
"first": "포스터 무빙으로 시작 · 8초",
|
||||||
|
"move": "줄거리·캐스팅·일정 소개",
|
||||||
|
"narration": "예매 안내와 QR로 마무리"
|
||||||
|
},
|
||||||
|
"facts": {
|
||||||
|
"need": {
|
||||||
|
"label": "필요한 것",
|
||||||
|
"value": "상품페이지 URL"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"label": "확인",
|
||||||
|
"value": "5회"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"label": "시간",
|
||||||
|
"value": "약 15분"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cta": "주소 넣기"
|
||||||
|
}
|
||||||
|
},
|
||||||
"steps": {
|
"steps": {
|
||||||
"upload": "업로드",
|
"upload": "업로드",
|
||||||
"analyze": "분석",
|
"analyze": "분석",
|
||||||
@@ -688,12 +742,6 @@
|
|||||||
"render": "생성",
|
"render": "생성",
|
||||||
"done": "완성"
|
"done": "완성"
|
||||||
},
|
},
|
||||||
"key": {
|
|
||||||
"title": "P2V 접근 키가 필요합니다",
|
|
||||||
"desc": "포스터 파이프라인은 별도 서버에서 돕니다. 서버에 설정된 접근 키를 입력하면 이 브라우저에 저장됩니다.",
|
|
||||||
"placeholder": "P2V_ACCESS_KEY",
|
|
||||||
"save": "저장"
|
|
||||||
},
|
|
||||||
"dropzone": {
|
"dropzone": {
|
||||||
"cta": "포스터를 끌어다 놓거나\n클릭해서 선택",
|
"cta": "포스터를 끌어다 놓거나\n클릭해서 선택",
|
||||||
"formats": "JPG · PNG · WEBP · GIF\n해상도 제한 없음",
|
"formats": "JPG · PNG · WEBP · GIF\n해상도 제한 없음",
|
||||||
@@ -704,6 +752,8 @@
|
|||||||
"create": {
|
"create": {
|
||||||
"step": "STEP 1 · 포스터 업로드",
|
"step": "STEP 1 · 포스터 업로드",
|
||||||
"namePlaceholder": "행사 이름을 입력하세요 (비우면 자동 추출)",
|
"namePlaceholder": "행사 이름을 입력하세요 (비우면 자동 추출)",
|
||||||
|
"cost": "생성 비용",
|
||||||
|
"costValue": "3 크레딧",
|
||||||
"submit": "숏폼 만들기",
|
"submit": "숏폼 만들기",
|
||||||
"submitting": "업로드 중…"
|
"submitting": "업로드 중…"
|
||||||
},
|
},
|
||||||
@@ -715,7 +765,7 @@
|
|||||||
"phaseAnalyze": "분석 중",
|
"phaseAnalyze": "분석 중",
|
||||||
"phaseRender": "생성 중",
|
"phaseRender": "생성 중",
|
||||||
"failTitle": "생성에 실패했어요",
|
"failTitle": "생성에 실패했어요",
|
||||||
"retry": "다시 시도",
|
"refunded": "생성에 실패해 사용한 크레딧은 환불되었습니다. 새로 만들어 주세요.",
|
||||||
"discard": "처음부터",
|
"discard": "처음부터",
|
||||||
"discardConfirm": "이 작업과 만들어진 영상·음성·분석 파일을 모두 지웁니다. 되돌릴 수 없습니다."
|
"discardConfirm": "이 작업과 만들어진 영상·음성·분석 파일을 모두 지웁니다. 되돌릴 수 없습니다."
|
||||||
},
|
},
|
||||||
@@ -771,36 +821,179 @@
|
|||||||
"downloadThumb": "정지 컷 JPG",
|
"downloadThumb": "정지 컷 JPG",
|
||||||
"downloadVideo": "MP4 다운로드",
|
"downloadVideo": "MP4 다운로드",
|
||||||
"new": "새 포스터로 만들기"
|
"new": "새 포스터로 만들기"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"playreel": {
|
||||||
|
"auto": {
|
||||||
|
"title": "자동화 승인 단계 설정",
|
||||||
|
"done": "{{step}}단계 {{name}}을 자동 승인했습니다.",
|
||||||
|
"gate": "{{step}}단계 · {{name}}",
|
||||||
|
"fetch_confirm": "상세페이지에서 읽은 정보와 기본 섹션을 그대로 사용",
|
||||||
|
"narration_confirm": "자동 생성 문장과 기본 목소리로 바로 진행",
|
||||||
|
"switchLabel": "{{name}} 자동 승인",
|
||||||
|
"lockedTitle": "2 · 4 · 5단계",
|
||||||
|
"lockedDesc": "되돌릴 수 없는 단계라 항상 확인합니다",
|
||||||
|
"working": "{{step}}단계 {{name}}을 자동 승인하는 중",
|
||||||
|
"hint": "시작 화면에서 끌 수 있습니다.",
|
||||||
|
"failed": "자동 승인 실패 — 직접 확인해 주세요. {{message}}"
|
||||||
},
|
},
|
||||||
"styling": {
|
"steps": {
|
||||||
"internalScope": "내부 시연 전용입니다. 레퍼런스 저작권 때문에 결과물의 외부 공개·상업 사용은 금합니다(퍼블릭 도메인 명화 제외).",
|
"input": "주소 입력",
|
||||||
"templates": "스타일 템플릿",
|
"prepare": "수집·분석",
|
||||||
"pickTemplate": "템플릿을 선택하세요",
|
"review": "확인",
|
||||||
"count": "{{count}}종",
|
"render": "생성",
|
||||||
"myRefs": "내 레퍼런스",
|
"done": "완성"
|
||||||
"myRefsHint": "직접 올린 이미지의 화법으로 변환합니다",
|
},
|
||||||
"addRef": "레퍼런스 추가",
|
"create": {
|
||||||
"minEdge": "긴 변 {{px}}px 이상 권장",
|
"step": "STEP 1 · 공연 상품페이지 주소",
|
||||||
"analyzing": "화풍 분석 중…",
|
"placeholder": "공연 상품페이지 주소를 붙여넣으세요",
|
||||||
"deleteRef": "레퍼런스 삭제",
|
"recognized": "상품 {{id}} 인식됨",
|
||||||
"confirmDelete": "이 레퍼런스를 삭제할까요? 되돌릴 수 없습니다.",
|
"unsupported": "아직 지원하지 않는 주소입니다. 공연 상품페이지 주소를 넣어주세요.",
|
||||||
"attribution": "레퍼런스 출처 · {{source}}",
|
"submit": "예고편 만들기",
|
||||||
"myPoster": "내 포스터",
|
"submitting": "상세페이지 읽는 중…"
|
||||||
"result": "결과",
|
},
|
||||||
"resultAlt": "변환 결과",
|
"stages": {
|
||||||
"resultHint": "변환 결과가 여기에 표시됩니다",
|
"fetch": "수집",
|
||||||
"converting": "변환 중 (30초 안팎)",
|
"split": "섹션",
|
||||||
"downloadPng": "PNG 다운로드",
|
"upscale": "화질",
|
||||||
"formats": "출력 포맷",
|
"analyze": "요소",
|
||||||
"submit": "스타일 변환",
|
"motion": "연출",
|
||||||
"license": {
|
"narration": "나레이션",
|
||||||
"public-domain": "공개 가능",
|
"tts": "음성",
|
||||||
"internal-only": "내부 전용",
|
"bgm": "음악",
|
||||||
"user-uploaded": "권리 미확인"
|
"i2v": "생성",
|
||||||
|
"hybrid": "합성",
|
||||||
|
"compose": "조립",
|
||||||
|
"review": "검수"
|
||||||
|
},
|
||||||
|
"running": {
|
||||||
|
"fetch": "상세페이지에서 포스터와 정보를 가져오는 중",
|
||||||
|
"split": "상세페이지를 섹션으로 나누는 중",
|
||||||
|
"upscale": "포스터 화질을 보정하는 중 (약 1분)",
|
||||||
|
"analyze": "포스터에서 움직일 요소를 찾는 중",
|
||||||
|
"motion": "연출 프롬프트를 쓰는 중",
|
||||||
|
"narration": "나레이션 문장을 쓰는 중",
|
||||||
|
"tts": "나레이션을 읽는 중",
|
||||||
|
"bgm": "배경음악을 만드는 중 (몇 분 걸릴 수 있습니다)",
|
||||||
|
"i2v": "포스터를 움직이는 중 (5~8분)",
|
||||||
|
"hybrid": "원본 글자를 다시 덮는 중",
|
||||||
|
"compose": "상세페이지 스크롤과 함께 조립하는 중",
|
||||||
|
"review": "자동 검사 중"
|
||||||
|
},
|
||||||
|
"making": {
|
||||||
|
"title": "예고편을 만들고 있어요",
|
||||||
|
"preparing": "준비 중",
|
||||||
|
"queued": "대기 중",
|
||||||
|
"wait": "다음 확인 요청이 오면 이 화면에 나타납니다. 창을 닫아도 작업은 계속됩니다.",
|
||||||
|
"failTitle": "생성에 실패했어요",
|
||||||
|
"refunded": "생성에 실패해 사용한 크레딧은 환불되었습니다. 새로 만들어 주세요.",
|
||||||
|
"discard": "처음부터",
|
||||||
|
"discardConfirm": "이 작업과 만들어진 영상·음성·분석 파일을 모두 지웁니다. 되돌릴 수 없습니다."
|
||||||
|
},
|
||||||
|
"gate": {
|
||||||
|
"progress": "확인 {{step}} / {{total}} · {{name}}",
|
||||||
|
"next": "다음 단계 · {{next}} · {{eta}}",
|
||||||
|
"approve": "승인하고 계속",
|
||||||
|
"approveFinal": "승인하고 저장",
|
||||||
|
"approveClip": "이 클립으로 계속",
|
||||||
|
"working": "처리 중…",
|
||||||
|
"back": "‹ 이전 단계로",
|
||||||
|
"redo": "다시 만들기"
|
||||||
|
},
|
||||||
|
"gates": {
|
||||||
|
"fetch_confirm": {
|
||||||
|
"name": "수집 확인",
|
||||||
|
"title": "이 공연이 맞는지, 어떤 부분을 넣을지 확인해 주세요",
|
||||||
|
"why": "상세페이지에서 가져온 정보로 영상의 뼈대를 만듭니다. 캐스팅 스케줄은 항상 들어갑니다.",
|
||||||
|
"next": "포스터 화질 보정 · 요소 분석",
|
||||||
|
"eta": "약 2분"
|
||||||
},
|
},
|
||||||
"internalOnlyTitle": "내부 전용 템플릿",
|
"analysis_confirm": {
|
||||||
"internalOnlyBody": "이 레퍼런스로 만든 결과물은 외부 공개·상업 사용을 금합니다.",
|
"name": "연출 확인",
|
||||||
"userRefNotice": "직접 올린 레퍼런스는 권리를 가진 이미지만 사용하세요. 타인의 저작물을 올려 생긴 문제의 책임은 업로드한 사람에게 있습니다. 결과물은 권리 미확인으로 분류됩니다."
|
"title": "포스터에서 무엇을 움직일지 정해주세요",
|
||||||
|
"why": "승인하면 영상 생성이 시작되고 되돌릴 수 없습니다. 제목·로고·인물은 원본 그대로 고정됩니다.",
|
||||||
|
"next": "Kling 3.0 영상 생성",
|
||||||
|
"eta": "약 5~8분"
|
||||||
|
},
|
||||||
|
"narration_confirm": {
|
||||||
|
"name": "나레이션 확인",
|
||||||
|
"title": "나레이션 문장과 목소리를 확인해 주세요",
|
||||||
|
"why": "이 문장이 그대로 읽힙니다. 캐스팅 스케줄 안내와 일시·CTA 문장은 꼭 필요합니다.",
|
||||||
|
"next": "음성 합성 · 배경음악 생성",
|
||||||
|
"eta": "약 3분"
|
||||||
|
},
|
||||||
|
"clip_confirm": {
|
||||||
|
"name": "클립 검수",
|
||||||
|
"title": "생성된 장면을 확인해 주세요",
|
||||||
|
"why": "제목이 깨지지 않았는지 자동 검사한 결과입니다. 다시 만들면 처음부터 다시 만듭니다.",
|
||||||
|
"next": "원본 글자 합성 · 상세페이지 스크롤 조립",
|
||||||
|
"eta": "약 5분"
|
||||||
|
},
|
||||||
|
"final_confirm": {
|
||||||
|
"name": "최종 검수",
|
||||||
|
"title": "완성된 예고편을 확인해 주세요",
|
||||||
|
"why": "승인하면 이 버전이 고정되어 내 콘텐츠에 저장됩니다. 이후 수정은 새 버전으로 만들어집니다.",
|
||||||
|
"next": "저장 · 다운로드",
|
||||||
|
"eta": "즉시"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fetch": {
|
||||||
|
"info": "공연 정보",
|
||||||
|
"field": {
|
||||||
|
"title": "공연명",
|
||||||
|
"date_text": "일시",
|
||||||
|
"place": "장소"
|
||||||
|
},
|
||||||
|
"cast": "캐스트 · {{cast}}",
|
||||||
|
"sections": "상세페이지에서 훑기 시작할 지점",
|
||||||
|
"sectionsHelp": "고른 지점부터 상세페이지를 이어서 훑습니다. 조각을 잘라 붙이는 것이 아닙니다.",
|
||||||
|
"sectionsCount": "{{total}}개 중 {{chosen}}개 선택 · 캐스팅 스케줄은 항상 포함됩니다.",
|
||||||
|
"lowRes": "포스터가 {{width}}px로 작습니다. 다음 단계에서 화질을 2배 보정합니다. 원본 파일이 있으면 무빙 포스터에서 직접 올리는 편이 더 선명합니다.",
|
||||||
|
"poster": "포스터"
|
||||||
|
},
|
||||||
|
"analysis": {
|
||||||
|
"movable": "움직일 요소",
|
||||||
|
"movableHelp": "카메라는 움직이지 않습니다. 빛·안개·천 같은 요소만 살아납니다.",
|
||||||
|
"fixed": "원본 그대로 고정",
|
||||||
|
"fixedHelp": "생성된 화면 위에 원본 픽셀을 다시 덮습니다. 제목은 한 픽셀도 바뀌지 않습니다.",
|
||||||
|
"model": "생성 모델",
|
||||||
|
"modelValue": "Kling 3.0 pro · 8초",
|
||||||
|
"ipRisk": "알려진 IP(디즈니 등) 작품입니다. 다른 모델은 저작권 필터로 거부된 이력이 있어 Kling으로만 진행합니다. 실패하면 아트워크 푸시인으로 대체됩니다.",
|
||||||
|
"noQr": "포스터에 QR이 없어 엔딩 밴드 QR은 상품 페이지 링크로 자동 생성합니다.",
|
||||||
|
"grid": "요소 분석 (5% 격자)"
|
||||||
|
},
|
||||||
|
"narration": {
|
||||||
|
"lines": "나레이션 {{count}}문장",
|
||||||
|
"voice": "목소리",
|
||||||
|
"sampleMissing": "샘플 준비 중",
|
||||||
|
"estimate": "예상 길이",
|
||||||
|
"seconds": "{{value}}초",
|
||||||
|
"target": "목표 {{min}}~{{max}}초",
|
||||||
|
"adjust": "문장을 줄이거나 늘려주세요"
|
||||||
|
},
|
||||||
|
"clip": {
|
||||||
|
"missing": "생성 클립 8초",
|
||||||
|
"titleCheck": "제목 훼손 검사",
|
||||||
|
"passed": "통과 · 제목대 편차 {{mae}}",
|
||||||
|
"failed": "실패 · 제목대 편차 {{mae}}",
|
||||||
|
"criteria": "기준 4.0 이하. 원본 제목과 픽셀 단위로 비교한 값입니다.",
|
||||||
|
"frames": "5시점 프레임",
|
||||||
|
"redoNote": "다시 만들기는 영상 생성을 처음부터 반복합니다. 이 클립 위에 원본 글자를 덮는 합성은 다시 만들지 않습니다."
|
||||||
|
},
|
||||||
|
"final": {
|
||||||
|
"missing": "완성본 {{seconds}}초",
|
||||||
|
"checks": "자동 확인 항목",
|
||||||
|
"proof": "proof 시트",
|
||||||
|
"version": "승인하면 v{{version}}으로 고정됩니다."
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"title": "예고편 완성",
|
||||||
|
"videoMissing": "영상 파일을 찾지 못했습니다.",
|
||||||
|
"fileName": "파일명",
|
||||||
|
"source": "출처 ·",
|
||||||
|
"sourceLink": "공연 상품페이지 열기 →",
|
||||||
|
"download": "MP4 다운로드",
|
||||||
|
"new": "새 예고편 만들기"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { getAllVideos } from '../../utils/api';
|
import { getAllVideos } from '../../utils/api';
|
||||||
|
import { isP2vContent } from '../../utils/p2vApi';
|
||||||
import { VideoListItem } from '../../types/api';
|
import { VideoListItem } from '../../types/api';
|
||||||
import VideoDetailModal from '../../components/VideoDetailModal';
|
import VideoDetailModal from '../../components/VideoDetailModal';
|
||||||
import CitySelectModal from '../../components/CitySelectModal';
|
import CitySelectModal from '../../components/CitySelectModal';
|
||||||
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
||||||
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
||||||
|
import P2vViewerModal from '../../components/P2vViewerModal';
|
||||||
|
|
||||||
interface ADO2ContentsPageProps {
|
interface ADO2ContentsPageProps {
|
||||||
onBack?: () => void;
|
onBack?: () => void;
|
||||||
@@ -17,6 +19,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
|||||||
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
||||||
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
||||||
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
||||||
|
const [selectedP2v, setSelectedP2v] = useState<VideoListItem | null>(null);
|
||||||
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -149,17 +152,21 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
|||||||
className="ado2-content-card"
|
className="ado2-content-card"
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
video.type === 'ssul'
|
isP2vContent(video.type)
|
||||||
? setSelectedSsul(video)
|
? setSelectedP2v(video)
|
||||||
: handleCardClick(video.video_id)
|
: video.type === 'ssul'
|
||||||
|
? setSelectedSsul(video)
|
||||||
|
: handleCardClick(video.video_id)
|
||||||
}
|
}
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onKeyDown={(e) =>
|
onKeyDown={(e) =>
|
||||||
e.key === 'Enter' &&
|
e.key === 'Enter' &&
|
||||||
(video.type === 'ssul'
|
(isP2vContent(video.type)
|
||||||
? setSelectedSsul(video)
|
? setSelectedP2v(video)
|
||||||
: handleCardClick(video.video_id))
|
: video.type === 'ssul'
|
||||||
|
? setSelectedSsul(video)
|
||||||
|
: handleCardClick(video.video_id))
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="content-card-thumbnail ado2-gallery-thumbnail-wrap">
|
<div className="content-card-thumbnail ado2-gallery-thumbnail-wrap">
|
||||||
@@ -202,8 +209,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
|||||||
<h3 className="content-card-title">{video.store_name}</h3>
|
<h3 className="content-card-title">{video.store_name}</h3>
|
||||||
<div className="content-card-meta">
|
<div className="content-card-meta">
|
||||||
<p className="content-card-date">{formatDate(video.created_at)}</p>
|
<p className="content-card-date">{formatDate(video.created_at)}</p>
|
||||||
{/* 좋아요·댓글 API 가 type 을 받으므로 썰박스에도 노출한다.
|
{/* 모든 콘텐츠는 ID 와 종류를 함께 보내 소셜 반응을 구분한다. */}
|
||||||
contentType 이 없으면 id 가 겹치는 다른 영상에 반영된다. */}
|
|
||||||
<ContentCardSocialActions
|
<ContentCardSocialActions
|
||||||
videoId={video.video_id}
|
videoId={video.video_id}
|
||||||
contentType={video.type}
|
contentType={video.type}
|
||||||
@@ -243,6 +249,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
||||||
|
<P2vViewerModal item={selectedP2v} onClose={() => setSelectedP2v(null)} />
|
||||||
|
|
||||||
{selectedVideoId !== null && (
|
{selectedVideoId !== null && (
|
||||||
<VideoDetailModal
|
<VideoDetailModal
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
|||||||
const handleDrop = (e: React.DragEvent) => {
|
const handleDrop = (e: React.DragEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const files = Array.from(e.dataTransfer.files).filter(isImageInputFile);
|
const files = Array.from<File>(e.dataTransfer.files).filter(isImageInputFile);
|
||||||
if (files.length > 0) void runAddImages(files);
|
if (files.length > 0) void runAddImages(files);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,13 @@ import SsulResultContent from '../Ssulbox/SsulResultContent';
|
|||||||
import PosterMakingContent from '../Poster/PosterMakingContent';
|
import PosterMakingContent from '../Poster/PosterMakingContent';
|
||||||
import PosterReviewContent from '../Poster/PosterReviewContent';
|
import PosterReviewContent from '../Poster/PosterReviewContent';
|
||||||
import PosterResultContent from '../Poster/PosterResultContent';
|
import PosterResultContent from '../Poster/PosterResultContent';
|
||||||
|
import PlayreelMakingContent from '../P2v/PlayreelMakingContent';
|
||||||
|
import PlayreelGateContent from '../P2v/PlayreelGateContent';
|
||||||
|
import PlayreelResultContent from '../P2v/PlayreelResultContent';
|
||||||
|
import { usePlayreelJob } from '../../hooks/usePlayreelJob';
|
||||||
|
import { GateKey, deletePlayreelJob } from '../../utils/playreelApi';
|
||||||
import { useP2vJob } from '../../hooks/useP2vJob';
|
import { useP2vJob } from '../../hooks/useP2vJob';
|
||||||
import { deletePosterJob, isPastReview, retryPosterJob } from '../../utils/p2vApi';
|
import { deletePosterJob, isPastReview } from '../../utils/p2vApi';
|
||||||
import {
|
import {
|
||||||
K,
|
K,
|
||||||
clearProjectStorage,
|
clearProjectStorage,
|
||||||
@@ -83,6 +88,21 @@ const SSUL_STEP_INDEX: Record<SsulStep, number> = {
|
|||||||
*/
|
*/
|
||||||
type PosterStep = 'entry' | 'making' | 'review' | 'result';
|
type PosterStep = 'entry' | 'making' | 'review' | 'result';
|
||||||
|
|
||||||
|
/** 롱컷(Playreel) 진행 단계. 포스터와 같은 이유로 잡 status 에서 파생한다 */
|
||||||
|
type PlayreelStep = 'entry' | 'making' | 'review' | 'result';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷 스텝퍼 라벨. 검수 게이트가 5번이라 게이트마다 칸을 두면 너무 길어진다 —
|
||||||
|
* 승인 전 준비(수집·분석) / 확인 / 승인 후 생성으로 묶는다.
|
||||||
|
*/
|
||||||
|
const PLAYREEL_STEP_LABELS = [
|
||||||
|
'playreel.steps.input',
|
||||||
|
'playreel.steps.prepare',
|
||||||
|
'playreel.steps.review',
|
||||||
|
'playreel.steps.render',
|
||||||
|
'playreel.steps.done',
|
||||||
|
] as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 스텝퍼 라벨. 5단계인 이유는 검수 게이트 **앞뒤가 서로 다른 작업**이기 때문이다 —
|
* 스텝퍼 라벨. 5단계인 이유는 검수 게이트 **앞뒤가 서로 다른 작업**이기 때문이다 —
|
||||||
* 분석(검출·나레이션·모션)과 생성(음성·음악·애니메이션·렌더)을 한 칸에 묶으면
|
* 분석(검출·나레이션·모션)과 생성(음성·음악·애니메이션·렌더)을 한 칸에 묶으면
|
||||||
@@ -215,8 +235,18 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
() => localStorage.getItem(K.POSTER_JOB_ID),
|
() => localStorage.getItem(K.POSTER_JOB_ID),
|
||||||
);
|
);
|
||||||
const [posterBusy, setPosterBusy] = useState(false);
|
const [posterBusy, setPosterBusy] = useState(false);
|
||||||
|
|
||||||
|
/** 롱컷(Playreel) 잡. 포스터 영상과 같은 규칙으로 서버 status 에서 단계를 파생한다 */
|
||||||
|
const [playreelJobId, setPlayreelJobId] = useState<string | null>(
|
||||||
|
() => localStorage.getItem(K.PLAYREEL_JOB_ID),
|
||||||
|
);
|
||||||
|
const [playreelBusy, setPlayreelBusy] = useState(false);
|
||||||
|
/** 방금 자동 승인한 게이트. 진행 화면이 안내를 보여주고, 새 잡·검수 화면에서 지운다 */
|
||||||
|
const [playreelAutoGate, setPlayreelAutoGate] = useState<GateKey | null>(null);
|
||||||
|
const { job: playreelJob, notFound: playreelNotFound, refresh: refreshPlayreelJob } =
|
||||||
|
usePlayreelJob(pipeline === 'playreel' ? playreelJobId : null);
|
||||||
const { job: posterJob, notFound: posterNotFound, refresh: refreshPosterJob } =
|
const { job: posterJob, notFound: posterNotFound, refresh: refreshPosterJob } =
|
||||||
useP2vJob('f1', pipeline === 'poster' ? posterJobId : null);
|
useP2vJob(pipeline === 'poster' ? posterJobId : null);
|
||||||
|
|
||||||
const changePipeline = (next: Pipeline) => {
|
const changePipeline = (next: Pipeline) => {
|
||||||
setPipeline(next);
|
setPipeline(next);
|
||||||
@@ -241,12 +271,40 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
? 4
|
? 4
|
||||||
: isPastReview(posterJob) ? 3 : 1;
|
: isPastReview(posterJob) ? 3 : 1;
|
||||||
|
|
||||||
|
const playreelStep: PlayreelStep = !playreelJobId
|
||||||
|
? 'entry'
|
||||||
|
: playreelJob?.status === 'awaiting_review' && playreelJob.gate && playreelJob.review
|
||||||
|
? 'review'
|
||||||
|
: playreelJob?.status === 'done'
|
||||||
|
? 'result'
|
||||||
|
: 'making'; // queued · running · failed · 조회 전(null)
|
||||||
|
|
||||||
|
// 자동 승인 안내는 다음 확인 요청(또는 완성)이 오면 낡은 정보라 지운다
|
||||||
|
useEffect(() => {
|
||||||
|
// 승인 직후에도 한동안 같은 게이트가 검수 대기로 보이므로, 다른 게이트일 때만 지운다
|
||||||
|
if (playreelStep === 'result' || (playreelStep === 'review' && playreelJob?.gate !== playreelAutoGate)) {
|
||||||
|
setPlayreelAutoGate(null);
|
||||||
|
}
|
||||||
|
}, [playreelStep, playreelJob?.gate, playreelAutoGate]);
|
||||||
|
|
||||||
|
/** 첫 게이트(연출 확인)를 승인했으면 이후 대기는 '생성' 구간이다 */
|
||||||
|
const playreelPastApproval = playreelJob?.stages.motion?.status !== undefined
|
||||||
|
&& playreelJob.stages.motion.status !== 'idle';
|
||||||
|
|
||||||
|
const playreelStepIndex = playreelStep === 'entry'
|
||||||
|
? 0
|
||||||
|
: playreelStep === 'review'
|
||||||
|
? 2
|
||||||
|
: playreelStep === 'result'
|
||||||
|
? 4
|
||||||
|
: playreelPastApproval ? 3 : 1;
|
||||||
|
|
||||||
/** 진입 화면(탭이 보이는 단계) 여부. 파이프라인마다 진입 조건이 다르다 */
|
/** 진입 화면(탭이 보이는 단계) 여부. 파이프라인마다 진입 조건이 다르다 */
|
||||||
const isEntry =
|
const isEntry =
|
||||||
pipeline === 'ado2' ? wizardStep === -2
|
pipeline === 'ado2' ? wizardStep === -2
|
||||||
: pipeline === 'ssul' ? ssulStep === 'entry'
|
: pipeline === 'ssul' ? ssulStep === 'entry'
|
||||||
: pipeline === 'poster' ? posterStep === 'entry'
|
: pipeline === 'poster' ? posterStep === 'entry'
|
||||||
// 스타일링은 전 과정이 진입 화면 안에서 끝난다 (위저드 없음)
|
: pipeline === 'playreel' ? playreelStep === 'entry'
|
||||||
: true;
|
: true;
|
||||||
const [songTaskId, setSongTaskId] = useState<string | null>(savedSongTaskId);
|
const [songTaskId, setSongTaskId] = useState<string | null>(savedSongTaskId);
|
||||||
const [imageTaskId, setImageTaskId] = useState<string | null>(savedImageTaskId);
|
const [imageTaskId, setImageTaskId] = useState<string | null>(savedImageTaskId);
|
||||||
@@ -623,24 +681,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
setPosterJobId(null);
|
setPosterJobId(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** 실패한 잡과 산출물을 지우고 처음부터. 크레딧은 실패 시점에 이미 환불됐다. 되돌릴 수 없다 */
|
||||||
* 실패한 스테이지부터 다시. 업로드부터 다시 하지 않는다 —
|
|
||||||
* i2v 실패(모델 큐·크레딧)는 같은 입력으로 재시도하면 자주 통과한다.
|
|
||||||
*/
|
|
||||||
const handlePosterRetry = async () => {
|
|
||||||
if (!posterJobId || posterBusy) return;
|
|
||||||
setPosterBusy(true);
|
|
||||||
try {
|
|
||||||
await retryPosterJob(posterJobId);
|
|
||||||
refreshPosterJob();
|
|
||||||
} catch {
|
|
||||||
// 재시도 요청 자체가 실패해도 잡 상태는 그대로다 — 폴링 결과가 계속 화면을 그린다
|
|
||||||
} finally {
|
|
||||||
setPosterBusy(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 실패한 잡과 산출물을 지우고 처음부터. 되돌릴 수 없다 */
|
|
||||||
const handlePosterDiscard = async () => {
|
const handlePosterDiscard = async () => {
|
||||||
if (!posterJobId || posterBusy) return;
|
if (!posterJobId || posterBusy) return;
|
||||||
if (!window.confirm(t('poster.making.discardConfirm'))) return;
|
if (!window.confirm(t('poster.making.discardConfirm'))) return;
|
||||||
@@ -655,13 +696,47 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ── 롱컷 (Playreel) ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const handlePlayreelJobStarted = (jobId: string) => {
|
||||||
|
localStorage.setItem(K.PLAYREEL_JOB_ID, jobId);
|
||||||
|
setPlayreelJobId(jobId);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 잡을 버리고 주소 입력 화면으로. 서버 잡은 남겨둔다(내 콘텐츠에 쓰인다) */
|
||||||
|
const handlePlayreelNew = () => {
|
||||||
|
localStorage.removeItem(K.PLAYREEL_JOB_ID);
|
||||||
|
setPlayreelJobId(null);
|
||||||
|
setPlayreelAutoGate(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 실패한 잡과 산출물을 지우고 처음부터. 크레딧은 실패 시점에 이미 환불됐다. 되돌릴 수 없다 */
|
||||||
|
const handlePlayreelDiscard = async () => {
|
||||||
|
if (!playreelJobId || playreelBusy) return;
|
||||||
|
if (!window.confirm(t('playreel.making.discardConfirm'))) return;
|
||||||
|
setPlayreelBusy(true);
|
||||||
|
try {
|
||||||
|
await deletePlayreelJob(playreelJobId);
|
||||||
|
} catch {
|
||||||
|
// 서버에서 이미 사라졌어도 화면은 처음으로 돌려보내는 게 맞다
|
||||||
|
} finally {
|
||||||
|
setPlayreelBusy(false);
|
||||||
|
handlePlayreelNew();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 사라졌거나 내 것이 아닌 롱컷 잡(404)이면 주소 입력 화면으로 되돌린다 */
|
||||||
|
useEffect(() => {
|
||||||
|
if (playreelNotFound) handlePlayreelNew();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [playreelNotFound]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 사라진 잡 정리.
|
* 사라진 잡 정리.
|
||||||
*
|
*
|
||||||
* P2V 에는 "내 활성 잡" 엔드포인트가 없어(단일 팀 키라 사용자 개념이 없다)
|
* 복구의 근거는 localStorage 의 id 다. 그런데 그 잡이 지워졌거나 로그인한 사용자의
|
||||||
* localStorage 의 id 가 복구의 유일한 근거다. 그런데 서버를 재시작하거나 다른
|
* 것이 아니면(백엔드는 남의 잡을 404 로 답한다) id 만 남아 **빈 진행 화면에서
|
||||||
* 사람이 그 잡을 지우면 id 만 남아 **빈 진행 화면에서 영원히 멈춘다** — 실제로 겪었다.
|
* 영원히 멈춘다**. 404 를 만나면 업로드 화면으로 되돌린다.
|
||||||
* 404 를 만나면 업로드 화면으로 되돌린다.
|
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (posterNotFound) handlePosterNew();
|
if (posterNotFound) handlePosterNew();
|
||||||
@@ -718,6 +793,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
setSsulStep('entry');
|
setSsulStep('entry');
|
||||||
// clearProjectStorage() 가 POSTER_JOB_ID 를 지우므로 state 도 함께 비운다
|
// clearProjectStorage() 가 POSTER_JOB_ID 를 지우므로 state 도 함께 비운다
|
||||||
setPosterJobId(null);
|
setPosterJobId(null);
|
||||||
|
setPlayreelJobId(null);
|
||||||
setSongTaskId(null);
|
setSongTaskId(null);
|
||||||
setImageTaskId(null);
|
setImageTaskId(null);
|
||||||
setAnalysisData(null);
|
setAnalysisData(null);
|
||||||
@@ -745,6 +821,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
error={analysisError}
|
error={analysisError}
|
||||||
onSsulJobStarted={handleSsulJobStarted}
|
onSsulJobStarted={handleSsulJobStarted}
|
||||||
onPosterJobStarted={handlePosterJobStarted}
|
onPosterJobStarted={handlePosterJobStarted}
|
||||||
|
onPlayreelJobStarted={handlePlayreelJobStarted}
|
||||||
onGoToPayment={handleGoToPayment}
|
onGoToPayment={handleGoToPayment}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -766,6 +843,34 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 롱컷도 자체 축으로 진행한다 (단계는 잡 status 파생)
|
||||||
|
if (pipeline === 'playreel') {
|
||||||
|
switch (playreelStep) {
|
||||||
|
case 'review':
|
||||||
|
return playreelJob ? (
|
||||||
|
<PlayreelGateContent
|
||||||
|
key={playreelJob.gate}
|
||||||
|
job={playreelJob}
|
||||||
|
onChanged={refreshPlayreelJob}
|
||||||
|
onAutoApproved={setPlayreelAutoGate}
|
||||||
|
/>
|
||||||
|
) : null;
|
||||||
|
case 'result':
|
||||||
|
return playreelJob ? (
|
||||||
|
<PlayreelResultContent job={playreelJob} onNew={handlePlayreelNew} />
|
||||||
|
) : null;
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<PlayreelMakingContent
|
||||||
|
job={playreelJob}
|
||||||
|
onDiscard={handlePlayreelDiscard}
|
||||||
|
busy={playreelBusy}
|
||||||
|
autoApprovedGate={playreelAutoGate}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 포스터 영상도 자체 축으로 진행한다 (단계는 잡 status 파생)
|
// 포스터 영상도 자체 축으로 진행한다 (단계는 잡 status 파생)
|
||||||
if (pipeline === 'poster') {
|
if (pipeline === 'poster') {
|
||||||
switch (posterStep) {
|
switch (posterStep) {
|
||||||
@@ -781,7 +886,6 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
return (
|
return (
|
||||||
<PosterMakingContent
|
<PosterMakingContent
|
||||||
job={posterJob}
|
job={posterJob}
|
||||||
onRetry={handlePosterRetry}
|
|
||||||
onDiscard={handlePosterDiscard}
|
onDiscard={handlePosterDiscard}
|
||||||
busy={posterBusy}
|
busy={posterBusy}
|
||||||
/>
|
/>
|
||||||
@@ -913,6 +1017,18 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// 롱컷은 검수 게이트 5번을 준비·확인·생성 3구간으로 묶은 5단계
|
||||||
|
if (pipeline === 'playreel') {
|
||||||
|
return (
|
||||||
|
<div className="wizard-page-container">
|
||||||
|
<WizardStepper
|
||||||
|
steps={PLAYREEL_STEP_LABELS.map((key) => t(key))}
|
||||||
|
currentStep={playreelStepIndex}
|
||||||
|
/>
|
||||||
|
{renderWizardContent()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
// 브랜드 분석(0)은 전체 화면 스크롤이지만 스텝퍼는 표시
|
// 브랜드 분석(0)은 전체 화면 스크롤이지만 스텝퍼는 표시
|
||||||
if (wizardStep === 0) {
|
if (wizardStep === 0) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { getVideosList, deleteVideo, deleteSsulContent } from '../../utils/api';
|
import { getVideosList, deleteVideo, deleteSsulContent } from '../../utils/api';
|
||||||
import { VideoListItem } from '../../types/api';
|
import { deleteP2vContent, isP2vContent } from '../../utils/p2vApi';
|
||||||
|
import { SocialUploadableItem, VideoListItem } from '../../types/api';
|
||||||
import SocialPostingModal from '../../components/SocialPostingModal';
|
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||||
import VideoDetailModal from '../../components/VideoDetailModal';
|
import VideoDetailModal from '../../components/VideoDetailModal';
|
||||||
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
||||||
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
||||||
|
import P2vViewerModal from '../../components/P2vViewerModal';
|
||||||
import { useOverlayClose } from '../../hooks/useOverlayClose';
|
import { useOverlayClose } from '../../hooks/useOverlayClose';
|
||||||
|
|
||||||
const VideoPreviewCard: React.FC<{ src: string; className?: string }> = ({ src, className }) => {
|
const VideoPreviewCard: React.FC<{ src: string; className?: string }> = ({ src, className }) => {
|
||||||
@@ -107,11 +109,12 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
const [deleteTarget, setDeleteTarget] = useState<VideoListItem | null>(null);
|
const [deleteTarget, setDeleteTarget] = useState<VideoListItem | null>(null);
|
||||||
const [isDeleting, setIsDeleting] = useState(false);
|
const [isDeleting, setIsDeleting] = useState(false);
|
||||||
const [uploadModalOpen, setUploadModalOpen] = useState(false);
|
const [uploadModalOpen, setUploadModalOpen] = useState(false);
|
||||||
const [uploadTargetVideo, setUploadTargetVideo] = useState<VideoListItem | null>(null);
|
const [uploadTargetVideo, setUploadTargetVideo] = useState<SocialUploadableItem | null>(null);
|
||||||
const [selectedVideoId, setSelectedVideoId] = useState<number | null>(null);
|
const [selectedVideoId, setSelectedVideoId] = useState<number | null>(null);
|
||||||
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
||||||
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
||||||
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
||||||
|
const [selectedP2v, setSelectedP2v] = useState<VideoListItem | null>(null);
|
||||||
|
|
||||||
const pageSize = 12;
|
const pageSize = 12;
|
||||||
|
|
||||||
@@ -181,7 +184,9 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleUploadClick = (video: VideoListItem) => {
|
const handleUploadClick = (video: VideoListItem) => {
|
||||||
setUploadTargetVideo(video);
|
// 롱컷(p2v_playreel)은 소셜 업로드를 지원하지 않는다(버튼도 막는다). 무빙 포스터는 지원한다.
|
||||||
|
if (video.type === 'p2v_playreel') return;
|
||||||
|
setUploadTargetVideo({ ...video, type: video.type });
|
||||||
setUploadModalOpen(true);
|
setUploadModalOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,7 +207,9 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
try {
|
try {
|
||||||
// 종류별 삭제 API 가 다르다. deleteVideo 는 Video.id 로 지우므로
|
// 종류별 삭제 API 가 다르다. deleteVideo 는 Video.id 로 지우므로
|
||||||
// 썰박스 id 를 넘기면 id 가 겹치는 엉뚱한 ADO2 영상이 삭제된다.
|
// 썰박스 id 를 넘기면 id 가 겹치는 엉뚱한 ADO2 영상이 삭제된다.
|
||||||
if (deleteTarget.type === 'ssul') {
|
if (isP2vContent(deleteTarget.type)) {
|
||||||
|
await deleteP2vContent(deleteTarget.type, deleteTarget.video_id);
|
||||||
|
} else if (deleteTarget.type === 'ssul') {
|
||||||
await deleteSsulContent(deleteTarget.video_id);
|
await deleteSsulContent(deleteTarget.video_id);
|
||||||
} else {
|
} else {
|
||||||
await deleteVideo(deleteTarget.video_id);
|
await deleteVideo(deleteTarget.video_id);
|
||||||
@@ -259,9 +266,11 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
className="content-card-thumbnail"
|
className="content-card-thumbnail"
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
video.type === 'ssul'
|
isP2vContent(video.type)
|
||||||
? setSelectedSsul(video)
|
? setSelectedP2v(video)
|
||||||
: setSelectedVideoId(video.video_id)
|
: video.type === 'ssul'
|
||||||
|
? setSelectedSsul(video)
|
||||||
|
: setSelectedVideoId(video.video_id)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{video.poster_url ? (
|
{video.poster_url ? (
|
||||||
@@ -303,8 +312,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
<p className="content-card-date">
|
<p className="content-card-date">
|
||||||
{formatDate(video.created_at)}
|
{formatDate(video.created_at)}
|
||||||
</p>
|
</p>
|
||||||
{/* 좋아요·댓글 API 가 type 을 받으므로 썰박스에도 노출한다.
|
{/* 모든 콘텐츠는 ID 와 종류를 함께 보내 소셜 반응을 구분한다. */}
|
||||||
contentType 이 없으면 id 가 겹치는 다른 영상에 반영된다. */}
|
|
||||||
<ContentCardSocialActions
|
<ContentCardSocialActions
|
||||||
videoId={video.video_id}
|
videoId={video.video_id}
|
||||||
contentType={video.type}
|
contentType={video.type}
|
||||||
@@ -326,7 +334,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
<button
|
<button
|
||||||
className="content-download-btn"
|
className="content-download-btn"
|
||||||
onClick={() => handleUploadClick(video)}
|
onClick={() => handleUploadClick(video)}
|
||||||
disabled={!video.result_movie_url}
|
disabled={!video.result_movie_url || video.type === 'p2v_playreel'}
|
||||||
>
|
>
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
<path d="M10 13V3M10 3l-4 4M10 3l4 4"/>
|
<path d="M10 13V3M10 3l-4 4M10 3l4 4"/>
|
||||||
@@ -418,6 +426,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
||||||
|
<P2vViewerModal item={selectedP2v} onClose={() => setSelectedP2v(null)} />
|
||||||
|
|
||||||
{/* 소셜 미디어 업로드 모달 */}
|
{/* 소셜 미디어 업로드 모달 */}
|
||||||
<SocialPostingModal
|
<SocialPostingModal
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { AutocompleteRequest } from '../../utils/api';
|
import { AutocompleteRequest } from '../../utils/api';
|
||||||
import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
||||||
@@ -6,7 +6,8 @@ import PipelineTabs, { Pipeline } from '../../components/PipelineTabs';
|
|||||||
import SsulCreateForm from '../Ssulbox/SsulCreateForm';
|
import SsulCreateForm from '../Ssulbox/SsulCreateForm';
|
||||||
import { Scen } from '../Ssulbox/ssulData';
|
import { Scen } from '../Ssulbox/ssulData';
|
||||||
import PosterCreateForm from '../Poster/PosterCreateForm';
|
import PosterCreateForm from '../Poster/PosterCreateForm';
|
||||||
import StylingContent from '../Poster/StylingContent';
|
import PosterStartChoice from '../Poster/PosterStartChoice';
|
||||||
|
import PlayreelCreateForm from '../P2v/PlayreelCreateForm';
|
||||||
|
|
||||||
interface UrlInputContentProps {
|
interface UrlInputContentProps {
|
||||||
/** 현재 선택된 파이프라인. 소유자는 GenerationFlow (분기·리셋 때문) */
|
/** 현재 선택된 파이프라인. 소유자는 GenerationFlow (분기·리셋 때문) */
|
||||||
@@ -20,6 +21,8 @@ interface UrlInputContentProps {
|
|||||||
onSsulJobStarted: (taskId: number, scenario: Scen) => void;
|
onSsulJobStarted: (taskId: number, scenario: Scen) => void;
|
||||||
/** 포스터 영상(F1) 생성 요청 접수 시. 폴링 소유는 GenerationFlow */
|
/** 포스터 영상(F1) 생성 요청 접수 시. 폴링 소유는 GenerationFlow */
|
||||||
onPosterJobStarted: (jobId: string) => void;
|
onPosterJobStarted: (jobId: string) => void;
|
||||||
|
/** 롱컷 생성 요청 접수 시. 폴링 소유는 GenerationFlow */
|
||||||
|
onPlayreelJobStarted: (jobId: string) => void;
|
||||||
/** 크레딧 부족 시 충전 화면으로 */
|
/** 크레딧 부족 시 충전 화면으로 */
|
||||||
onGoToPayment: () => void;
|
onGoToPayment: () => void;
|
||||||
}
|
}
|
||||||
@@ -38,12 +41,28 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
|||||||
error,
|
error,
|
||||||
onSsulJobStarted,
|
onSsulJobStarted,
|
||||||
onPosterJobStarted,
|
onPosterJobStarted,
|
||||||
|
onPlayreelJobStarted,
|
||||||
onGoToPayment,
|
onGoToPayment,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
// 스타일링은 한 화면짜리 도구라 진입 폼보다 넓은 판이 필요하다 (generation-flow.css 참조)
|
/**
|
||||||
const wide = pipeline === 'styling';
|
* 무빙 포스터 탭의 시작 화면. 롱컷은 별도 탭이 아니라 이 화면의 두 번째 갈래다 —
|
||||||
|
* 'choose' 에서 가진 것(이미지 / 상품페이지 주소)을 고르면 폼으로 들어간다.
|
||||||
|
*/
|
||||||
|
const [posterStart, setPosterStart] = useState<'choose' | 'image'>('choose');
|
||||||
|
const showChoice = pipeline === 'poster' && posterStart === 'choose';
|
||||||
|
|
||||||
|
const handleTabChange = (next: Pipeline) => {
|
||||||
|
// 무빙 포스터 탭을 다시 누르면 어느 폼에 있었든 선택 화면으로 돌아간다
|
||||||
|
if (next === 'poster') setPosterStart('choose');
|
||||||
|
onPipelineChange(next);
|
||||||
|
};
|
||||||
|
|
||||||
|
const backToChoice = () => {
|
||||||
|
setPosterStart('choose');
|
||||||
|
onPipelineChange('poster');
|
||||||
|
};
|
||||||
|
|
||||||
const renderForm = () => {
|
const renderForm = () => {
|
||||||
switch (pipeline) {
|
switch (pipeline) {
|
||||||
@@ -59,10 +78,26 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
|||||||
case 'ssul':
|
case 'ssul':
|
||||||
return <SsulCreateForm onSubmitted={onSsulJobStarted} onNeedCredit={onGoToPayment} />;
|
return <SsulCreateForm onSubmitted={onSsulJobStarted} onNeedCredit={onGoToPayment} />;
|
||||||
case 'poster':
|
case 'poster':
|
||||||
return <PosterCreateForm onSubmitted={onPosterJobStarted} />;
|
return posterStart === 'choose' ? (
|
||||||
case 'styling':
|
<PosterStartChoice
|
||||||
// 스타일링은 위저드가 아니라 도구다 — 진입 화면 안에서 처음부터 끝까지 끝난다
|
onPickImage={() => setPosterStart('image')}
|
||||||
return <StylingContent />;
|
onPickUrl={() => onPipelineChange('playreel')}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<PosterCreateForm
|
||||||
|
onSubmitted={onPosterJobStarted}
|
||||||
|
onNeedCredit={onGoToPayment}
|
||||||
|
onBack={backToChoice}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case 'playreel':
|
||||||
|
return (
|
||||||
|
<PlayreelCreateForm
|
||||||
|
onSubmitted={onPlayreelJobStarted}
|
||||||
|
onNeedCredit={onGoToPayment}
|
||||||
|
onBack={backToChoice}
|
||||||
|
/>
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -70,16 +105,16 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="url-input-container">
|
<div className="url-input-container">
|
||||||
<div className={`url-input-content${wide ? ' url-input-content--wide' : ''}`}>
|
<div className="url-input-content">
|
||||||
<div className="url-input-logo">
|
<div className="url-input-logo">
|
||||||
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PipelineTabs value={pipeline} onChange={onPipelineChange} />
|
<PipelineTabs value={pipeline} onChange={handleTabChange} />
|
||||||
|
|
||||||
{/* 고른 기능이 무엇을 해주는지 한 줄. 탭 라벨(2~6자)만으로는 네 기능의 차이가
|
{/* 고른 기능이 무엇을 해주는지 한 줄. 탭 라벨(2~6자)만으로는 네 기능의 차이가
|
||||||
전달되지 않아 처음 온 사람이 아무거나 눌러본다. STEP 1 위에 둔다. */}
|
전달되지 않아 처음 온 사람이 아무거나 눌러본다. STEP 1 위에 둔다. */}
|
||||||
<p className="pipeline-desc">{t(`pipelineTabs.desc.${pipeline}`)}</p>
|
{!showChoice && <p className="pipeline-desc">{t(`pipelineTabs.desc.${pipeline}`)}</p>}
|
||||||
|
|
||||||
{renderForm()}
|
{renderForm()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ContentDetailContent from '../../components/ContentDetailContent';
|
||||||
|
import { P2vContentType } from '../../types/api';
|
||||||
|
import { NAV } from '../../components/navItems';
|
||||||
|
|
||||||
|
interface P2vDetailPageProps {
|
||||||
|
contentId: string;
|
||||||
|
contentType: P2vContentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const P2vDetailPage: React.FC<P2vDetailPageProps> = ({ contentId, contentType }) => (
|
||||||
|
<div className="video-detail-page">
|
||||||
|
<ContentDetailContent
|
||||||
|
key={`${contentType}-${contentId}`}
|
||||||
|
contentId={contentId}
|
||||||
|
contentType={contentType}
|
||||||
|
onClose={() => {
|
||||||
|
localStorage.setItem('castad_active_item', NAV.HOME);
|
||||||
|
window.location.href = '/';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default P2vDetailPage;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { GATE_ORDER } from '../../utils/playreelApi';
|
||||||
|
import { AUTO_APPROVABLE, setAutoApprove, useAutoApprove } from '../../utils/playreelPrefs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 게이트 자동 승인 설정 — 롱컷 시작 화면에 놓는다(playreel 원본과 같은 자리).
|
||||||
|
* 스위치는 되돌릴 수 있는 ①·③ 만 있고, 나머지는 잠금으로 이유를 알려준다.
|
||||||
|
*/
|
||||||
|
const PlayreelAutoApprovePanel: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const prefs = useAutoApprove();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pr-auto">
|
||||||
|
<p className="p2v-label">{t('playreel.auto.title')}</p>
|
||||||
|
<div className="p2v-panel">
|
||||||
|
{AUTO_APPROVABLE.map((gate) => {
|
||||||
|
const name = t(`playreel.gates.${gate}.name`);
|
||||||
|
return (
|
||||||
|
<div key={gate} className="pr-auto__row">
|
||||||
|
<div className="pr-auto__text">
|
||||||
|
<p className="pr-strong">
|
||||||
|
{t('playreel.auto.gate', { step: GATE_ORDER.indexOf(gate) + 1, name })}
|
||||||
|
</p>
|
||||||
|
<p className="p2v-note">{t(`playreel.auto.${gate}`)}</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
role="switch"
|
||||||
|
aria-checked={!!prefs[gate]}
|
||||||
|
aria-label={t('playreel.auto.switchLabel', { name })}
|
||||||
|
className={`pr-switch${prefs[gate] ? ' on' : ''}`}
|
||||||
|
onClick={() => setAutoApprove(gate, !prefs[gate])}
|
||||||
|
>
|
||||||
|
<span className="pr-switch__knob" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<div className="pr-auto__row pr-auto__row--locked">
|
||||||
|
<div className="pr-auto__text">
|
||||||
|
<p className="pr-strong">{t('playreel.auto.lockedTitle')}</p>
|
||||||
|
<p className="p2v-note">{t('playreel.auto.lockedDesc')}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayreelAutoApprovePanel;
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import React, { useMemo, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { InsufficientCreditError } from '../../utils/api';
|
||||||
|
import { createPlayreelJob, parseGoodsId } from '../../utils/playreelApi';
|
||||||
|
import PlayreelAutoApprovePanel from './PlayreelAutoApprovePanel';
|
||||||
|
|
||||||
|
interface PlayreelCreateFormProps {
|
||||||
|
/** 생성 요청이 접수되면 호출. 폴링 소유는 GenerationFlow (썰박스·포스터와 같은 규칙) */
|
||||||
|
onSubmitted: (jobId: string) => void;
|
||||||
|
/** 크레딧 부족(402) 시 충전 화면으로 유도 */
|
||||||
|
onNeedCredit: () => void;
|
||||||
|
/** 시작 선택 화면으로 돌아간다 */
|
||||||
|
onBack: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷(공연 상품페이지 → 30초 예고편) 생성 폼. 진입 화면의 '롱컷' 탭에 들어간다.
|
||||||
|
*
|
||||||
|
* 입력 도중의 안내(상품 번호 인식)는 `parseGoodsId` 가 하고, 판정은 서버가 같은 규칙으로 한다.
|
||||||
|
*/
|
||||||
|
const PlayreelCreateForm: React.FC<PlayreelCreateFormProps> = ({ onSubmitted, onNeedCredit, onBack }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const [url, setUrl] = useState('');
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const goodsId = useMemo(() => parseGoodsId(url), [url]);
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
if (!goodsId || submitting) return;
|
||||||
|
setSubmitting(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const { id } = await createPlayreelJob(url);
|
||||||
|
onSubmitted(id);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof InsufficientCreditError) {
|
||||||
|
onNeedCredit();
|
||||||
|
} else {
|
||||||
|
setError((e as Error).message);
|
||||||
|
}
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-create">
|
||||||
|
<button type="button" className="p2v-back" onClick={onBack}>{t('poster.start.back')}</button>
|
||||||
|
|
||||||
|
<span className="p2v-step">{t('playreel.create.step')}</span>
|
||||||
|
|
||||||
|
<input
|
||||||
|
className="p2v-input p2v-input--center"
|
||||||
|
placeholder={t('playreel.create.placeholder')}
|
||||||
|
value={url}
|
||||||
|
onChange={(e) => setUrl(e.target.value)}
|
||||||
|
onKeyDown={(e) => { if (e.key === 'Enter') submit(); }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{goodsId && (
|
||||||
|
<p className="p2v-note">
|
||||||
|
<span className="p2v-tag">{t('playreel.create.recognized', { id: goodsId })}</span>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{url.trim() && !goodsId && <div className="p2v-note warn">{t('playreel.create.unsupported')}</div>}
|
||||||
|
{error && <div className="p2v-note warn">{error}</div>}
|
||||||
|
|
||||||
|
<button type="button" className="p2v-btn-cta" disabled={!goodsId || submitting} onClick={submit}>
|
||||||
|
{submitting ? t('playreel.create.submitting') : t('playreel.create.submit')}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{/* 게이트 ①·③ 자동 승인 — 시작 전에 정하고, 되돌리는 자리도 여기다 */}
|
||||||
|
<PlayreelAutoApprovePanel />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayreelCreateForm;
|
||||||
@@ -0,0 +1,467 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import {
|
||||||
|
AnalysisReview, ClipReview, FetchReview, FinalReview, GATE_CAN_BACK, GATE_ORDER,
|
||||||
|
GateEdits, GateKey, NarrationReview, PlayreelJob,
|
||||||
|
approvePlayreelGate, backPlayreelGate, retryPlayreelClip,
|
||||||
|
} from '../../utils/playreelApi';
|
||||||
|
import { isAutoApprovable, useAutoApprove } from '../../utils/playreelPrefs';
|
||||||
|
|
||||||
|
interface PlayreelGateContentProps {
|
||||||
|
/** `gate` 와 `review` 가 채워진 검수 대기 잡 */
|
||||||
|
job: PlayreelJob;
|
||||||
|
/** 승인·되돌리기·재생성 요청이 끝나면 호출 — GenerationFlow 가 폴링을 다시 켠다 */
|
||||||
|
onChanged: () => void;
|
||||||
|
/** 자동 승인이 성공했을 때 호출 — 진행 화면이 "자동 승인했습니다" 안내를 이어서 보여준다 */
|
||||||
|
onAutoApproved: (gate: GateKey) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Icon: React.FC<{ d: string; size?: number }> = ({ d, size = 12 }) => (
|
||||||
|
<svg
|
||||||
|
width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
|
strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path d={d} />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
const CHECK = 'M20 6 9 17l-5-5';
|
||||||
|
const CROSS = 'M18 6 6 18M6 6l12 12';
|
||||||
|
const PLUS = 'M12 5v14M5 12h14';
|
||||||
|
const Lock: React.FC<{ size?: number }> = ({ size = 12 }) => (
|
||||||
|
<svg
|
||||||
|
width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
|
strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"
|
||||||
|
>
|
||||||
|
<rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V7a4 4 0 0 1 8 0v4" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
/** 켜고 끄는 칩. `locked` 는 항상 켜져 있어 누를 수 없다 */
|
||||||
|
const Chip: React.FC<{
|
||||||
|
on: boolean; locked?: boolean; onClick?: () => void; children: React.ReactNode;
|
||||||
|
}> = ({ on, locked, onClick, children }) => (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`p2v-chip pr-chip${on ? ' active' : ''}${locked ? ' locked' : ''}`}
|
||||||
|
onClick={locked ? undefined : onClick}
|
||||||
|
>
|
||||||
|
{locked ? <Lock /> : <Icon d={on ? CHECK : PLUS} />}
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
|
||||||
|
// ── ① 수집 확인 ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
type FetchEdits = Extract<GateEdits, { sections: string[] }>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 상세페이지 조각은 라벨이 겹친다 — "유의사항"만 일곱 개인 페이지가 흔하다.
|
||||||
|
* 칩으로 그리면 같은 글자가 줄줄이 서서 무엇을 고르는지 알 수 없어 썸네일을 그린다.
|
||||||
|
*/
|
||||||
|
const FetchGate: React.FC<{ data: FetchReview; onChange: (edits: FetchEdits) => void }> = ({
|
||||||
|
data, onChange,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [sections, setSections] = useState(data.sections);
|
||||||
|
const [meta, setMeta] = useState(data.meta);
|
||||||
|
|
||||||
|
const emit = (nextSections = sections, nextMeta = meta) =>
|
||||||
|
onChange({ sections: nextSections.filter((s) => s.selected).map((s) => s.id), meta: nextMeta });
|
||||||
|
|
||||||
|
const chosen = sections.filter((s) => s.selected).length;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pr-two">
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.fetch.info')}</p>
|
||||||
|
{(['title', 'date_text', 'place'] as const).map((key) => (
|
||||||
|
<div key={key} className="pr-row">
|
||||||
|
<span className="pr-row__label">{t(`playreel.fetch.field.${key}`)}</span>
|
||||||
|
<input
|
||||||
|
className="p2v-input"
|
||||||
|
value={meta[key]}
|
||||||
|
onChange={(e) => {
|
||||||
|
const next = { ...meta, [key]: e.target.value };
|
||||||
|
setMeta(next);
|
||||||
|
emit(sections, next);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<p className="p2v-note">{t('playreel.fetch.cast', { cast: meta.cast.join(', ') })}</p>
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.fetch.sections')}</p>
|
||||||
|
<p className="p2v-help">{t('playreel.fetch.sectionsHelp')}</p>
|
||||||
|
<div className="pr-sections">
|
||||||
|
{sections.map((s, i) => (
|
||||||
|
<button
|
||||||
|
key={s.id}
|
||||||
|
type="button"
|
||||||
|
title={`${s.label} · ${s.height.toLocaleString()}px`}
|
||||||
|
className={`pr-section${s.selected ? ' selected' : ''}${s.required ? ' locked' : ''}`}
|
||||||
|
onClick={s.required ? undefined : () => {
|
||||||
|
const next = sections.map((x) => (x.id === s.id ? { ...x, selected: !x.selected } : x));
|
||||||
|
setSections(next);
|
||||||
|
emit(next);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src={s.thumb_url} alt={s.label} />
|
||||||
|
<span className="pr-section__no">{i + 1}</span>
|
||||||
|
<span className="pr-section__cap">
|
||||||
|
{s.required ? <Lock size={10} /> : <Icon d={s.selected ? CHECK : PLUS} size={10} />}
|
||||||
|
<span>{s.label}</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="p2v-note">
|
||||||
|
{t('playreel.fetch.sectionsCount', { total: sections.length, chosen })}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{data.poster_width <= 800 && (
|
||||||
|
<p className="pr-callout">{t('playreel.fetch.lowRes', { width: data.poster_width })}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.fetch.poster')}</p>
|
||||||
|
<img className="p2v-review__image pr-image" src={data.poster_url} alt={t('playreel.fetch.poster')} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── ② 연출 확인 ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
type AnalysisEdits = Extract<GateEdits, { movable: string[] }>;
|
||||||
|
|
||||||
|
const AnalysisGate: React.FC<{ data: AnalysisReview; onChange: (edits: AnalysisEdits) => void }> = ({
|
||||||
|
data, onChange,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [movable, setMovable] = useState(data.movable);
|
||||||
|
const [fixed, setFixed] = useState(data.fixed);
|
||||||
|
|
||||||
|
const emit = (nextMovable = movable, nextFixed = fixed) =>
|
||||||
|
onChange({
|
||||||
|
movable: nextMovable.filter((x) => x.on).map((x) => x.key),
|
||||||
|
fixed: nextFixed.filter((x) => x.on).map((x) => x.key),
|
||||||
|
model: data.model,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pr-two">
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.analysis.movable')}</p>
|
||||||
|
<p className="p2v-help">{t('playreel.analysis.movableHelp')}</p>
|
||||||
|
<div className="p2v-chips">
|
||||||
|
{movable.map((m) => (
|
||||||
|
<Chip
|
||||||
|
key={m.key}
|
||||||
|
on={m.on}
|
||||||
|
onClick={() => {
|
||||||
|
const next = movable.map((x) => (x.key === m.key ? { ...x, on: !x.on } : x));
|
||||||
|
setMovable(next);
|
||||||
|
emit(next);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{m.label}
|
||||||
|
</Chip>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.analysis.fixed')}</p>
|
||||||
|
<p className="p2v-help">{t('playreel.analysis.fixedHelp')}</p>
|
||||||
|
<div className="p2v-chips">
|
||||||
|
{fixed.map((f) => (
|
||||||
|
<Chip
|
||||||
|
key={f.key}
|
||||||
|
on={f.on}
|
||||||
|
locked={f.key === 'title'}
|
||||||
|
onClick={() => {
|
||||||
|
const next = fixed.map((x) => (x.key === f.key ? { ...x, on: !x.on } : x));
|
||||||
|
setFixed(next);
|
||||||
|
emit(movable, next);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{f.label}
|
||||||
|
</Chip>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.analysis.model')}</p>
|
||||||
|
<p className="p2v-help">{t('playreel.analysis.modelValue')}</p>
|
||||||
|
{data.ip_risk && <p className="pr-callout">{t('playreel.analysis.ipRisk')}</p>}
|
||||||
|
{!data.has_qr && <p className="p2v-note">{t('playreel.analysis.noQr')}</p>}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.analysis.grid')}</p>
|
||||||
|
<img className="p2v-review__image pr-image" src={data.grid_url} alt={t('playreel.analysis.grid')} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── ③ 나레이션·보이스 확인 ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
type NarrationEdits = Extract<GateEdits, { lines: string[] }>;
|
||||||
|
|
||||||
|
const NARRATION_MIN_SECONDS = 28;
|
||||||
|
const NARRATION_MAX_SECONDS = 31;
|
||||||
|
|
||||||
|
const NarrationGate: React.FC<{ data: NarrationReview; onChange: (edits: NarrationEdits) => void }> = ({
|
||||||
|
data, onChange,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [lines, setLines] = useState(data.lines);
|
||||||
|
const lengthOk = data.est_seconds >= NARRATION_MIN_SECONDS && data.est_seconds <= NARRATION_MAX_SECONDS;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pr-two">
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.narration.lines', { count: lines.length })}</p>
|
||||||
|
{lines.map((line, i) => (
|
||||||
|
<div key={i} className="pr-row">
|
||||||
|
<span className="pr-row__label pr-row__label--slot">{line.slot}</span>
|
||||||
|
<input
|
||||||
|
className="p2v-input"
|
||||||
|
value={line.text}
|
||||||
|
onChange={(e) => {
|
||||||
|
const next = lines.map((x, j) => (j === i ? { ...x, text: e.target.value } : x));
|
||||||
|
setLines(next);
|
||||||
|
onChange({ lines: next.map((x) => x.text), voice_id: data.voice.id });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.narration.voice')}</p>
|
||||||
|
<div className="p2v-panel">
|
||||||
|
<p className="pr-strong">{data.voice.name}</p>
|
||||||
|
{data.voice.sample_url ? (
|
||||||
|
<audio controls src={data.voice.sample_url} className="pr-audio" />
|
||||||
|
) : (
|
||||||
|
<p className="p2v-note">{t('playreel.narration.sampleMissing')}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.narration.estimate')}</p>
|
||||||
|
<p className={`pr-stat${lengthOk ? '' : ' warn'}`}>
|
||||||
|
{t('playreel.narration.seconds', { value: data.est_seconds.toFixed(1) })}
|
||||||
|
</p>
|
||||||
|
<p className="p2v-note">
|
||||||
|
{t('playreel.narration.target', { min: NARRATION_MIN_SECONDS, max: NARRATION_MAX_SECONDS })}
|
||||||
|
{!lengthOk && ` — ${t('playreel.narration.adjust')}`}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── ④ 클립 검수 ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const ClipGate: React.FC<{ data: ClipReview }> = ({ data }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<div className="pr-two">
|
||||||
|
<div className="p2v-panel pr-player">
|
||||||
|
{data.clip_url ? (
|
||||||
|
<video src={data.clip_url} controls playsInline />
|
||||||
|
) : (
|
||||||
|
<p className="p2v-note">{t('playreel.clip.missing')}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.clip.titleCheck')}</p>
|
||||||
|
<div className={`p2v-panel pr-verdict${data.gate_passed ? ' ok' : ' fail'}`}>
|
||||||
|
<p className="pr-strong">
|
||||||
|
{t(data.gate_passed ? 'playreel.clip.passed' : 'playreel.clip.failed', {
|
||||||
|
mae: data.title_mae.toFixed(2),
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
<p className="p2v-note">{t('playreel.clip.criteria')}</p>
|
||||||
|
{data.gate_reason && <p className="p2v-note warn">{data.gate_reason}</p>}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.clip.frames')}</p>
|
||||||
|
<img className="p2v-review__image pr-image" src={data.frames_url} alt={t('playreel.clip.frames')} />
|
||||||
|
<p className="pr-callout">{t('playreel.clip.redoNote')}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── ⑤ 최종 검수 ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const FinalGate: React.FC<{ data: FinalReview }> = ({ data }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<div className="pr-two">
|
||||||
|
<div className="p2v-panel pr-player">
|
||||||
|
{data.video_url ? (
|
||||||
|
<video src={data.video_url} controls playsInline />
|
||||||
|
) : (
|
||||||
|
<p className="p2v-note">{t('playreel.final.missing', { seconds: data.duration.toFixed(1) })}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p className="p2v-label">{t('playreel.final.checks')}</p>
|
||||||
|
{data.checks.map((c) => (
|
||||||
|
<p key={c.key} className={`pr-check${c.ok ? '' : ' fail'}`}>
|
||||||
|
<Icon d={c.ok ? CHECK : CROSS} size={14} />
|
||||||
|
{c.label}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<p className="p2v-label pr-gap">{t('playreel.final.proof')}</p>
|
||||||
|
<img className="p2v-review__image pr-image" src={data.proof_url} alt={t('playreel.final.proof')} />
|
||||||
|
<p className="p2v-note">{t('playreel.final.version', { version: data.version })}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── 게이트 셸 ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷 검수 게이트. 파이프라인이 사람의 확인을 기다리며 멈추는 5개 지점 중 하나를 그린다.
|
||||||
|
*
|
||||||
|
* 승인하면 다음 단계가 이어지고, 크레딧을 이미 쓴 지점(연출 확인 이후)부터는 되돌릴 수 없다.
|
||||||
|
* 고친 값은 `edits` ref 에 모았다가 승인할 때 함께 보낸다 — 입력마다 요청하지 않는다.
|
||||||
|
*/
|
||||||
|
const PlayreelGateContent: React.FC<PlayreelGateContentProps> = ({ job, onChanged, onAutoApproved }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const edits = useRef<GateEdits | null>(null);
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const prefs = useAutoApprove();
|
||||||
|
const autoFired = useRef(false); // 같은 게이트에 두 번 보내지 않는다
|
||||||
|
|
||||||
|
const { gate, review } = job;
|
||||||
|
|
||||||
|
// 자동 승인이 켜진 게이트(①·③)는 폴링이 검수 대기를 보는 순간 한 번만 승인한다.
|
||||||
|
// 실패하면 카드가 그대로 남아 사람이 직접 누를 수 있다.
|
||||||
|
const autoGate = isAutoApprovable(gate) && prefs[gate] ? gate : null;
|
||||||
|
const autoActive = autoGate !== null && !error;
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoGate || autoFired.current) return;
|
||||||
|
autoFired.current = true;
|
||||||
|
approvePlayreelGate(job.id, autoGate, null)
|
||||||
|
.then(() => {
|
||||||
|
onAutoApproved(autoGate);
|
||||||
|
onChanged();
|
||||||
|
})
|
||||||
|
.catch((e) => setError(t('playreel.auto.failed', { message: (e as Error).message })));
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [autoGate]);
|
||||||
|
|
||||||
|
if (!gate || !review) return null;
|
||||||
|
|
||||||
|
if (autoActive) {
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-making">
|
||||||
|
<div className="p2v-spinner" aria-hidden="true" />
|
||||||
|
<p className="p2v-making__desc">
|
||||||
|
{t('playreel.auto.working', { step: GATE_ORDER.indexOf(gate) + 1, name: t(`playreel.gates.${gate}.name`) })}
|
||||||
|
</p>
|
||||||
|
<p className="p2v-note">{t('playreel.auto.hint')}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const step = GATE_ORDER.indexOf(gate) + 1;
|
||||||
|
|
||||||
|
const run = async (request: () => Promise<unknown>) => {
|
||||||
|
setBusy(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
await request();
|
||||||
|
edits.current = null;
|
||||||
|
onChanged();
|
||||||
|
} catch (e) {
|
||||||
|
setError((e as Error).message);
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const approveLabel =
|
||||||
|
gate === 'final_confirm' ? t('playreel.gate.approveFinal')
|
||||||
|
: gate === 'clip_confirm' ? t('playreel.gate.approveClip')
|
||||||
|
: t('playreel.gate.approve');
|
||||||
|
|
||||||
|
const renderBody = () => {
|
||||||
|
switch (review.gate) {
|
||||||
|
case 'fetch_confirm':
|
||||||
|
return <FetchGate data={review.data} onChange={(e) => { edits.current = e; }} />;
|
||||||
|
case 'analysis_confirm':
|
||||||
|
return <AnalysisGate data={review.data} onChange={(e) => { edits.current = e; }} />;
|
||||||
|
case 'narration_confirm':
|
||||||
|
return <NarrationGate data={review.data} onChange={(e) => { edits.current = e; }} />;
|
||||||
|
case 'clip_confirm':
|
||||||
|
return <ClipGate data={review.data} />;
|
||||||
|
case 'final_confirm':
|
||||||
|
return <FinalGate data={review.data} />;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-review pr-gate">
|
||||||
|
<p className="pr-gate__eyebrow">
|
||||||
|
{t('playreel.gate.progress', { step, total: GATE_ORDER.length, name: t(`playreel.gates.${gate}.name`) })}
|
||||||
|
</p>
|
||||||
|
<h2 className="pr-gate__title">{t(`playreel.gates.${gate}.title`)}</h2>
|
||||||
|
<p className="p2v-help">{t(`playreel.gates.${gate}.why`)}</p>
|
||||||
|
|
||||||
|
{renderBody()}
|
||||||
|
|
||||||
|
{error && <div className="p2v-note warn">{error}</div>}
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="p2v-btn-cta"
|
||||||
|
disabled={busy}
|
||||||
|
onClick={() => run(() => approvePlayreelGate(job.id, gate, edits.current))}
|
||||||
|
>
|
||||||
|
{busy ? t('playreel.gate.working') : approveLabel}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="pr-gate__actions">
|
||||||
|
{gate === 'clip_confirm' && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="p2v-btn-outline"
|
||||||
|
disabled={busy}
|
||||||
|
onClick={() => run(() => retryPlayreelClip(job.id))}
|
||||||
|
>
|
||||||
|
{t('playreel.gate.redo')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{GATE_CAN_BACK[gate] && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="p2v-btn-outline"
|
||||||
|
disabled={busy}
|
||||||
|
onClick={() => run(() => backPlayreelGate(job.id))}
|
||||||
|
>
|
||||||
|
{t('playreel.gate.back')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-note">
|
||||||
|
{t('playreel.gate.next', {
|
||||||
|
next: t(`playreel.gates.${gate}.next`),
|
||||||
|
eta: t(`playreel.gates.${gate}.eta`),
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayreelGateContent;
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { p2vProgress } from '../../utils/p2vApi';
|
||||||
|
import { GATE_ORDER, GateKey, PlayreelJob } from '../../utils/playreelApi';
|
||||||
|
|
||||||
|
interface PlayreelMakingContentProps {
|
||||||
|
job: PlayreelJob | null;
|
||||||
|
/** 실패한 잡을 버리고 처음부터. 실패하면 크레딧이 환불되므로 같은 잡을 다시 돌리지 않는다 */
|
||||||
|
onDiscard: () => void;
|
||||||
|
busy: boolean;
|
||||||
|
/** 방금 자동 승인한 게이트가 있으면 그 안내. 다음 확인 요청이 올 때까지 보여준다 */
|
||||||
|
autoApprovedGate?: GateKey | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷 진행·실패 화면. 검수 게이트 사이사이의 대기 구간에 쓰인다.
|
||||||
|
*
|
||||||
|
* 진행바는 스테이지 완료 수 기반이라 구간 사이에서 멈춰 보인다 —
|
||||||
|
* 스피너가 "살아 있다"를 따로 알린다(PosterMakingContent 와 같은 판단).
|
||||||
|
*/
|
||||||
|
const PlayreelMakingContent: React.FC<PlayreelMakingContentProps> = ({
|
||||||
|
job, onDiscard, busy, autoApprovedGate,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
if (!job) return null;
|
||||||
|
|
||||||
|
const percent = p2vProgress(job);
|
||||||
|
|
||||||
|
if (job.status === 'failed') {
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-making">
|
||||||
|
<span className="p2v-making__name">{job.name}</span>
|
||||||
|
<h2 className="p2v-making__title warn">{t('playreel.making.failTitle')}</h2>
|
||||||
|
<p className="p2v-making__desc">
|
||||||
|
{t(`playreel.stages.${job.error?.stage}`, { defaultValue: job.error?.stage ?? '' })}
|
||||||
|
</p>
|
||||||
|
{job.error?.detail && <pre className="p2v-errorbox">{job.error.detail}</pre>}
|
||||||
|
<p className="p2v-making__desc">{t('playreel.making.refunded')}</p>
|
||||||
|
<div className="p2v-making__actions">
|
||||||
|
<button type="button" className="p2v-btn-mint" disabled={busy} onClick={onDiscard}>
|
||||||
|
{t('playreel.making.discard')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const stageKey = job.stage ?? '';
|
||||||
|
const copy = t(`playreel.running.${stageKey}`, { defaultValue: t('playreel.making.preparing') });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-making">
|
||||||
|
<span className="p2v-making__name">{job.name}</span>
|
||||||
|
<h2 className="p2v-making__title">{t('playreel.making.title')}</h2>
|
||||||
|
|
||||||
|
<div className="p2v-spinner" aria-hidden="true" />
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="p2v-bar"
|
||||||
|
role="progressbar"
|
||||||
|
aria-valuenow={percent}
|
||||||
|
aria-valuemin={0}
|
||||||
|
aria-valuemax={100}
|
||||||
|
>
|
||||||
|
<div className="p2v-bar__fill" style={{ width: `${percent}%` }} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="p2v-making__meta">
|
||||||
|
<span>{job.status === 'queued' ? t('playreel.making.queued') : copy}</span>
|
||||||
|
<span className="p2v-making__pct">{percent}%</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="p2v-making__desc">{t('playreel.making.wait')}</p>
|
||||||
|
|
||||||
|
{autoApprovedGate && (
|
||||||
|
<p className="pr-auto-note">
|
||||||
|
{t('playreel.auto.done', {
|
||||||
|
step: GATE_ORDER.indexOf(autoApprovedGate) + 1,
|
||||||
|
name: t(`playreel.gates.${autoApprovedGate}.name`),
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayreelMakingContent;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { PlayreelJob } from '../../utils/playreelApi';
|
||||||
|
|
||||||
|
interface PlayreelResultContentProps {
|
||||||
|
job: PlayreelJob;
|
||||||
|
/** 새 롱컷으로 처음부터 */
|
||||||
|
onNew: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷 완성 화면.
|
||||||
|
*
|
||||||
|
* 완성 영상은 blob 에 내려받기 헤더가 붙어 있어, 주소를 그대로 열면 파일로 저장된다.
|
||||||
|
* `<a download>` 는 다른 출처에 듣지 않으므로 이 속성에 기대지 않는다.
|
||||||
|
*/
|
||||||
|
const PlayreelResultContent: React.FC<PlayreelResultContentProps> = ({ job, onNew }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const video = job.artifacts.video ?? '';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-result">
|
||||||
|
<h2 className="p2v-result__title">{t('playreel.result.title')}</h2>
|
||||||
|
|
||||||
|
<div className="p2v-result__grid">
|
||||||
|
<div className="p2v-panel p2v-result__player">
|
||||||
|
{video ? (
|
||||||
|
<video src={video} controls playsInline />
|
||||||
|
) : (
|
||||||
|
<p className="p2v-note">{t('playreel.result.videoMissing')}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="p2v-result__side">
|
||||||
|
<p className="p2v-label">{t('playreel.result.fileName')}</p>
|
||||||
|
<p className="p2v-result__filename">{job.source.slug}_30_v{job.version}.mp4</p>
|
||||||
|
|
||||||
|
<p className="p2v-note">
|
||||||
|
{t('playreel.result.source')}{' '}
|
||||||
|
<a href={job.source.url} target="_blank" rel="noreferrer">{t('playreel.result.sourceLink')}</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div className="p2v-result__actions">
|
||||||
|
{video && (
|
||||||
|
<a href={video} className="p2v-btn-cta p2v-btn-cta--compact">
|
||||||
|
{t('playreel.result.download')}
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" className="p2v-btn-outline p2v-result__new" onClick={onNew}>
|
||||||
|
{t('playreel.result.new')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayreelResultContent;
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import PosterDropzone from '../../components/PosterDropzone';
|
import PosterDropzone from '../../components/PosterDropzone';
|
||||||
import P2vKeyGate from '../../components/P2vKeyGate';
|
import { InsufficientCreditError } from '../../utils/api';
|
||||||
import { P2vAuthError, createPosterJob } from '../../utils/p2vApi';
|
import { createPosterJob } from '../../utils/p2vApi';
|
||||||
|
|
||||||
interface PosterCreateFormProps {
|
interface PosterCreateFormProps {
|
||||||
/** 생성 요청이 접수되면 호출. 폴링 소유는 GenerationFlow (썰박스와 같은 규칙) */
|
/** 생성 요청이 접수되면 호출. 폴링 소유는 GenerationFlow (썰박스와 같은 규칙) */
|
||||||
onSubmitted: (jobId: string) => void;
|
onSubmitted: (jobId: string) => void;
|
||||||
|
/** 크레딧 부족(402) 시 충전 화면으로 유도 */
|
||||||
|
onNeedCredit: () => void;
|
||||||
|
/** 시작 선택 화면으로 돌아간다 */
|
||||||
|
onBack: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,44 +19,35 @@ interface PosterCreateFormProps {
|
|||||||
* 행사명은 비워도 된다 — 서버가 포스터에서 뽑는다. 다만 뽑은 값이 틀릴 수 있어
|
* 행사명은 비워도 된다 — 서버가 포스터에서 뽑는다. 다만 뽑은 값이 틀릴 수 있어
|
||||||
* 검수 단계에서 다시 고칠 기회를 준다(메타태그는 아카이브에 영구 저장된다).
|
* 검수 단계에서 다시 고칠 기회를 준다(메타태그는 아카이브에 영구 저장된다).
|
||||||
*/
|
*/
|
||||||
const PosterCreateForm: React.FC<PosterCreateFormProps> = ({ onSubmitted }) => {
|
const PosterCreateForm: React.FC<PosterCreateFormProps> = ({ onSubmitted, onNeedCredit, onBack }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [file, setFile] = useState<File | null>(null);
|
const [file, setFile] = useState<File | null>(null);
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [authNeeded, setAuthNeeded] = useState(false);
|
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
// P2V 서버(:8010) 미연결 — 프론트만 구현된 상태라 제출 동작을 임시로 끈다.
|
if (!file || submitting) return;
|
||||||
// 서버 연결되면 아래 주석을 해제할 것.
|
setSubmitting(true);
|
||||||
// if (!file || submitting) return;
|
setError(null);
|
||||||
// setSubmitting(true);
|
try {
|
||||||
// setError(null);
|
const { id } = await createPosterJob(file, name.trim());
|
||||||
// try {
|
onSubmitted(id);
|
||||||
// const { id } = await createPosterJob(file, name.trim());
|
} catch (e) {
|
||||||
// onSubmitted(id);
|
if (e instanceof InsufficientCreditError) {
|
||||||
// } catch (e) {
|
onNeedCredit();
|
||||||
// if (e instanceof P2vAuthError) {
|
} else {
|
||||||
// setAuthNeeded(true);
|
setError((e as Error).message);
|
||||||
// } else {
|
}
|
||||||
// setError((e as Error).message);
|
setSubmitting(false);
|
||||||
// }
|
}
|
||||||
// setSubmitting(false);
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (authNeeded) {
|
|
||||||
return (
|
|
||||||
<div className="p2v-scope p2v-create">
|
|
||||||
<P2vKeyGate onSaved={() => { setAuthNeeded(false); submit(); }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p2v-scope p2v-create">
|
<div className="p2v-scope p2v-create">
|
||||||
|
<button type="button" className="p2v-back" onClick={onBack}>{t('poster.start.back')}</button>
|
||||||
|
|
||||||
<span className="p2v-step">{t('poster.create.step')}</span>
|
<span className="p2v-step">{t('poster.create.step')}</span>
|
||||||
|
|
||||||
<PosterDropzone file={file} onFile={setFile} />
|
<PosterDropzone file={file} onFile={setFile} />
|
||||||
@@ -66,6 +61,14 @@ const PosterCreateForm: React.FC<PosterCreateFormProps> = ({ onSubmitted }) => {
|
|||||||
|
|
||||||
{error && <div className="p2v-note warn">{error}</div>}
|
{error && <div className="p2v-note warn">{error}</div>}
|
||||||
|
|
||||||
|
<div className="p2v-create__cost">
|
||||||
|
<span>{t('poster.create.cost')}</span>
|
||||||
|
<span className="p2v-create__cost-badge">
|
||||||
|
<span className="p2v-create__coin" aria-hidden="true">🪙</span>
|
||||||
|
{t('poster.create.costValue')}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="p2v-btn-cta"
|
className="p2v-btn-cta"
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import { P2vJob, isPastReview, p2vProgress } from '../../utils/p2vApi';
|
|||||||
|
|
||||||
interface PosterMakingContentProps {
|
interface PosterMakingContentProps {
|
||||||
job: P2vJob | null;
|
job: P2vJob | null;
|
||||||
/** 실패 시 같은 잡을 다시 태운다 (업로드부터 다시 하지 않는다) */
|
/** 실패한 잡을 버리고 처음부터. 실패하면 크레딧이 환불되므로 같은 잡을 다시 돌리지 않는다 */
|
||||||
onRetry: () => void;
|
|
||||||
/** 실패한 잡을 버리고 처음부터 */
|
|
||||||
onDiscard: () => void;
|
onDiscard: () => void;
|
||||||
busy: boolean;
|
busy: boolean;
|
||||||
}
|
}
|
||||||
@@ -21,7 +19,7 @@ interface PosterMakingContentProps {
|
|||||||
* 스피너가 "살아 있다"를 따로 알린다(썰박스 SsulMakingContent 와 같은 판단).
|
* 스피너가 "살아 있다"를 따로 알린다(썰박스 SsulMakingContent 와 같은 판단).
|
||||||
*/
|
*/
|
||||||
const PosterMakingContent: React.FC<PosterMakingContentProps> = ({
|
const PosterMakingContent: React.FC<PosterMakingContentProps> = ({
|
||||||
job, onRetry, onDiscard, busy,
|
job, onDiscard, busy,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -50,13 +48,11 @@ const PosterMakingContent: React.FC<PosterMakingContentProps> = ({
|
|||||||
{job.error?.detail && (
|
{job.error?.detail && (
|
||||||
<pre className="p2v-errorbox">{job.error.detail}</pre>
|
<pre className="p2v-errorbox">{job.error.detail}</pre>
|
||||||
)}
|
)}
|
||||||
|
<p className="p2v-making__desc">{t('poster.making.refunded')}</p>
|
||||||
<div className="p2v-making__actions">
|
<div className="p2v-making__actions">
|
||||||
<button type="button" className="p2v-btn-outline" disabled={busy} onClick={onDiscard}>
|
<button type="button" className="p2v-btn-mint" disabled={busy} onClick={onDiscard}>
|
||||||
{t('poster.making.discard')}
|
{t('poster.making.discard')}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" className="p2v-btn-mint" disabled={busy} onClick={onRetry}>
|
|
||||||
{t('poster.making.retry')}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { P2vJob, p2vFile } from '../../utils/p2vApi';
|
import { P2vJob } from '../../utils/p2vApi';
|
||||||
|
import { SocialUploadableItem } from '../../types/api';
|
||||||
|
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||||
|
|
||||||
interface PosterResultContentProps {
|
interface PosterResultContentProps {
|
||||||
job: P2vJob;
|
job: P2vJob;
|
||||||
@@ -11,14 +13,33 @@ interface PosterResultContentProps {
|
|||||||
/**
|
/**
|
||||||
* 포스터 영상 완성 화면.
|
* 포스터 영상 완성 화면.
|
||||||
*
|
*
|
||||||
* 다운로드는 `<a download>` 다 — 헤더를 못 붙이므로 p2vFile() 이 접근 키를
|
* 산출물은 Azure Blob 의 절대 URL 이다. 완성 영상은 blob 에 내려받기 헤더가 붙어 있어
|
||||||
* 쿼리로 태워준다(P2V 서버가 ?key= 경로를 지원하는 이유가 이것이다).
|
* `<a download>` 가 다른 출처에서도 파일로 저장된다.
|
||||||
*/
|
*/
|
||||||
const PosterResultContent: React.FC<PosterResultContentProps> = ({ job, onNew }) => {
|
const PosterResultContent: React.FC<PosterResultContentProps> = ({ job, onNew }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [showSocialModal, setShowSocialModal] = useState(false);
|
||||||
|
|
||||||
const video = p2vFile(job.artifacts.video);
|
const video = job.artifacts.video ?? '';
|
||||||
const thumbnail = job.artifacts.thumbnail ? p2vFile(job.artifacts.thumbnail) : null;
|
const thumbnail = job.artifacts.thumbnail ?? null;
|
||||||
|
|
||||||
|
// 소셜 업로드 모달은 VideoListItem 형태를 받는다. type='p2v_video' 가 핵심이다 —
|
||||||
|
// 모달이 content_type 으로 보내므로 id 가 겹치는 ADO2 영상이 업로드되는 사고가 없다.
|
||||||
|
const uploadItem = video
|
||||||
|
? ({
|
||||||
|
type: 'p2v_video',
|
||||||
|
video_id: job.id,
|
||||||
|
store_name: job.name,
|
||||||
|
region: '',
|
||||||
|
task_id: '',
|
||||||
|
result_movie_url: video,
|
||||||
|
thumbnail_url: thumbnail ?? undefined,
|
||||||
|
created_at: new Date(job.created_at * 1000).toISOString(),
|
||||||
|
like_count: 0,
|
||||||
|
comment_count: 0,
|
||||||
|
is_liked_by_me: false,
|
||||||
|
} as SocialUploadableItem)
|
||||||
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p2v-scope p2v-result">
|
<div className="p2v-scope p2v-result">
|
||||||
@@ -81,10 +102,25 @@ const PosterResultContent: React.FC<PosterResultContentProps> = ({ job, onNew })
|
|||||||
{t('poster.result.downloadVideo')}
|
{t('poster.result.downloadVideo')}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
{uploadItem && job.status === 'done' && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="p2v-btn-tonal"
|
||||||
|
onClick={() => setShowSocialModal(true)}
|
||||||
|
>
|
||||||
|
{t('ado2Contents.uploadToSocial')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<SocialPostingModal
|
||||||
|
isOpen={showSocialModal}
|
||||||
|
onClose={() => setShowSocialModal(false)}
|
||||||
|
video={uploadItem}
|
||||||
|
/>
|
||||||
|
|
||||||
<button type="button" className="p2v-btn-outline p2v-result__new" onClick={onNew}>
|
<button type="button" className="p2v-btn-outline p2v-result__new" onClick={onNew}>
|
||||||
{t('poster.result.new')}
|
{t('poster.result.new')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import {
|
import {
|
||||||
P2vJob,
|
P2vJob,
|
||||||
approvePosterJob,
|
approvePosterJob,
|
||||||
p2vFile,
|
|
||||||
updatePosterMetadata,
|
updatePosterMetadata,
|
||||||
updatePosterNarration,
|
updatePosterNarration,
|
||||||
} from '../../utils/p2vApi';
|
} from '../../utils/p2vApi';
|
||||||
@@ -155,7 +154,7 @@ const PosterReviewContent: React.FC<PosterReviewContentProps> = ({ job, onApprov
|
|||||||
{job.artifacts.check_jpg ? (
|
{job.artifacts.check_jpg ? (
|
||||||
<img
|
<img
|
||||||
className="p2v-review__image"
|
className="p2v-review__image"
|
||||||
src={p2vFile(job.artifacts.check_jpg)}
|
src={job.artifacts.check_jpg}
|
||||||
alt={t('poster.review.analysisAlt')}
|
alt={t('poster.review.analysisAlt')}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
/** `ready` 가 false 인 갈래는 버튼이 "준비 중" 으로 잠긴다. 열 때는 이 값만 true 로 바꾼다 */
|
||||||
|
const CARDS = [
|
||||||
|
{ key: 'image', icon: 'IMG', hot: false, ready: true },
|
||||||
|
{ key: 'url', icon: 'URL', hot: true, ready: false },
|
||||||
|
] as const;
|
||||||
|
const FLOW_KEYS = ['first', 'move', 'narration'] as const;
|
||||||
|
const FACT_KEYS = ['need', 'review', 'time'] as const;
|
||||||
|
|
||||||
|
interface PosterStartChoiceProps {
|
||||||
|
/** 이미지로 시작하기 — 포스터 업로드 폼(무빙 포스터)으로 */
|
||||||
|
onPickImage: () => void;
|
||||||
|
/** 공연상품페이지로 시작하기 — 주소 입력 폼(롱컷)으로 */
|
||||||
|
onPickUrl: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 무빙 포스터 시작 선택 화면 — playreel 의 "어떻게 시작할까요?" 와 같은 구성이다.
|
||||||
|
* 가진 것(이미지 한 장 / 상품페이지 주소)에 따라 두 갈래 중 하나를 고른다.
|
||||||
|
*/
|
||||||
|
const PosterStartChoice: React.FC<PosterStartChoiceProps> = ({ onPickImage, onPickUrl }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const handlers = { image: onPickImage, url: onPickUrl };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p2v-scope p2v-start">
|
||||||
|
<h2 className="p2v-start__title">{t('poster.start.title')}</h2>
|
||||||
|
<p className="p2v-start__subtitle">{t('poster.start.subtitle')}</p>
|
||||||
|
|
||||||
|
{CARDS.map(({ key, icon, hot, ready }) => (
|
||||||
|
<div key={key} className={`p2v-panel p2v-intro${hot ? ' p2v-intro--hot' : ''}`}>
|
||||||
|
{hot && <span className="p2v-intro__badge">{t('poster.start.badge')}</span>}
|
||||||
|
<div className="p2v-intro__head">
|
||||||
|
<div className="p2v-intro__icon">{icon}</div>
|
||||||
|
<div>
|
||||||
|
<h3 className="p2v-intro__title">{t(`poster.start.${key}.title`)}</h3>
|
||||||
|
<p className="p2v-intro__desc">{t(`poster.start.${key}.desc`)}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ol className="p2v-intro__flow">
|
||||||
|
{FLOW_KEYS.map((flow, i) => (
|
||||||
|
<li key={flow}>
|
||||||
|
<span className="p2v-intro__flow-number" aria-hidden="true">
|
||||||
|
{String(i + 1).padStart(2, '0')}
|
||||||
|
</span>
|
||||||
|
<span>{t(`poster.start.${key}.flow.${flow}`)}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<div className="p2v-intro__facts">
|
||||||
|
{FACT_KEYS.map((fact) => (
|
||||||
|
<div key={fact}>
|
||||||
|
<b>{t(`poster.start.${key}.facts.${fact}.label`)}</b>
|
||||||
|
<span>{t(`poster.start.${key}.facts.${fact}.value`)}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" className="p2v-btn-cta" disabled={!ready} onClick={handlers[key]}>
|
||||||
|
{ready ? t(`poster.start.${key}.cta`) : t('poster.start.comingSoon')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PosterStartChoice;
|
||||||
@@ -1,335 +0,0 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import PosterDropzone from '../../components/PosterDropzone';
|
|
||||||
import P2vKeyGate from '../../components/P2vKeyGate';
|
|
||||||
import {
|
|
||||||
InternalOnlyWarning,
|
|
||||||
LicenseBadge,
|
|
||||||
UserReferenceNotice,
|
|
||||||
} from '../../components/LicenseBadge';
|
|
||||||
import { useP2vJob } from '../../hooks/useP2vJob';
|
|
||||||
import {
|
|
||||||
F2Category,
|
|
||||||
F2Format,
|
|
||||||
F2Template,
|
|
||||||
F2UploadHint,
|
|
||||||
P2vAuthError,
|
|
||||||
createF2Template,
|
|
||||||
createStylingJob,
|
|
||||||
deleteF2Template,
|
|
||||||
getF2UploadHint,
|
|
||||||
isP2vActive,
|
|
||||||
listF2Categories,
|
|
||||||
listF2Formats,
|
|
||||||
listF2Templates,
|
|
||||||
p2vFile,
|
|
||||||
} from '../../utils/p2vApi';
|
|
||||||
|
|
||||||
/** 사용자가 올린 레퍼런스 카테고리. 서버 카테고리 목록에서 따로 떼어 아래에 둔다 */
|
|
||||||
const USER_CATEGORY = 'user';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 포스터 스타일링(F2).
|
|
||||||
*
|
|
||||||
* **내부 시연 전용이다.** 영화 포스터 레퍼런스는 저작권 자산이라 결과물을 외부에
|
|
||||||
* 공개하면 안 된다(퍼블릭 도메인 명화만 예외). 그래서 화면 상단에 범위를 못박고,
|
|
||||||
* 템플릿마다 배포 등급 배지를 붙인다.
|
|
||||||
*
|
|
||||||
* 다른 파이프라인과 달리 위저드가 아니라 **한 화면짜리 도구**다 — 업로드·템플릿·
|
|
||||||
* 포맷·결과가 한눈에 있어야 여러 스타일을 빠르게 갈아 끼우며 비교할 수 있고,
|
|
||||||
* 30초짜리 작업에 단계를 나누면 왕복만 늘어난다. 그래서 폴링도 GenerationFlow 가
|
|
||||||
* 아니라 이 컴포넌트가 직접 소유한다(F1·썰박스와 다른 유일한 지점).
|
|
||||||
*/
|
|
||||||
const StylingContent: React.FC = () => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const [templates, setTemplates] = useState<F2Template[]>([]);
|
|
||||||
const [categories, setCategories] = useState<F2Category[]>([]);
|
|
||||||
const [formats, setFormats] = useState<F2Format[]>([]);
|
|
||||||
const [hint, setHint] = useState<F2UploadHint | null>(null);
|
|
||||||
|
|
||||||
const [file, setFile] = useState<File | null>(null);
|
|
||||||
const [selected, setSelected] = useState<string | null>(null);
|
|
||||||
const [format, setFormat] = useState('poster');
|
|
||||||
const [jobId, setJobId] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const [tplOpen, setTplOpen] = useState(true);
|
|
||||||
const [busy, setBusy] = useState(false);
|
|
||||||
const [refBusy, setRefBusy] = useState(false);
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
const [authNeeded, setAuthNeeded] = useState(false);
|
|
||||||
|
|
||||||
const refInput = useRef<HTMLInputElement>(null);
|
|
||||||
const { job, authNeeded: jobAuthNeeded } = useP2vJob('f2', jobId);
|
|
||||||
|
|
||||||
const selectedTpl = templates.find((tpl) => tpl.id === selected) ?? null;
|
|
||||||
const running = isP2vActive(job);
|
|
||||||
|
|
||||||
const loadAll = useCallback(async () => {
|
|
||||||
try {
|
|
||||||
const [tpls, cats, fmts, uploadHint] = await Promise.all([
|
|
||||||
listF2Templates(),
|
|
||||||
listF2Categories(),
|
|
||||||
listF2Formats(),
|
|
||||||
getF2UploadHint(),
|
|
||||||
]);
|
|
||||||
setTemplates(tpls);
|
|
||||||
setCategories(cats);
|
|
||||||
setFormats(fmts);
|
|
||||||
setHint(uploadHint);
|
|
||||||
setAuthNeeded(false);
|
|
||||||
setError(null);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof P2vAuthError) setAuthNeeded(true);
|
|
||||||
else setError((e as Error).message);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// P2V 서버(:8010) 미연결 — 프론트만 구현된 상태라 자동 로드를 임시로 끈다.
|
|
||||||
// 서버 연결되면 아래 주석을 해제할 것. (templates/categories/formats/hint 가
|
|
||||||
// 계속 비어 있으면 아래 렌더링에서 템플릿 카드·제출 버튼이 자연히 비활성 상태가 된다.)
|
|
||||||
// loadAll();
|
|
||||||
}, [loadAll]);
|
|
||||||
|
|
||||||
const uploadReference = async (f: File) => {
|
|
||||||
setRefBusy(true);
|
|
||||||
setError(null);
|
|
||||||
try {
|
|
||||||
const tpl = await createF2Template(f, f.name.replace(/\.[^.]+$/, '').slice(0, 40));
|
|
||||||
setTemplates(await listF2Templates());
|
|
||||||
setSelected(tpl.id); // 방금 올린 것을 바로 고른 상태로
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof P2vAuthError) setAuthNeeded(true);
|
|
||||||
else setError((e as Error).message);
|
|
||||||
} finally {
|
|
||||||
setRefBusy(false);
|
|
||||||
if (refInput.current) refInput.current.value = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeReference = async (id: string) => {
|
|
||||||
if (!window.confirm(t('poster.styling.confirmDelete'))) return;
|
|
||||||
try {
|
|
||||||
await deleteF2Template(id);
|
|
||||||
if (selected === id) setSelected(null);
|
|
||||||
setTemplates(await listF2Templates());
|
|
||||||
} catch (e) {
|
|
||||||
setError((e as Error).message);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const submit = async () => {
|
|
||||||
if (!file || !selected || busy) return;
|
|
||||||
setBusy(true);
|
|
||||||
setError(null);
|
|
||||||
try {
|
|
||||||
const { id } = await createStylingJob(file, selected, format);
|
|
||||||
setJobId(id);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof P2vAuthError) setAuthNeeded(true);
|
|
||||||
else setError((e as Error).message);
|
|
||||||
} finally {
|
|
||||||
setBusy(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (authNeeded || jobAuthNeeded) {
|
|
||||||
return (
|
|
||||||
<div className="p2v-scope p2v-styling">
|
|
||||||
<P2vKeyGate onSaved={() => { setAuthNeeded(false); loadAll(); }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const renderCard = (tpl: F2Template) => (
|
|
||||||
<div key={tpl.id} className="p2v-tplcard">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
aria-pressed={selected === tpl.id}
|
|
||||||
className={`p2v-tpl${selected === tpl.id ? ' active' : ''}`}
|
|
||||||
onClick={() => setSelected(tpl.id)}
|
|
||||||
>
|
|
||||||
{/* 명화는 가로 그림도 있다 — cover 로 자르면 무엇인지 알 수 없어 contain 을 쓴다 */}
|
|
||||||
<img src={p2vFile(tpl.thumb_url)} alt={tpl.name_ko} />
|
|
||||||
<span className="p2v-tpl__name">{tpl.name_ko}</span>
|
|
||||||
{/* 제목이 1줄인 카드와 2줄인 카드가 섞인다. 아래로 밀어붙여야 한 행의 배지가 같은 선에 선다 */}
|
|
||||||
<span className="p2v-tpl__badge">
|
|
||||||
<LicenseBadge license={tpl.license} />
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
{tpl.removable && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="p2v-tpl__remove"
|
|
||||||
title={t('poster.styling.deleteRef')}
|
|
||||||
onClick={() => removeReference(tpl.id)}
|
|
||||||
>
|
|
||||||
×
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="p2v-scope p2v-styling">
|
|
||||||
<div className="p2v-notice p2v-notice--warn p2v-styling__scope">
|
|
||||||
{t('poster.styling.internalScope')}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* ── 스타일 템플릿 (접이식) ─────────────────────── */}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="p2v-collapse"
|
|
||||||
aria-expanded={tplOpen}
|
|
||||||
onClick={() => setTplOpen(!tplOpen)}
|
|
||||||
>
|
|
||||||
<span className="p2v-label">{t('poster.styling.templates')}</span>
|
|
||||||
{!tplOpen && selectedTpl && (
|
|
||||||
<span className="p2v-collapse__picked">
|
|
||||||
<img src={p2vFile(selectedTpl.thumb_url)} alt="" />
|
|
||||||
<b>{selectedTpl.name_ko}</b>
|
|
||||||
<LicenseBadge license={selectedTpl.license} />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{!tplOpen && !selectedTpl && (
|
|
||||||
<span className="p2v-collapse__empty">{t('poster.styling.pickTemplate')}</span>
|
|
||||||
)}
|
|
||||||
<svg
|
|
||||||
className={`p2v-collapse__caret${tplOpen ? ' open' : ''}`}
|
|
||||||
width="18" height="18" viewBox="0 0 24 24" fill="none"
|
|
||||||
stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"
|
|
||||||
>
|
|
||||||
<path d="m6 9 6 6 6-6" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{tplOpen && categories.filter((c) => c.id !== USER_CATEGORY).map((cat) => {
|
|
||||||
const items = templates.filter((tpl) => tpl.category === cat.id);
|
|
||||||
if (items.length === 0) return null;
|
|
||||||
return (
|
|
||||||
<div key={cat.id} className="p2v-tplgroup">
|
|
||||||
<p className="p2v-tplgroup__title">
|
|
||||||
{cat.label}
|
|
||||||
<span>{t('poster.styling.count', { count: items.length })}</span>
|
|
||||||
</p>
|
|
||||||
<div className="p2v-tplgrid">{items.map(renderCard)}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
|
|
||||||
{/* 내 레퍼런스 — 목록이 비어도 업로드 타일은 보여야 하므로 categories 가 아니라
|
|
||||||
upload-hint 의 enabled 로 렌더한다 */}
|
|
||||||
{tplOpen && hint?.enabled && (
|
|
||||||
<div className="p2v-tplgroup">
|
|
||||||
<p className="p2v-tplgroup__title">
|
|
||||||
{t('poster.styling.myRefs')}
|
|
||||||
<span>{t('poster.styling.myRefsHint')}</span>
|
|
||||||
</p>
|
|
||||||
<div className="p2v-tplgrid">
|
|
||||||
{templates.filter((tpl) => tpl.category === USER_CATEGORY).map(renderCard)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="p2v-tpl p2v-tpl--add"
|
|
||||||
disabled={refBusy}
|
|
||||||
onClick={() => refInput.current?.click()}
|
|
||||||
>
|
|
||||||
{refBusy ? (
|
|
||||||
<>
|
|
||||||
<span className="p2v-spinner p2v-spinner--sm" aria-hidden="true" />
|
|
||||||
<span className="p2v-tpl__name">{t('poster.styling.analyzing')}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<span className="p2v-tpl__plus" aria-hidden="true">+</span>
|
|
||||||
<span className="p2v-tpl__name">{t('poster.styling.addRef')}</span>
|
|
||||||
<span className="p2v-tpl__sub">
|
|
||||||
{t('poster.styling.minEdge', { px: hint.min_long_edge })}
|
|
||||||
</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
<input
|
|
||||||
ref={refInput}
|
|
||||||
type="file"
|
|
||||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
|
||||||
hidden
|
|
||||||
onChange={(e) => { const f = e.target.files?.[0]; if (f) uploadReference(f); }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<UserReferenceNotice />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 경고는 실제로 고른 순간에만 */}
|
|
||||||
{selectedTpl?.license === 'internal-only' && (
|
|
||||||
<InternalOnlyWarning note={selectedTpl.license_note} />
|
|
||||||
)}
|
|
||||||
{selectedTpl?.attribution && (
|
|
||||||
<p className="p2v-note">{t('poster.styling.attribution', { source: selectedTpl.attribution })}</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* ── 입력 / 결과 ─────────────────────────────── */}
|
|
||||||
<div className="p2v-styling__io">
|
|
||||||
<div>
|
|
||||||
<p className="p2v-label">{t('poster.styling.myPoster')}</p>
|
|
||||||
<PosterDropzone file={file} onFile={setFile} />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="p2v-label">{t('poster.styling.result')}</p>
|
|
||||||
{job?.status === 'done' && job.artifacts.image ? (
|
|
||||||
<div className="p2v-panel p2v-styling__out">
|
|
||||||
<img src={p2vFile(job.artifacts.image)} alt={t('poster.styling.resultAlt')} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="p2v-panel p2v-styling__out p2v-styling__out--empty">
|
|
||||||
{running && <span className="p2v-spinner p2v-spinner--md" aria-hidden="true" />}
|
|
||||||
<span>{t(running ? 'poster.styling.converting' : 'poster.styling.resultHint')}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{job?.status === 'done' && job.artifacts.image && (
|
|
||||||
<div className="p2v-styling__download">
|
|
||||||
<a href={p2vFile(job.artifacts.image)} download className="p2v-btn-tonal">
|
|
||||||
{t('poster.styling.downloadPng')}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* ── 출력 포맷 ───────────────────────────────── */}
|
|
||||||
<p className="p2v-label">{t('poster.styling.formats')}</p>
|
|
||||||
<div className="p2v-formats">
|
|
||||||
{formats.map((f) => (
|
|
||||||
<button
|
|
||||||
key={f.id}
|
|
||||||
type="button"
|
|
||||||
aria-pressed={format === f.id}
|
|
||||||
className={`p2v-select${format === f.id ? ' active' : ''}`}
|
|
||||||
onClick={() => setFormat(f.id)}
|
|
||||||
>
|
|
||||||
{f.label}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="p2v-btn-cta"
|
|
||||||
disabled={!file || !selected || busy || running}
|
|
||||||
onClick={submit}
|
|
||||||
>
|
|
||||||
{running
|
|
||||||
? t('poster.styling.converting')
|
|
||||||
: busy ? t('poster.create.submitting') : t('poster.styling.submit')}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{error && <div className="p2v-note warn">{error}</div>}
|
|
||||||
{job?.status === 'failed' && job.error && (
|
|
||||||
<pre className="p2v-errorbox">{job.error.detail}</pre>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default StylingContent;
|
|
||||||
@@ -1,20 +1,5 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import ContentDetailContent from '../../components/ContentDetailContent';
|
||||||
import {
|
|
||||||
API_URL,
|
|
||||||
deleteComment,
|
|
||||||
getSsulContentById,
|
|
||||||
getUserMe,
|
|
||||||
getVideoComments,
|
|
||||||
isLoggedIn,
|
|
||||||
postVideoComment,
|
|
||||||
toggleVideoLike,
|
|
||||||
} from '../../utils/api';
|
|
||||||
import type { SsulDetailItem } from '../../utils/api';
|
|
||||||
import { CommentItem, UserMeResponse } from '../../types/api';
|
|
||||||
import { buildContentShareUrl, tryNativeShare } from '../../utils/nativeShare';
|
|
||||||
import LoginPromptModal from '../../components/LoginPromptModal';
|
|
||||||
import { isSafeHttpUrl } from '../../utils/url';
|
|
||||||
|
|
||||||
interface SsulDetailContentProps {
|
interface SsulDetailContentProps {
|
||||||
contentId: string;
|
contentId: string;
|
||||||
@@ -22,467 +7,8 @@ interface SsulDetailContentProps {
|
|||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const SsulDetailContent: React.FC<SsulDetailContentProps> = (props) => (
|
||||||
* 썰박스 콘텐츠 상세 — castad `VideoDetailContent` 와 같은 3층 구조의 내용부.
|
<ContentDetailContent {...props} contentType="ssul" />
|
||||||
* (SsulViewerModal 이 모달로, SsulDetailPage 가 공유 링크 페이지로 감싼다)
|
);
|
||||||
*
|
|
||||||
* UI·동작(좋아요 낙관 갱신·댓글·대댓글·공유·비로그인 게이트)은
|
|
||||||
* `VideoDetailContent` 와 동일하고, 다른 점은 셋뿐이다:
|
|
||||||
* 1. 상세 조회가 `GET /ssul/{id}` (video 조회를 쓰면 id 가 겹치는 남의 영상이 열린다)
|
|
||||||
* 2. 좋아요·댓글 API 에 `contentType='ssul'` 을 얹는다
|
|
||||||
* 3. 공유 URL 이 `/ssul/share/{id}` 다
|
|
||||||
*/
|
|
||||||
const SsulDetailContent: React.FC<SsulDetailContentProps> = ({
|
|
||||||
contentId,
|
|
||||||
isModal = false,
|
|
||||||
onClose,
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const authed = isLoggedIn();
|
|
||||||
|
|
||||||
const [content, setContent] = useState<SsulDetailItem | null>(null);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const [likeCount, setLikeCount] = useState(0);
|
|
||||||
const [isLiked, setIsLiked] = useState(false);
|
|
||||||
|
|
||||||
const [copied, setCopied] = useState(false);
|
|
||||||
const [isLandscape, setIsLandscape] = useState(false);
|
|
||||||
const [showSiteOverlay, setShowSiteOverlay] = useState(false);
|
|
||||||
const [showLoginModal, setShowLoginModal] = useState(false);
|
|
||||||
|
|
||||||
const [comments, setComments] = useState<CommentItem[]>([]);
|
|
||||||
const [commentsTotal, setCommentsTotal] = useState(0);
|
|
||||||
const [commentsPage, setCommentsPage] = useState(1);
|
|
||||||
const [commentsHasNext, setCommentsHasNext] = useState(false);
|
|
||||||
const [commentsLoading, setCommentsLoading] = useState(false);
|
|
||||||
const [commentInput, setCommentInput] = useState('');
|
|
||||||
const [commentSubmitting, setCommentSubmitting] = useState(false);
|
|
||||||
const commentTextareaRef = useRef<HTMLTextAreaElement>(null);
|
|
||||||
|
|
||||||
const [currentUser, setCurrentUser] = useState<UserMeResponse | null>(null);
|
|
||||||
|
|
||||||
const fetchComments = useCallback(
|
|
||||||
async (page: number, append = false) => {
|
|
||||||
setCommentsLoading(true);
|
|
||||||
try {
|
|
||||||
const res = await getVideoComments(contentId, page, 20, 'ssul');
|
|
||||||
const sorted = [...res.items].sort(
|
|
||||||
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
|
||||||
);
|
|
||||||
setComments((prev) => (append ? [...prev, ...sorted] : sorted));
|
|
||||||
setCommentsTotal(res.total);
|
|
||||||
setCommentsHasNext(res.has_next);
|
|
||||||
setCommentsPage(page);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to fetch ssul comments:', err);
|
|
||||||
} finally {
|
|
||||||
setCommentsLoading(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[contentId]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const fetchContent = async () => {
|
|
||||||
setLoading(true);
|
|
||||||
setError(null);
|
|
||||||
setShowSiteOverlay(false);
|
|
||||||
try {
|
|
||||||
const data = await getSsulContentById(contentId);
|
|
||||||
setContent(data);
|
|
||||||
setLikeCount(data.like_count);
|
|
||||||
setIsLiked(data.is_liked_by_me);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to fetch ssul content:', err);
|
|
||||||
setError(t('ado2Contents.loadFailed'));
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
setIsLandscape(false);
|
|
||||||
fetchContent();
|
|
||||||
fetchComments(1);
|
|
||||||
}, [contentId, fetchComments, t]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!authed) return;
|
|
||||||
getUserMe().then(setCurrentUser).catch((err) => {
|
|
||||||
console.error('Failed to fetch current user:', err);
|
|
||||||
});
|
|
||||||
}, [authed]);
|
|
||||||
|
|
||||||
const formatDate = (dateString: string) => {
|
|
||||||
const date = new Date(dateString);
|
|
||||||
return t('videoDetail.dateFormat', {
|
|
||||||
year: date.getFullYear(),
|
|
||||||
month: date.getMonth() + 1,
|
|
||||||
day: date.getDate(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatCommentDate = (dateString: string) => {
|
|
||||||
const date = new Date(dateString);
|
|
||||||
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(
|
|
||||||
date.getDate()
|
|
||||||
).padStart(2, '0')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 썰박스 공개 페이지 경로. /video/{id} 를 쓰면 id 가 겹치는 남의 영상이 열린다.
|
|
||||||
const shareUrl = buildContentShareUrl(API_URL, contentId, 'ssul');
|
|
||||||
|
|
||||||
const handleCopyLink = async () => {
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(shareUrl);
|
|
||||||
} catch {
|
|
||||||
// clipboard API 미지원 환경에서는 무시
|
|
||||||
}
|
|
||||||
setCopied(true);
|
|
||||||
setTimeout(() => setCopied(false), 2000);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleShareButtonClick = async () => {
|
|
||||||
const handled = await tryNativeShare({
|
|
||||||
title: content?.store_name ?? t('videoDetail.kakaoDefaultTitle'),
|
|
||||||
url: shareUrl,
|
|
||||||
});
|
|
||||||
if (handled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await handleCopyLink();
|
|
||||||
};
|
|
||||||
|
|
||||||
const likeDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
||||||
|
|
||||||
const handleLike = () => {
|
|
||||||
if (!authed) {
|
|
||||||
setShowLoginModal(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsLiked((prev) => !prev);
|
|
||||||
setLikeCount((prev) => (isLiked ? prev - 1 : prev + 1));
|
|
||||||
|
|
||||||
if (likeDebounceRef.current) clearTimeout(likeDebounceRef.current);
|
|
||||||
likeDebounceRef.current = setTimeout(async () => {
|
|
||||||
const prevLiked = isLiked;
|
|
||||||
const prevCount = likeCount;
|
|
||||||
try {
|
|
||||||
await toggleVideoLike(contentId, 'ssul');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to toggle ssul like:', err);
|
|
||||||
setIsLiked(prevLiked);
|
|
||||||
setLikeCount(prevCount);
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleHeaderAction = () => {
|
|
||||||
if (!isModal && !authed) {
|
|
||||||
setShowLoginModal(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
onClose?.();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCommentFocus = () => {
|
|
||||||
if (!authed) setShowLoginModal(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCommentSubmit = async () => {
|
|
||||||
if (!authed) {
|
|
||||||
setShowLoginModal(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!commentInput.trim() || commentSubmitting) return;
|
|
||||||
setCommentSubmitting(true);
|
|
||||||
try {
|
|
||||||
await postVideoComment(contentId, commentInput.trim(), undefined, 'ssul');
|
|
||||||
setCommentInput('');
|
|
||||||
if (commentTextareaRef.current) {
|
|
||||||
commentTextareaRef.current.style.height = 'auto';
|
|
||||||
}
|
|
||||||
await fetchComments(1);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to post ssul comment:', err);
|
|
||||||
} finally {
|
|
||||||
setCommentSubmitting(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteComment = async (commentId: number) => {
|
|
||||||
try {
|
|
||||||
await deleteComment(commentId);
|
|
||||||
await fetchComments(commentsPage);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to delete ssul comment:', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderCommentContent = (content_: string | null, isDeleted: boolean) => {
|
|
||||||
if (isDeleted) {
|
|
||||||
return (
|
|
||||||
<span style={{ color: '#6B9EA0', fontStyle: 'italic' }}>
|
|
||||||
{t('videoDetail.deletedComment')}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return content_;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={isModal ? 'video-detail-modal-content' : 'video-detail-page-content'}>
|
|
||||||
{/* 헤더 */}
|
|
||||||
<div className="video-detail-header">
|
|
||||||
{isModal ? (
|
|
||||||
<>
|
|
||||||
{/* 제목이 없으면 space-between 인 헤더에서 닫기 버튼이 왼쪽으로 붙는다.
|
|
||||||
문구는 ADO2 상세와 같은 키를 쓴다 — 통합 목록에서 열리는 같은
|
|
||||||
모달이므로 콘텐츠 종류에 따라 제목이 바뀌면 오히려 어색하다. */}
|
|
||||||
<h2 className="video-detail-modal-title">{t('sidebar.ado2Contents')}</h2>
|
|
||||||
<button className="video-detail-close-btn" onClick={handleHeaderAction} aria-label={t('videoDetail.closeAriaLabel')}>
|
|
||||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
||||||
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<button className="video-detail-back-btn" onClick={handleHeaderAction}>
|
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
||||||
<path d="M13 4l-6 6 6 6" />
|
|
||||||
</svg>
|
|
||||||
{t('sidebar.ado2Contents')}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="video-detail-body">
|
|
||||||
{loading ? (
|
|
||||||
<div className="ado2-contents-loading">
|
|
||||||
<div className="loading-spinner"></div>
|
|
||||||
<p>{t('ado2Contents.loading')}</p>
|
|
||||||
</div>
|
|
||||||
) : error ? (
|
|
||||||
<div className="ado2-contents-error"><p>{error}</p></div>
|
|
||||||
) : content ? (
|
|
||||||
<div className={`video-detail-content ${isLandscape ? 'landscape' : ''}`}>
|
|
||||||
<div className="video-detail-player-wrap">
|
|
||||||
<video
|
|
||||||
src={content.video_url}
|
|
||||||
controls
|
|
||||||
autoPlay
|
|
||||||
playsInline
|
|
||||||
controlsList="nodownload"
|
|
||||||
onContextMenu={(e) => e.preventDefault()}
|
|
||||||
className="video-detail-player"
|
|
||||||
onLoadedMetadata={(e) => {
|
|
||||||
const v = e.currentTarget;
|
|
||||||
setIsLandscape(v.videoWidth > v.videoHeight);
|
|
||||||
}}
|
|
||||||
onTimeUpdate={(e) => {
|
|
||||||
if (!content.official_site_url) return;
|
|
||||||
const v = e.currentTarget;
|
|
||||||
// 영상 종료 3초 전부터 공식 홈페이지 오버레이 노출
|
|
||||||
setShowSiteOverlay(
|
|
||||||
Number.isFinite(v.duration) && v.duration - v.currentTime <= 3
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{showSiteOverlay && isSafeHttpUrl(content.official_site_url) && (
|
|
||||||
<a
|
|
||||||
href={content.official_site_url as string}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="video-site-overlay"
|
|
||||||
>
|
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
||||||
<circle cx="12" cy="12" r="10"/>
|
|
||||||
<line x1="2" y1="12" x2="22" y2="12"/>
|
|
||||||
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
|
|
||||||
</svg>
|
|
||||||
<span className="video-site-overlay-text">
|
|
||||||
<strong>{content.store_name}</strong>
|
|
||||||
{t('videoDetail.siteOverlayLabel')}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="video-detail-info">
|
|
||||||
<h2 className="video-detail-store">
|
|
||||||
{content.store_name || t('ssulbox.viewer.untitled')}
|
|
||||||
</h2>
|
|
||||||
<p className="video-detail-date">{formatDate(content.created_at)}</p>
|
|
||||||
|
|
||||||
{/* 좋아요 + 공유 */}
|
|
||||||
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
|
||||||
<button
|
|
||||||
className={`video-detail-like-btn ${isLiked ? 'liked' : ''}`}
|
|
||||||
onClick={handleLike}
|
|
||||||
>
|
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill={isLiked ? 'currentColor' : 'none'} stroke="currentColor" strokeWidth="2">
|
|
||||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
|
||||||
</svg>
|
|
||||||
{likeCount}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="video-detail-copy-btn"
|
|
||||||
onClick={handleShareButtonClick}
|
|
||||||
title={t('videoDetail.share')}
|
|
||||||
>
|
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
||||||
<circle cx="18" cy="5" r="3" /><circle cx="6" cy="12" r="3" /><circle cx="18" cy="19" r="3" />
|
|
||||||
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" /><line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
|
||||||
</svg>
|
|
||||||
{copied ? t('videoDetail.copied') : t('videoDetail.share')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 댓글 섹션 */}
|
|
||||||
<div className="video-detail-comments">
|
|
||||||
<div className="video-detail-comments-header">
|
|
||||||
<h3 className="video-detail-comments-title">{t('videoDetail.commentsTitle')}</h3>
|
|
||||||
<span className="video-detail-comments-count">{commentsTotal}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{authed && currentUser && (
|
|
||||||
<div className="video-detail-comment-profile">
|
|
||||||
{currentUser.profile_image_url && (
|
|
||||||
<img
|
|
||||||
src={currentUser.profile_image_url}
|
|
||||||
alt={currentUser.nickname}
|
|
||||||
className="video-detail-comment-avatar"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<span className="video-detail-comment-nickname">{currentUser.nickname}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="video-detail-comment-input-wrap">
|
|
||||||
<textarea
|
|
||||||
ref={commentTextareaRef}
|
|
||||||
className="video-detail-comment-input"
|
|
||||||
placeholder={authed ? t('videoDetail.commentPlaceholder') : t('videoDetail.commentLoginRequired')}
|
|
||||||
maxLength={500}
|
|
||||||
rows={1}
|
|
||||||
value={commentInput}
|
|
||||||
onChange={(e) => {
|
|
||||||
setCommentInput(e.target.value);
|
|
||||||
e.target.style.height = 'auto';
|
|
||||||
e.target.style.height = `${e.target.scrollHeight}px`;
|
|
||||||
}}
|
|
||||||
onFocus={handleCommentFocus}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
|
||||||
e.preventDefault();
|
|
||||||
handleCommentSubmit();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
disabled={!authed}
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
className="video-detail-comment-submit"
|
|
||||||
onClick={handleCommentSubmit}
|
|
||||||
disabled={!authed || !commentInput.trim() || commentSubmitting}
|
|
||||||
>
|
|
||||||
{commentSubmitting ? t('videoDetail.commentSubmitting') : t('videoDetail.commentSubmit')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{comments.length === 0 && !commentsLoading ? (
|
|
||||||
<p className="video-detail-comments-empty">{t('videoDetail.noComments')}</p>
|
|
||||||
) : (
|
|
||||||
<ul className="video-detail-comment-list">
|
|
||||||
{comments.map((c) => (
|
|
||||||
<li key={c.id} className="video-detail-comment-item">
|
|
||||||
{c.profile_image_url && (
|
|
||||||
<img
|
|
||||||
src={c.profile_image_url}
|
|
||||||
alt={c.nickname || t('videoDetail.anonymous')}
|
|
||||||
className="video-detail-comment-avatar"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="video-detail-comment-body">
|
|
||||||
<span className="video-detail-comment-nickname">
|
|
||||||
{c.nickname || t('videoDetail.anonymous')}
|
|
||||||
</span>
|
|
||||||
<p className="video-detail-comment-text">
|
|
||||||
{renderCommentContent(c.content, c.is_deleted)}
|
|
||||||
</p>
|
|
||||||
<div className="video-detail-comment-bottom">
|
|
||||||
<span className="video-detail-comment-date">{formatCommentDate(c.created_at)}</span>
|
|
||||||
{c.is_mine && !c.is_deleted && (
|
|
||||||
<button
|
|
||||||
className="video-detail-comment-delete"
|
|
||||||
onClick={() => handleDeleteComment(c.id)}
|
|
||||||
>
|
|
||||||
{t('videoDetail.deleteComment')}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{c.replies && c.replies.length > 0 && (
|
|
||||||
<ul className="video-detail-reply-list">
|
|
||||||
{c.replies.map((r) => (
|
|
||||||
<li key={r.id} className="video-detail-reply-item">
|
|
||||||
{r.profile_image_url && (
|
|
||||||
<img
|
|
||||||
src={r.profile_image_url}
|
|
||||||
alt={r.nickname || t('videoDetail.anonymous')}
|
|
||||||
className="video-detail-comment-avatar small"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="video-detail-comment-body">
|
|
||||||
<span className="video-detail-comment-nickname">
|
|
||||||
{r.nickname || t('videoDetail.anonymous')}
|
|
||||||
</span>
|
|
||||||
<p className="video-detail-comment-text">
|
|
||||||
{renderCommentContent(r.content, r.is_deleted)}
|
|
||||||
</p>
|
|
||||||
<div className="video-detail-comment-bottom">
|
|
||||||
<span className="video-detail-comment-date">{formatCommentDate(r.created_at)}</span>
|
|
||||||
{r.is_mine && !r.is_deleted && (
|
|
||||||
<button
|
|
||||||
className="video-detail-comment-delete"
|
|
||||||
onClick={() => handleDeleteComment(r.id)}
|
|
||||||
>
|
|
||||||
{t('videoDetail.deleteComment')}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{commentsHasNext && (
|
|
||||||
<button
|
|
||||||
className="video-detail-comments-more"
|
|
||||||
onClick={() => fetchComments(commentsPage + 1, true)}
|
|
||||||
disabled={commentsLoading}
|
|
||||||
>
|
|
||||||
{commentsLoading ? t('videoDetail.loadingComments') : t('videoDetail.loadMoreComments')}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{showLoginModal && (
|
|
||||||
<LoginPromptModal onClose={() => setShowLoginModal(false)} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SsulDetailContent;
|
export default SsulDetailContent;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { SsulTaskStatus, getSsulTask } from '../../utils/api';
|
import { SsulTaskStatus, getSsulTask } from '../../utils/api';
|
||||||
import { VideoListItem } from '../../types/api';
|
import { SocialUploadableItem } from '../../types/api';
|
||||||
import SocialPostingModal from '../../components/SocialPostingModal';
|
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||||
import CompletionView from '../../components/CompletionView';
|
import CompletionView from '../../components/CompletionView';
|
||||||
import { Scen, scenDesc, scenName } from './ssulData';
|
import { Scen, scenDesc, scenName } from './ssulData';
|
||||||
@@ -136,7 +136,7 @@ const SsulResultContent: React.FC<SsulResultContentProps> = ({ taskId, scenario
|
|||||||
created_at: task.created_at,
|
created_at: task.created_at,
|
||||||
like_count: 0,
|
like_count: 0,
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
} as VideoListItem)
|
} as SocialUploadableItem)
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2416,14 +2416,6 @@
|
|||||||
max-width: 375px;
|
max-width: 375px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 진입 화면에 들어가는 폼은 대부분 한 줄 입력이라 375px 로 충분하지만,
|
|
||||||
포스터 스타일링(F2)은 템플릿 그리드·입출력 2단이 한 화면에 있는 **도구**라
|
|
||||||
그 폭에서는 못 쓴다.
|
|
||||||
(세로 넘침 처리는 이제 컨테이너 기본 규칙이 담당한다 — 예외를 두지 않는다) */
|
|
||||||
.url-input-content--wide {
|
|
||||||
max-width: 900px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 375px 화면에서는 타일 4개 + 라벨이 폭을 넘긴다. 타일과 글자를 함께 줄여
|
/* 375px 화면에서는 타일 4개 + 라벨이 폭을 넘긴다. 타일과 글자를 함께 줄여
|
||||||
한 줄을 지킨다 — 라벨이 줄바꿈되면 타일 정렬이 어긋난다 */
|
한 줄을 지킨다 — 라벨이 줄바꿈되면 타일 정렬이 어긋난다 */
|
||||||
|
|
||||||
@@ -2529,7 +2521,7 @@
|
|||||||
설명은 탭에 딸린 것이지 폼의 일부가 아니다 */
|
설명은 탭에 딸린 것이지 폼의 일부가 아니다 */
|
||||||
.pipeline-desc {
|
.pipeline-desc {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 0 32px;
|
margin: 0 0 13px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
letter-spacing: -0.006em;
|
letter-spacing: -0.006em;
|
||||||
@@ -2560,7 +2552,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pipeline-desc {
|
.pipeline-desc {
|
||||||
margin-bottom: 28px;
|
margin-bottom: 13px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,3 +19,4 @@
|
|||||||
|
|
||||||
/* Poster to Video (F1 영상 · F2 스타일링) — 모든 규칙이 `.p2v-scope` 안에 갇혀 있다 */
|
/* Poster to Video (F1 영상 · F2 스타일링) — 모든 규칙이 `.p2v-scope` 안에 갇혀 있다 */
|
||||||
@import './poster-p2v.css';
|
@import './poster-p2v.css';
|
||||||
|
@import './playreel-p2v.css';
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
|
|
||||||
/* Hero Form */
|
/* Hero Form */
|
||||||
.hero-form {
|
.hero-form {
|
||||||
padding-top: 20px;
|
padding-top: 13px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 375px;
|
max-width: 375px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -0,0 +1,266 @@
|
|||||||
|
/* =====================================================
|
||||||
|
Playreel(롱컷) — 검수 게이트 화면 스타일
|
||||||
|
|
||||||
|
poster-p2v.css 의 `.p2v-*` 규칙(패널·라벨·버튼·칩·진행바)을 그대로 쓰고,
|
||||||
|
게이트에만 있는 요소(섹션 썸네일 선택, 판정 카드, 경고 박스)만 `.pr-*` 로 더한다.
|
||||||
|
규칙은 poster-p2v.css 와 같다: 모든 선택자를 `.p2v-scope` 안에 가둔다.
|
||||||
|
===================================================== */
|
||||||
|
|
||||||
|
.p2v-scope .pr-gate__eyebrow {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-mint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-gate__title {
|
||||||
|
margin: 6px 0 8px;
|
||||||
|
font-size: var(--text-2xl);
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-gate__actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 좌우 2단. 좁은 화면에서는 자동으로 한 줄씩 쌓인다 */
|
||||||
|
.p2v-scope .pr-two {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||||
|
gap: var(--spacing-page-md);
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-gap { margin-top: 24px; }
|
||||||
|
|
||||||
|
.p2v-scope .pr-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-row__label {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 52px;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-row__label--slot {
|
||||||
|
width: 92px;
|
||||||
|
font-size: var(--text-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-row .p2v-input { height: 44px; }
|
||||||
|
|
||||||
|
.p2v-scope .pr-strong {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-audio {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-image {
|
||||||
|
max-width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-player {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-player video {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 520px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 연출 칩 — 잠긴 칩은 눌리지 않는다 */
|
||||||
|
.p2v-scope .pr-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-chip.locked { cursor: default; }
|
||||||
|
|
||||||
|
/* 상세페이지 섹션 썸네일 선택 */
|
||||||
|
.p2v-scope .pr-sections {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
max-height: 340px;
|
||||||
|
padding-right: 4px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section {
|
||||||
|
position: relative;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 2px solid var(--color-border-white-10);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: transparent;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section.selected {
|
||||||
|
border-color: var(--color-mint);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section.locked { cursor: default; }
|
||||||
|
|
||||||
|
.p2v-scope .pr-section img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 3 / 4;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section__no {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
left: 4px;
|
||||||
|
min-width: 16px;
|
||||||
|
padding: 1px 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(0, 0, 0, 0.65);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section__cap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 3px 5px;
|
||||||
|
background: rgba(0, 0, 0, 0.65);
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-section.selected .pr-section__cap { color: var(--color-mint); }
|
||||||
|
|
||||||
|
.p2v-scope .pr-section__cap span:last-child {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 경고 박스 — 실패가 아니라 "확인하세요" 라서 호박색으로 구분한다 */
|
||||||
|
.p2v-scope .pr-callout {
|
||||||
|
margin: 12px 0 0;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1px solid rgba(255, 210, 122, 0.35);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: rgba(255, 210, 122, 0.1);
|
||||||
|
color: #ffd27a;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 예상 길이 */
|
||||||
|
.p2v-scope .pr-stat {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--text-2xl);
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-mint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-stat.warn { color: #ffd27a; }
|
||||||
|
|
||||||
|
/* 제목 훼손 검사 판정 */
|
||||||
|
.p2v-scope .pr-verdict.ok { border-color: var(--color-mint-30); }
|
||||||
|
.p2v-scope .pr-verdict.fail { border-color: rgba(255, 122, 122, 0.4); }
|
||||||
|
.p2v-scope .pr-verdict.ok .pr-strong { color: var(--color-mint); }
|
||||||
|
.p2v-scope .pr-verdict.fail .pr-strong { color: #ff8c8c; }
|
||||||
|
|
||||||
|
/* 자동 확인 항목 */
|
||||||
|
.p2v-scope .pr-check {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 5px 0;
|
||||||
|
font-size: var(--text-base);
|
||||||
|
color: var(--color-text-gray-300);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-check svg { color: var(--color-mint); }
|
||||||
|
.p2v-scope .pr-check.fail { color: #ff8c8c; }
|
||||||
|
.p2v-scope .pr-check.fail svg { color: #ff8c8c; }
|
||||||
|
|
||||||
|
/* 자동 승인 설정 패널 */
|
||||||
|
.p2v-scope .pr-auto { margin-top: 28px; }
|
||||||
|
|
||||||
|
.p2v-scope .pr-auto__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-auto__row + .pr-auto__row { border-top: 1px solid var(--color-border-white-5); }
|
||||||
|
.p2v-scope .pr-auto__row--locked { opacity: 0.55; }
|
||||||
|
.p2v-scope .pr-auto__text { min-width: 0; }
|
||||||
|
.p2v-scope .pr-auto__text .p2v-note { margin: 2px 0 0; }
|
||||||
|
|
||||||
|
.p2v-scope .pr-switch {
|
||||||
|
position: relative;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 44px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid var(--color-border-white-10);
|
||||||
|
border-radius: var(--radius-full);
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color var(--transition-normal), border-color var(--transition-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-switch.on {
|
||||||
|
border-color: var(--color-mint);
|
||||||
|
background: var(--color-mint-20);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-switch__knob {
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
left: 2px;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--color-text-gray-400);
|
||||||
|
transition: transform var(--transition-normal), background-color var(--transition-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .pr-switch.on .pr-switch__knob {
|
||||||
|
transform: translateX(20px);
|
||||||
|
background: var(--color-mint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 자동 승인 안내 — 진행 화면 아래에 이어서 보인다 */
|
||||||
|
.p2v-scope .pr-auto-note {
|
||||||
|
margin: 14px 0 0;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
text-align: center;
|
||||||
|
color: var(--color-mint);
|
||||||
|
}
|
||||||
+184
-282
@@ -311,6 +311,188 @@
|
|||||||
|
|
||||||
.p2v-scope.p2v-create .p2v-btn-cta { margin-top: 28px; }
|
.p2v-scope.p2v-create .p2v-btn-cta { margin-top: 28px; }
|
||||||
|
|
||||||
|
.p2v-scope .p2v-create__cost {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 4px;
|
||||||
|
margin-top: 28px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-create__cost-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-mint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-create__coin {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope.p2v-create .p2v-create__cost + .p2v-btn-cta {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── 시작 선택 화면 + 소개 카드 (playreel 의 "어떻게 시작할까요?") ── */
|
||||||
|
|
||||||
|
.p2v-scope.p2v-start {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
max-width: 560px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-start__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--text-2xl);
|
||||||
|
font-weight: 800;
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-start__subtitle {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
text-align: center;
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-back {
|
||||||
|
align-self: flex-start;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-back:hover { color: var(--color-text-white); }
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro--hot { border-color: var(--color-mint-30); }
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__badge {
|
||||||
|
align-self: flex-start;
|
||||||
|
margin-bottom: -4px;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: var(--radius-full);
|
||||||
|
background: var(--color-mint);
|
||||||
|
color: var(--color-bg-dark);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro .p2v-btn-cta { margin-top: 4px; }
|
||||||
|
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__icon {
|
||||||
|
display: grid;
|
||||||
|
flex: none;
|
||||||
|
place-items: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: var(--color-mint-10);
|
||||||
|
color: var(--color-mint);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--text-lg);
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__desc {
|
||||||
|
margin: 2px 0 0;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
color: var(--color-text-gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__flow {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 14px;
|
||||||
|
list-style: none;
|
||||||
|
border: 1px solid var(--color-border-white-5);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: var(--color-bg-card);
|
||||||
|
font-size: var(--text-xs);
|
||||||
|
line-height: 1.6;
|
||||||
|
color: var(--color-text-gray-300);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__flow li {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 22px minmax(0, 1fr);
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 10px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__flow-number {
|
||||||
|
color: var(--color-mint);
|
||||||
|
font-weight: 800;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__facts {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__facts div {
|
||||||
|
padding: 8px 10px;
|
||||||
|
border: 1px solid var(--color-bg-card);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: var(--color-bg-card);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__facts b {
|
||||||
|
display: block;
|
||||||
|
font-size: var(--text-xs);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--color-text-gray-500);
|
||||||
|
}
|
||||||
|
|
||||||
|
.p2v-scope .p2v-intro__facts span {
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
font-weight: 700;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.p2v-scope .p2v-intro__facts { grid-template-columns: repeat(2, 1fr); }
|
||||||
|
}
|
||||||
|
|
||||||
/* ── F1 진행 화면 ────────────────────────────────── */
|
/* ── F1 진행 화면 ────────────────────────────────── */
|
||||||
|
|
||||||
.p2v-scope.p2v-making {
|
.p2v-scope.p2v-making {
|
||||||
@@ -602,294 +784,14 @@
|
|||||||
|
|
||||||
/* ── F2 스타일링 ─────────────────────────────────── */
|
/* ── F2 스타일링 ─────────────────────────────────── */
|
||||||
|
|
||||||
.p2v-scope.p2v-styling {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 8px 0 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-styling__scope { margin-bottom: 22px; }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-notice {
|
|
||||||
padding: 12px 18px;
|
|
||||||
border-radius: var(--radius-xl);
|
|
||||||
font-size: var(--text-sm);
|
|
||||||
line-height: 1.6;
|
|
||||||
color: var(--color-text-gray-300);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 내부 전용 — 주황 계열. 민트/퍼플과 겹치지 않아야 "제한"으로 읽힌다 */
|
/* 내부 전용 — 주황 계열. 민트/퍼플과 겹치지 않아야 "제한"으로 읽힌다 */
|
||||||
.p2v-scope .p2v-notice--warn {
|
|
||||||
border: 1px solid rgba(255, 154, 90, 0.35);
|
|
||||||
background: rgba(255, 154, 90, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-notice--warn b { color: #ffc9a3; }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-notice--unknown {
|
|
||||||
margin-top: 12px;
|
|
||||||
border: 1px solid rgba(166, 130, 255, 0.38);
|
|
||||||
background: rgba(166, 130, 255, 0.14);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-license {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
font-size: var(--text-xs);
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.5;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-license--ok {
|
|
||||||
border: 1px solid var(--color-mint-30);
|
|
||||||
background: var(--color-mint-10);
|
|
||||||
color: var(--color-mint);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-license--warn {
|
|
||||||
border: 1px solid rgba(255, 154, 90, 0.35);
|
|
||||||
background: rgba(255, 154, 90, 0.12);
|
|
||||||
color: #ffc9a3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-license--unknown {
|
|
||||||
border: 1px solid rgba(166, 130, 255, 0.38);
|
|
||||||
background: rgba(166, 130, 255, 0.14);
|
|
||||||
color: #c9b6ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-collapse {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
width: 100%;
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
color: var(--color-text-white);
|
|
||||||
font-family: inherit;
|
|
||||||
text-align: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-collapse .p2v-label { margin: 0; }
|
|
||||||
|
|
||||||
.p2v-collapse__picked {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-size: var(--text-base);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-collapse__picked img {
|
|
||||||
width: 22px;
|
|
||||||
height: 30px;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: var(--radius-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-collapse__picked b { color: var(--color-mint); font-weight: 700; }
|
|
||||||
|
|
||||||
.p2v-collapse__empty {
|
|
||||||
font-size: var(--text-base);
|
|
||||||
color: var(--color-text-gray-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-collapse__caret {
|
|
||||||
margin-left: auto;
|
|
||||||
color: var(--color-text-gray-400);
|
|
||||||
transition: transform var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-collapse__caret.open { transform: rotate(180deg); }
|
|
||||||
|
|
||||||
.p2v-tplgroup { margin-top: 20px; }
|
|
||||||
|
|
||||||
.p2v-tplgroup__title {
|
|
||||||
margin: 0 0 10px;
|
|
||||||
font-size: var(--text-sm);
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--color-text-gray-400);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tplgroup__title span {
|
|
||||||
margin-left: 8px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--color-text-gray-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tplgrid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(5, 1fr);
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tplcard { position: relative; }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-tpl {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 8px;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 8px;
|
|
||||||
border: 1px solid var(--color-border-gray-700);
|
|
||||||
border-radius: var(--radius-xl);
|
|
||||||
background: var(--color-bg-card-inner);
|
|
||||||
color: var(--color-text-gray-400);
|
|
||||||
font-family: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color var(--transition-normal), background-color var(--transition-normal),
|
|
||||||
color var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-tpl:hover { color: var(--color-text-white); }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-tpl.active {
|
|
||||||
border: 1px solid var(--color-mint);
|
|
||||||
background: var(--color-mint-10);
|
|
||||||
color: var(--color-text-white);
|
|
||||||
/* 링을 테두리와 같은 색으로 둔다 — 다르면 두 줄로 갈라져 보인다.
|
|
||||||
테두리 두께를 바꾸지 않아 카드 안 글자도 흔들리지 않는다 */
|
|
||||||
box-shadow: 0 0 0 1px var(--color-mint);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 명화는 가로 그림도 있다 — cover 로 자르면 무엇인지 알 수 없다 */
|
/* 명화는 가로 그림도 있다 — cover 로 자르면 무엇인지 알 수 없다 */
|
||||||
.p2v-scope .p2v-tpl img {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
aspect-ratio: 2 / 3;
|
|
||||||
object-fit: contain;
|
|
||||||
border-radius: var(--radius-md);
|
|
||||||
background: var(--color-bg-darker);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tpl__name {
|
|
||||||
font-size: var(--text-sm);
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.3;
|
|
||||||
white-space: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 제목이 1줄인 카드와 2줄인 카드가 섞인다 — 아래로 밀어야 배지가 같은 선에 선다 */
|
/* 제목이 1줄인 카드와 2줄인 카드가 섞인다 — 아래로 밀어야 배지가 같은 선에 선다 */
|
||||||
.p2v-tpl__badge {
|
|
||||||
display: flex;
|
|
||||||
margin-top: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tpl__sub {
|
|
||||||
font-size: var(--text-xs);
|
|
||||||
line-height: 1.4;
|
|
||||||
color: var(--color-text-gray-500);
|
|
||||||
white-space: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-tpl--add {
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 10px;
|
|
||||||
min-height: 200px;
|
|
||||||
border-style: dashed;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-tpl__plus { font-size: 26px; font-weight: 300; line-height: 1; }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-tpl__remove {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
width: 26px;
|
|
||||||
height: 26px;
|
|
||||||
border: 1px solid var(--color-border-white-10);
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
background: rgba(0, 0, 0, 0.62);
|
|
||||||
color: var(--color-text-gray-300);
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 1;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-styling__io {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
gap: var(--spacing-page-md);
|
|
||||||
margin-top: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-styling__out {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
aspect-ratio: 4 / 5;
|
|
||||||
max-width: 400px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-styling__out--empty {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
padding: var(--spacing-page);
|
|
||||||
font-size: var(--text-base);
|
|
||||||
color: var(--color-text-gray-500);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-styling__out img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-styling__download {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope.p2v-styling .p2v-label { margin-top: 26px; }
|
|
||||||
.p2v-scope.p2v-styling .p2v-styling__io .p2v-label { margin-top: 0; }
|
|
||||||
|
|
||||||
.p2v-formats {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-select {
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid var(--color-border-gray-700);
|
|
||||||
border-radius: var(--radius-xl);
|
|
||||||
background: var(--color-bg-card-inner);
|
|
||||||
color: var(--color-text-gray-400);
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: var(--text-sm);
|
|
||||||
font-weight: 700;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color var(--transition-normal), background-color var(--transition-normal),
|
|
||||||
color var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p2v-scope .p2v-select:hover { color: var(--color-text-white); }
|
|
||||||
|
|
||||||
.p2v-scope .p2v-select.active {
|
|
||||||
border-color: var(--color-mint);
|
|
||||||
background: var(--color-mint-10);
|
|
||||||
color: var(--color-text-white);
|
|
||||||
box-shadow: 0 0 0 1px var(--color-mint);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── 모바일 ──────────────────────────────────────── */
|
/* ── 모바일 ──────────────────────────────────────── */
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.p2v-tplgrid { grid-template-columns: repeat(3, 1fr); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.p2v-review__grid,
|
.p2v-review__grid,
|
||||||
.p2v-result__grid,
|
.p2v-result__grid,
|
||||||
@@ -905,8 +807,8 @@
|
|||||||
border-top: 2px solid var(--color-mint-20);
|
border-top: 2px solid var(--color-mint-20);
|
||||||
}
|
}
|
||||||
|
|
||||||
.p2v-tplgrid { grid-template-columns: repeat(2, 1fr); }
|
|
||||||
.p2v-formats { grid-template-columns: repeat(2, 1fr); }
|
|
||||||
|
|
||||||
/* 검수 화면(모바일) — 2단이 1단으로 접히면서 순서 문제가 생긴다.
|
/* 검수 화면(모바일) — 2단이 1단으로 접히면서 순서 문제가 생긴다.
|
||||||
데스크톱은 좌(편집)·우(포스터)라 나란히 보이지만, 세로로 쌓으면 편집이 먼저 오고
|
데스크톱은 좌(편집)·우(포스터)라 나란히 보이지만, 세로로 쌓으면 편집이 먼저 오고
|
||||||
|
|||||||
+13
-5
@@ -270,8 +270,13 @@ export interface UserCreditsResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 비디오 목록 아이템 (갤러리용)
|
// 비디오 목록 아이템 (갤러리용)
|
||||||
/** 콘텐츠 종류. ADO2 영상과 썰박스가 한 목록에 섞인다 */
|
/** 좋아요·댓글·공유에서 사용하는 통합 콘텐츠 종류 */
|
||||||
export type ContentType = 'video' | 'ssul';
|
export type ContentType = 'video' | 'ssul' | P2vContentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* P2V(무빙 포스터·롱컷) 콘텐츠 종류.
|
||||||
|
*/
|
||||||
|
export type P2vContentType = 'p2v_video' | 'p2v_playreel';
|
||||||
|
|
||||||
export interface VideoListItem {
|
export interface VideoListItem {
|
||||||
/**
|
/**
|
||||||
@@ -281,7 +286,7 @@ export interface VideoListItem {
|
|||||||
* 특히 `DELETE /archive/videos/{id}` 는 `Video.id` 로 지우므로,
|
* 특히 `DELETE /archive/videos/{id}` 는 `Video.id` 로 지우므로,
|
||||||
* 썰박스 항목의 id 를 넘기면 **엉뚱한 ADO2 영상이 삭제된다.**
|
* 썰박스 항목의 id 를 넘기면 **엉뚱한 ADO2 영상이 삭제된다.**
|
||||||
*/
|
*/
|
||||||
type: ContentType;
|
type: ContentType | P2vContentType;
|
||||||
video_id: number;
|
video_id: number;
|
||||||
store_name: string;
|
store_name: string;
|
||||||
region: string;
|
region: string;
|
||||||
@@ -325,6 +330,9 @@ export interface VideosListResponse {
|
|||||||
has_prev: boolean;
|
has_prev: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 소셜 업로드 모달이 받는 항목 — 무빙 포스터(p2v_video)까지 업로드를 지원하고 롱컷(p2v_playreel)은 제외한다 */
|
||||||
|
export type SocialUploadableItem = VideoListItem & { type: Exclude<ContentType, 'p2v_playreel'> };
|
||||||
|
|
||||||
// 댓글 대댓글
|
// 댓글 대댓글
|
||||||
export interface CommentReply {
|
export interface CommentReply {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -413,7 +421,7 @@ export interface SocialDisconnectResponse {
|
|||||||
// 유튜브 SEO Description 자동완성 요청
|
// 유튜브 SEO Description 자동완성 요청
|
||||||
export interface YTAutoSeoRequest {
|
export interface YTAutoSeoRequest {
|
||||||
/** 썰박스면 'ssul' + task_id 자리에 ssul_content.id 문자열. 생략 시 video */
|
/** 썰박스면 'ssul' + task_id 자리에 ssul_content.id 문자열. 생략 시 video */
|
||||||
content_type?: ContentType;
|
content_type?: SocialUploadableItem['type'];
|
||||||
task_id: string; // ADO2 는 task_id, 썰박스는 콘텐츠 id 문자열
|
task_id: string; // ADO2 는 task_id, 썰박스는 콘텐츠 id 문자열
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +438,7 @@ export interface SocialUploadRequest {
|
|||||||
* 콘텐츠 종류. video.id 와 ssul_content.id 가 겹치므로 생략(=video)한 채
|
* 콘텐츠 종류. video.id 와 ssul_content.id 가 겹치므로 생략(=video)한 채
|
||||||
* 썰박스 id 를 보내면 **엉뚱한 ADO2 영상이 업로드된다.**
|
* 썰박스 id 를 보내면 **엉뚱한 ADO2 영상이 업로드된다.**
|
||||||
*/
|
*/
|
||||||
content_type?: ContentType;
|
content_type?: SocialUploadableItem['type'];
|
||||||
video_id: number; // 콘텐츠 ID (content_type 안에서만 유일)
|
video_id: number; // 콘텐츠 ID (content_type 안에서만 유일)
|
||||||
social_account_id: number; // 선택된 채널 ID
|
social_account_id: number; // 선택된 채널 ID
|
||||||
title: string; // 최대 100자
|
title: string; // 최대 100자
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { ContentType } from '../types/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 기기의 네이티브 공유 시트를 열고 요청을 처리했는지 반환합니다.
|
* 기기의 네이티브 공유 시트를 열고 요청을 처리했는지 반환합니다.
|
||||||
*
|
*
|
||||||
@@ -32,9 +34,13 @@ export function buildVideoShareUrl(apiBaseUrl: string, videoId: number | string)
|
|||||||
export function buildContentShareUrl(
|
export function buildContentShareUrl(
|
||||||
apiBaseUrl: string,
|
apiBaseUrl: string,
|
||||||
contentId: number | string,
|
contentId: number | string,
|
||||||
contentType: 'video' | 'ssul' = 'video',
|
contentType: ContentType = 'video',
|
||||||
): string {
|
): string {
|
||||||
const base = apiBaseUrl.replace(/\/$/, '');
|
const base = apiBaseUrl.replace(/\/$/, '');
|
||||||
|
if (contentType === 'p2v_video' || contentType === 'p2v_playreel') {
|
||||||
|
const kind = contentType === 'p2v_video' ? 'f1' : 'playreel';
|
||||||
|
return `${base}/p2v/${kind}/share/${encodeURIComponent(String(contentId))}`;
|
||||||
|
}
|
||||||
if (contentType === 'ssul') {
|
if (contentType === 'ssul') {
|
||||||
return `${base}/ssul/share/${encodeURIComponent(String(contentId))}`;
|
return `${base}/ssul/share/${encodeURIComponent(String(contentId))}`;
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-130
@@ -1,47 +1,18 @@
|
|||||||
/**
|
/**
|
||||||
* Poster to Video (P2V) 클라이언트.
|
* Poster to Video (P2V) 클라이언트.
|
||||||
*
|
*
|
||||||
* castad 백엔드가 아니라 **별도 서버(:8010)** 를 직접 호출한다. 다른 파이프라인들
|
* castad 백엔드의 `/p2v/*` 를 다른 파이프라인(ADO2·썰박스)과 같은 방식으로 부른다 —
|
||||||
* (ADO2·썰박스)이 `utils/api.ts` 로 castad 백엔드에 붙는 것과 대비된다.
|
* `authenticatedFetch` 가 Bearer 토큰을 싣는다. 잡 소유권·크레딧은 백엔드가 맡는다.
|
||||||
*
|
*
|
||||||
* 왜 프록시를 두지 않았나 — P2V 서버는 검증된 `scripts/*.py` 를 subprocess 로 감싼
|
* 크레딧은 생성 요청 시점에 선차감되고, 실패하면 환불된다(썰박스와 같다).
|
||||||
* 단일 워커라 castad 백엔드에 흡수하려면 실행 환경(Higgsfield CLI·ffmpeg·모델 키)을
|
* 잔액이 모자라면 402 가 오며, 호출부가 충전 화면으로 유도할 수 있게
|
||||||
* 통째로 이식해야 한다. **내부 시연 범위**에서는 직접 호출이 맞고, 대외 공개 단계에서
|
* `InsufficientCreditError` 로 던진다.
|
||||||
* castad 백엔드에 `/p2v/*` 프록시를 세워 카카오 인증·크레딧 차감을 얹는 게 다음 수순이다.
|
|
||||||
* 그때 갈아끼울 지점은 이 파일 하나다.
|
|
||||||
*
|
|
||||||
* 인증은 단일 팀 키(`P2V_ACCESS_KEY`). 서버는 3경로로 받는다:
|
|
||||||
* - `X-P2V-Key` 헤더 → fetch 호출
|
|
||||||
* - `p2v_key` 쿠키 → **여기서는 못 쓴다.** castad 와 P2V 는 다른 오리진이라
|
|
||||||
* document.cookie 로 심어도 P2V 요청에 실리지 않는다.
|
|
||||||
* - `?key=` 쿼리 → 헤더를 못 붙이는 <img>/<video>/<a download> 용 (p2vFile)
|
|
||||||
*/
|
*/
|
||||||
|
import { ContentType, P2vContentType } from '../types/api';
|
||||||
/** P2V 서버 오리진. 배포 시 `.env` 의 VITE_P2V_URL 로 덮는다 */
|
import { API_URL, InsufficientCreditError, authenticatedFetch } from './api';
|
||||||
export const P2V_URL = (import.meta.env.VITE_P2V_URL || 'http://localhost:8010').replace(/\/$/, '');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 접근 키 저장소.
|
* 404 — 서버에 그 잡이 없다(지워졌거나 내 것이 아니다). 화면은 처음으로 되돌려야 한다.
|
||||||
*
|
|
||||||
* storageKeys.K 에 넣지 않은 것은 의도적이다 — 그쪽 키들은 로그아웃·새 프로젝트에
|
|
||||||
* 일괄 삭제되는데, 이건 서버 자격증명이라 지워지면 시연 중에 매번 다시 물어야 한다.
|
|
||||||
*/
|
|
||||||
const KEY_STORAGE = 'castad_p2v_key';
|
|
||||||
|
|
||||||
export const getP2vKey = (): string => localStorage.getItem(KEY_STORAGE) ?? '';
|
|
||||||
export const setP2vKey = (key: string): void => localStorage.setItem(KEY_STORAGE, key.trim());
|
|
||||||
export const clearP2vKey = (): void => localStorage.removeItem(KEY_STORAGE);
|
|
||||||
|
|
||||||
/** 401 — 화면이 키 입력을 띄워야 하는 상황. 일반 실패와 구분해야 해서 타입을 나눈다 */
|
|
||||||
export class P2vAuthError extends Error {
|
|
||||||
constructor() {
|
|
||||||
super('P2V_AUTH_REQUIRED');
|
|
||||||
this.name = 'P2vAuthError';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 404 — 서버에 그 잡이 없다. 화면은 처음으로 되돌려야 한다.
|
|
||||||
*
|
*
|
||||||
* 상태 코드로 판정하는 이유: 서버 detail 문구("잡 없음")를 문자열로 맞추려다
|
* 상태 코드로 판정하는 이유: 서버 detail 문구("잡 없음")를 문자열로 맞추려다
|
||||||
* 실제로 한 번 놓쳤다. 문구는 서버 사정으로 바뀌고 번역도 되지만 코드는 안 바뀐다.
|
* 실제로 한 번 놓쳤다. 문구는 서버 사정으로 바뀌고 번역도 되지만 코드는 안 바뀐다.
|
||||||
@@ -54,16 +25,9 @@ export class P2vNotFoundError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function p2vFetch<T>(path: string, init?: RequestInit): Promise<T> {
|
export async function p2vFetch<T>(path: string, init?: RequestInit): Promise<T> {
|
||||||
const key = getP2vKey();
|
const res = await authenticatedFetch(`${API_URL}${path}`, init);
|
||||||
const res = await fetch(`${P2V_URL}${path}`, {
|
|
||||||
...init,
|
|
||||||
headers: {
|
|
||||||
...(init?.headers ?? {}),
|
|
||||||
...(key ? { 'X-P2V-Key': key } : {}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (res.status === 401) throw new P2vAuthError();
|
if (res.status === 402) throw new InsufficientCreditError();
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
// FastAPI 는 {detail: ...} 로 준다. 본문이 없는 에러(502 등)도 있으므로 감싼다
|
// FastAPI 는 {detail: ...} 로 준다. 본문이 없는 에러(502 등)도 있으므로 감싼다
|
||||||
@@ -80,20 +44,7 @@ export async function p2vFetch<T>(path: string, init?: RequestInit): Promise<T>
|
|||||||
return res.json() as Promise<T>;
|
return res.json() as Promise<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// ── 타입 (백엔드 app/p2v/api/routers/v1/view.py 와 1:1) ───────────────
|
||||||
* 정적 산출물(영상·이미지) URL.
|
|
||||||
*
|
|
||||||
* 서버가 주는 artifacts 값은 `/files/render/x.mp4` 같은 **루트 상대 경로**라
|
|
||||||
* 다른 오리진인 castad 에서는 그대로 쓸 수 없다. 오리진을 붙이고, 헤더를 실을 수 없는
|
|
||||||
* 태그(<video src> 등)를 위해 키를 쿼리로 태운다.
|
|
||||||
*/
|
|
||||||
export const p2vFile = (path: string | null | undefined): string => {
|
|
||||||
if (!path) return '';
|
|
||||||
const key = getP2vKey();
|
|
||||||
return `${P2V_URL}${path}${key ? `?key=${encodeURIComponent(key)}` : ''}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ── 타입 (서버 jobs.py / routers 와 1:1) ──────────────────────────────
|
|
||||||
|
|
||||||
export type P2vStageStatus = 'idle' | 'running' | 'done' | 'failed';
|
export type P2vStageStatus = 'idle' | 'running' | 'done' | 'failed';
|
||||||
|
|
||||||
@@ -113,8 +64,8 @@ export interface PosterMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface P2vJob {
|
export interface P2vJob {
|
||||||
id: string;
|
id: number;
|
||||||
kind: 'f1' | 'f2';
|
kind: 'f1';
|
||||||
name: string;
|
name: string;
|
||||||
status: 'queued' | 'running' | 'awaiting_review' | 'failed' | 'done';
|
status: 'queued' | 'running' | 'awaiting_review' | 'failed' | 'done';
|
||||||
stage: string | null;
|
stage: string | null;
|
||||||
@@ -123,114 +74,93 @@ export interface P2vJob {
|
|||||||
motion_elements?: string[] | null;
|
motion_elements?: string[] | null;
|
||||||
metadata: PosterMeta | null;
|
metadata: PosterMeta | null;
|
||||||
error: { stage: string; detail: string } | null;
|
error: { stage: string; detail: string } | null;
|
||||||
|
/** 산출물은 Azure Blob 의 절대 URL 이다 */
|
||||||
artifacts: Record<string, string>;
|
artifacts: Record<string, string>;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
queue_size?: number;
|
|
||||||
template_id?: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 배포 등급. public-domain 만 외부 공개 가능 — 나머지는 내부 시연 한정 */
|
/** 잡 id. 서버는 숫자로 주고, 화면은 localStorage 때문에 문자열로도 든다 */
|
||||||
export type P2vLicense = 'public-domain' | 'internal-only' | 'user-uploaded';
|
export type P2vJobId = string | number;
|
||||||
|
|
||||||
export interface F2Template {
|
|
||||||
id: string;
|
|
||||||
name_ko: string;
|
|
||||||
thumb_url: string;
|
|
||||||
category: string;
|
|
||||||
license: P2vLicense;
|
|
||||||
attribution: string;
|
|
||||||
license_note: string;
|
|
||||||
/** 사용자가 올린 레퍼런스인가 (삭제 가능) */
|
|
||||||
removable: boolean;
|
|
||||||
small_ref: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface F2Category { id: string; label: string }
|
|
||||||
export interface F2Format { id: string; label: string }
|
|
||||||
export interface F2UploadHint { enabled: boolean; min_long_edge: number }
|
|
||||||
|
|
||||||
// ── F1 (포스터 → 영상) ────────────────────────────────────────────────
|
// ── F1 (포스터 → 영상) ────────────────────────────────────────────────
|
||||||
|
|
||||||
/** 포스터 업로드 → 잡 생성. 반환된 id 로 폴링한다 */
|
/** 포스터 업로드 → 잡 생성. 반환된 id 로 폴링한다. 크레딧이 먼저 차감된다 */
|
||||||
export async function createPosterJob(poster: File, name: string): Promise<{ id: string }> {
|
export async function createPosterJob(poster: File, name: string): Promise<{ id: string }> {
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('poster', poster);
|
fd.append('poster', poster);
|
||||||
fd.append('name', name);
|
fd.append('name', name);
|
||||||
return p2vFetch<{ id: string }>('/api/f1/jobs', { method: 'POST', body: fd });
|
const { id } = await p2vFetch<{ id: number }>('/p2v/f1/jobs', { method: 'POST', body: fd });
|
||||||
|
// 화면은 잡 id 를 localStorage 문자열로 들고 있어 경계에서 맞춘다
|
||||||
|
return { id: String(id) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPosterJob = (id: string): Promise<P2vJob> =>
|
export const getPosterJob = (id: P2vJobId): Promise<P2vJob> =>
|
||||||
p2vFetch<P2vJob>(`/api/f1/jobs/${id}`);
|
p2vFetch<P2vJob>(`/p2v/f1/jobs/${id}`);
|
||||||
|
|
||||||
export const updatePosterNarration = (id: string, narration: string[]): Promise<unknown> =>
|
export const updatePosterNarration = (id: P2vJobId, narration: string[]): Promise<unknown> =>
|
||||||
p2vFetch(`/api/f1/jobs/${id}/narration`, {
|
p2vFetch(`/p2v/f1/jobs/${id}/narration`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ narration }),
|
body: JSON.stringify({ narration }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updatePosterMetadata = (
|
export const updatePosterMetadata = (
|
||||||
id: string,
|
id: P2vJobId,
|
||||||
meta: { event_name: string; date_text: string; place: string },
|
meta: { event_name: string; date_text: string; place: string },
|
||||||
): Promise<unknown> =>
|
): Promise<unknown> =>
|
||||||
p2vFetch(`/api/f1/jobs/${id}/metadata`, {
|
p2vFetch(`/p2v/f1/jobs/${id}/metadata`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(meta),
|
body: JSON.stringify(meta),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 검수 승인 → TTS·BGM·애니메이션·렌더가 이어진다. motions 를 넘기면 모션 선정을 덮어쓴다 */
|
/** 검수 승인 → TTS·BGM·애니메이션·렌더가 이어진다. motions 를 넘기면 모션 선정을 덮어쓴다 */
|
||||||
export const approvePosterJob = (id: string, motions?: string[] | null): Promise<unknown> =>
|
export const approvePosterJob = (id: P2vJobId, motions?: string[] | null): Promise<unknown> =>
|
||||||
p2vFetch(`/api/f1/jobs/${id}/approve`, {
|
p2vFetch(`/p2v/f1/jobs/${id}/approve`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
...(motions
|
...(motions
|
||||||
? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ motions }) }
|
? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ motions }) }
|
||||||
: {}),
|
: {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const retryPosterJob = (id: string, motions?: string[] | null): Promise<unknown> =>
|
export const deletePosterJob = (id: P2vJobId): Promise<unknown> =>
|
||||||
p2vFetch(`/api/f1/jobs/${id}/retry`, {
|
p2vFetch(`/p2v/f1/jobs/${id}`, { method: 'DELETE' });
|
||||||
method: 'POST',
|
|
||||||
...(motions
|
|
||||||
? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ motions }) }
|
|
||||||
: {}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deletePosterJob = (id: string): Promise<unknown> =>
|
// ── 통합 콘텐츠 목록 ──────────────────────────────────────────────────
|
||||||
p2vFetch(`/api/f1/jobs/${id}`, { method: 'DELETE' });
|
|
||||||
|
|
||||||
// ── F2 (포스터 스타일링) ──────────────────────────────────────────────
|
export const isP2vContent = (type: ContentType | P2vContentType): type is P2vContentType =>
|
||||||
|
type === 'p2v_video' || type === 'p2v_playreel';
|
||||||
|
|
||||||
export const listF2Templates = (): Promise<F2Template[]> => p2vFetch<F2Template[]>('/api/f2/templates');
|
export interface P2vDetailItem {
|
||||||
export const listF2Categories = (): Promise<F2Category[]> => p2vFetch<F2Category[]>('/api/f2/categories');
|
type: P2vContentType;
|
||||||
export const listF2Formats = (): Promise<F2Format[]> => p2vFetch<F2Format[]>('/api/f2/formats');
|
content_id: number;
|
||||||
export const getF2UploadHint = (): Promise<F2UploadHint> => p2vFetch<F2UploadHint>('/api/f2/upload-hint');
|
video_url: string;
|
||||||
|
poster_url: string | null;
|
||||||
/** 레퍼런스 업로드 — 저장 + 화풍 분석까지 서버가 동기로 끝낸다(10초 안팎) */
|
title: string | null;
|
||||||
export async function createF2Template(reference: File, name: string): Promise<F2Template> {
|
created_at: string;
|
||||||
const fd = new FormData();
|
like_count: number;
|
||||||
fd.append('reference', reference);
|
is_liked_by_me: boolean;
|
||||||
fd.append('name', name);
|
|
||||||
return p2vFetch<F2Template>('/api/f2/templates', { method: 'POST', body: fd });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteF2Template = (id: string): Promise<unknown> =>
|
/** 비로그인도 보는 공개 상세. 소유자 전용 /jobs/{id} API 와 구분한다. */
|
||||||
p2vFetch(`/api/f2/templates/${id}`, { method: 'DELETE' });
|
export async function getP2vContentById(type: P2vContentType, id: string): Promise<P2vDetailItem> {
|
||||||
|
const kind = type === 'p2v_video' ? 'f1' : 'playreel';
|
||||||
export async function createStylingJob(
|
const response = await authenticatedFetch(
|
||||||
poster: File,
|
`${API_URL}/p2v/${kind}/${encodeURIComponent(id)}`,
|
||||||
templateId: string,
|
{ method: 'GET' },
|
||||||
format: string,
|
{ redirectOnAuthFail: false },
|
||||||
): Promise<{ id: string }> {
|
);
|
||||||
const fd = new FormData();
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
fd.append('poster', poster);
|
return response.json();
|
||||||
fd.append('template_id', templateId);
|
|
||||||
fd.append('format', format);
|
|
||||||
return p2vFetch<{ id: string }>('/api/f2/jobs', { method: 'POST', body: fd });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getStylingJob = (id: string): Promise<P2vJob> =>
|
/**
|
||||||
p2vFetch<P2vJob>(`/api/f2/jobs/${id}`);
|
* 내 콘텐츠에서 P2V 항목 삭제. 종류마다 테이블이 달라 경로가 갈린다.
|
||||||
|
* ⚠️ `deleteVideo`(`/archive/videos/{id}`, Video.id 기준)와 혼용하면 id 가 겹치는
|
||||||
|
* 엉뚱한 ADO2 영상이 지워진다.
|
||||||
|
*/
|
||||||
|
export const deleteP2vContent = (type: P2vContentType, id: number): Promise<unknown> =>
|
||||||
|
p2vFetch(`/p2v/${type === 'p2v_video' ? 'f1' : 'playreel'}/jobs/${id}`, { method: 'DELETE' });
|
||||||
|
|
||||||
// ── 진행 계산 ────────────────────────────────────────────────────────
|
// ── 진행 계산 ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -239,7 +169,7 @@ export const isP2vActive = (job: P2vJob | null): boolean =>
|
|||||||
job !== null && (job.status === 'queued' || job.status === 'running');
|
job !== null && (job.status === 'queued' || job.status === 'running');
|
||||||
|
|
||||||
/** 스테이지 진행률(%) — 선형 진행바용. 도는 중인 스테이지는 절반으로 친다 */
|
/** 스테이지 진행률(%) — 선형 진행바용. 도는 중인 스테이지는 절반으로 친다 */
|
||||||
export function p2vProgress(job: P2vJob | null): number {
|
export function p2vProgress(job: Pick<P2vJob, 'stages'> | null): number {
|
||||||
if (!job) return 0;
|
if (!job) return 0;
|
||||||
const states = Object.values(job.stages);
|
const states = Object.values(job.stages);
|
||||||
if (states.length === 0) return 0;
|
if (states.length === 0) return 0;
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
/**
|
||||||
|
* Playreel(롱컷) 클라이언트 — 공연 상품페이지 URL → 30초 세로 예고편.
|
||||||
|
*
|
||||||
|
* castad 백엔드의 `/p2v/playreel/*` 를 부른다(p2vApi.ts 의 `p2vFetch` 를 공유).
|
||||||
|
* 이 파이프라인은 사람이 확인하는 **게이트 5개**에서 멈춘다. 게이트마다 검수 페이로드
|
||||||
|
* (`review`)가 오고, 승인할 때 고친 값(`edits`)을 함께 보낸다.
|
||||||
|
*
|
||||||
|
* 크레딧은 생성 요청 시점에 선차감되고, 실패하면 환불된다. 실패한 잡은 다시 돌릴 수
|
||||||
|
* 없다(새로 만든다). 다시 돌릴 수 있는 것은 클립 검수 게이트의 "다시 만들기" 뿐이다.
|
||||||
|
*/
|
||||||
|
import { P2vJobId, P2vStageState, p2vFetch } from './p2vApi';
|
||||||
|
|
||||||
|
export type GateKey =
|
||||||
|
| 'fetch_confirm'
|
||||||
|
| 'analysis_confirm'
|
||||||
|
| 'narration_confirm'
|
||||||
|
| 'clip_confirm'
|
||||||
|
| 'final_confirm';
|
||||||
|
|
||||||
|
export const GATE_ORDER: readonly GateKey[] = [
|
||||||
|
'fetch_confirm', 'analysis_confirm', 'narration_confirm', 'clip_confirm', 'final_confirm',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 게이트 진행 상태. 문구는 locales 의 `playreel.gates.<key>` 에 있다.
|
||||||
|
* 되돌리기는 크레딧을 이미 쓴 지점 뒤로는 서버가 거절한다(`REVERSIBLE_GATES`).
|
||||||
|
*/
|
||||||
|
export const GATE_CAN_BACK: Record<GateKey, boolean> = {
|
||||||
|
fetch_confirm: false,
|
||||||
|
analysis_confirm: true,
|
||||||
|
narration_confirm: true,
|
||||||
|
clip_confirm: false,
|
||||||
|
final_confirm: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── 게이트별 검수 페이로드 (백엔드 app/p2v/worker/gate.py 와 1:1) ──────────
|
||||||
|
|
||||||
|
export interface DetailSection {
|
||||||
|
id: string;
|
||||||
|
tag: string;
|
||||||
|
label: string;
|
||||||
|
thumb_url: string;
|
||||||
|
height: number;
|
||||||
|
/** 캐스팅 스케줄은 항상 포함 */
|
||||||
|
required?: boolean;
|
||||||
|
selected: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FetchReview {
|
||||||
|
poster_url: string;
|
||||||
|
/** 800px 이하면 저해상 경고 */
|
||||||
|
poster_width: number;
|
||||||
|
meta: { title: string; date_text: string; place: string; cast: string[]; genre: string };
|
||||||
|
sections: DetailSection[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnalysisReview {
|
||||||
|
grid_url: string;
|
||||||
|
movable: { key: string; label: string; on: boolean }[];
|
||||||
|
fixed: { key: string; label: string; on: boolean }[];
|
||||||
|
model: string;
|
||||||
|
ip_risk: boolean;
|
||||||
|
has_qr: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NarrationReview {
|
||||||
|
lines: { slot: string; text: string }[];
|
||||||
|
voice: { id: string; name: string; sample_url: string };
|
||||||
|
est_seconds: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClipReview {
|
||||||
|
clip_url: string;
|
||||||
|
frames_url: string;
|
||||||
|
title_mae: number;
|
||||||
|
gate_passed: boolean;
|
||||||
|
gate_reason: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FinalReview {
|
||||||
|
video_url: string;
|
||||||
|
proof_url: string;
|
||||||
|
duration: number;
|
||||||
|
checks: { key: string; label: string; ok: boolean }[];
|
||||||
|
version: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GateReview =
|
||||||
|
| { gate: 'fetch_confirm'; data: FetchReview }
|
||||||
|
| { gate: 'analysis_confirm'; data: AnalysisReview }
|
||||||
|
| { gate: 'narration_confirm'; data: NarrationReview }
|
||||||
|
| { gate: 'clip_confirm'; data: ClipReview }
|
||||||
|
| { gate: 'final_confirm'; data: FinalReview };
|
||||||
|
|
||||||
|
/** 승인할 때 함께 보내는 고친 값. 게이트마다 모양이 다르다 */
|
||||||
|
export type GateEdits =
|
||||||
|
| { sections: string[]; meta: FetchReview['meta'] }
|
||||||
|
| { movable: string[]; fixed: string[]; model: string }
|
||||||
|
| { lines: string[]; voice_id: string };
|
||||||
|
|
||||||
|
export interface PlayreelJob {
|
||||||
|
id: number;
|
||||||
|
kind: 'playreel';
|
||||||
|
name: string;
|
||||||
|
status: 'queued' | 'running' | 'awaiting_review' | 'failed' | 'done';
|
||||||
|
stage: string | null;
|
||||||
|
stages: Record<string, P2vStageState>;
|
||||||
|
error: { stage: string; detail: string } | null;
|
||||||
|
/** 산출물은 Azure Blob 의 절대 URL 이다 */
|
||||||
|
artifacts: Record<string, string>;
|
||||||
|
created_at: number;
|
||||||
|
source: { url: string; goods_id: string; slug: string };
|
||||||
|
gate: GateKey | null;
|
||||||
|
review: GateReview | null;
|
||||||
|
version: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── URL 인식 ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOL티켓/인터파크 상품 URL 에서 goodsId 를 뽑는다. 못 뽑으면 null.
|
||||||
|
* 입력 도중의 안내용이고, 판정은 서버가 같은 규칙으로 다시 한다.
|
||||||
|
*/
|
||||||
|
export function parseGoodsId(url: string): string | null {
|
||||||
|
const s = url.trim();
|
||||||
|
if (!s) return null;
|
||||||
|
const m =
|
||||||
|
// 인터파크 주소는 야놀자로 리다이렉트된다. 상품 번호는 양쪽이 같다
|
||||||
|
s.match(/nol\.yanolja\.com\/ticket\/products\/(\d{5,})/i) ??
|
||||||
|
s.match(/tickets\.interpark\.com\/goods\/(\d{5,})/i) ??
|
||||||
|
s.match(/nol\.interpark\.com\/[^?]*?(\d{8,})/i) ??
|
||||||
|
s.match(/[?&]goodsCode=(\d{5,})/i) ??
|
||||||
|
s.match(/^(\d{8,})$/);
|
||||||
|
return m ? m[1] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── API ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const jsonBody = (body: unknown): RequestInit => ({
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 상품페이지 주소 → 잡 생성. 크레딧이 먼저 차감된다 */
|
||||||
|
export async function createPlayreelJob(url: string): Promise<{ id: string }> {
|
||||||
|
const { id } = await p2vFetch<{ id: number }>('/p2v/playreel/jobs', jsonBody({ url: url.trim() }));
|
||||||
|
// 화면은 잡 id 를 localStorage 문자열로 들고 있어 경계에서 맞춘다
|
||||||
|
return { id: String(id) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPlayreelJob = (id: P2vJobId): Promise<PlayreelJob> =>
|
||||||
|
p2vFetch<PlayreelJob>(`/p2v/playreel/jobs/${id}`);
|
||||||
|
|
||||||
|
/** 게이트 승인. gate 를 함께 보내 화면과 서버의 게이트가 어긋나면 서버가 409 로 막는다 */
|
||||||
|
export const approvePlayreelGate = (
|
||||||
|
id: P2vJobId, gate: GateKey, edits: GateEdits | null,
|
||||||
|
): Promise<PlayreelJob> =>
|
||||||
|
p2vFetch<PlayreelJob>(`/p2v/playreel/jobs/${id}/approve`, jsonBody({ gate, edits }));
|
||||||
|
|
||||||
|
/** 직전 게이트로 되돌린다 */
|
||||||
|
export const backPlayreelGate = (id: P2vJobId): Promise<PlayreelJob> =>
|
||||||
|
p2vFetch<PlayreelJob>(`/p2v/playreel/jobs/${id}/back`, { method: 'POST' });
|
||||||
|
|
||||||
|
/** 클립 검수 게이트에서 영상을 다시 만든다. 추가 크레딧은 차감되지 않는다 */
|
||||||
|
export const retryPlayreelClip = (id: P2vJobId): Promise<PlayreelJob> =>
|
||||||
|
p2vFetch<PlayreelJob>(`/p2v/playreel/jobs/${id}/retry`, { method: 'POST' });
|
||||||
|
|
||||||
|
export const deletePlayreelJob = (id: P2vJobId): Promise<unknown> =>
|
||||||
|
p2vFetch(`/p2v/playreel/jobs/${id}`, { method: 'DELETE' });
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { useSyncExternalStore } from 'react';
|
||||||
|
import { GateKey } from './playreelApi';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 롱컷 게이트 자동 승인 설정 — playreel 원본(`lib/prefs.ts`)과 같은 방식이다.
|
||||||
|
*
|
||||||
|
* 대상은 되돌릴 수 있는 게이트(① 수집 확인, ③ 나레이션 확인)뿐이다.
|
||||||
|
* ②·④·⑤ 는 크레딧을 쓰거나 결과를 고정하는 비가역 단계라 항상 사람이 확인한다.
|
||||||
|
*
|
||||||
|
* 브라우저 localStorage 에만 저장하고 서버에는 보내지 않는다. `storageKeys.K` 에 넣지 않은 것도
|
||||||
|
* 의도적이다 — 그쪽 키는 새 프로젝트·로그아웃 때 지워지는데, 이건 사용자의 취향이라
|
||||||
|
* 생성할 때마다 다시 켜게 만들면 안 된다.
|
||||||
|
*/
|
||||||
|
export const AUTO_APPROVABLE = ['fetch_confirm', 'narration_confirm'] as const satisfies readonly GateKey[];
|
||||||
|
export type AutoApprovable = (typeof AUTO_APPROVABLE)[number];
|
||||||
|
export type AutoApprovePrefs = Partial<Record<AutoApprovable, boolean>>;
|
||||||
|
|
||||||
|
export const isAutoApprovable = (gate: GateKey | null | undefined): gate is AutoApprovable =>
|
||||||
|
!!gate && (AUTO_APPROVABLE as readonly string[]).includes(gate);
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'castad_playreel_auto_approve';
|
||||||
|
const CHANGE_EVENT = 'castad:playreel-prefs';
|
||||||
|
const EMPTY: AutoApprovePrefs = {};
|
||||||
|
|
||||||
|
// useSyncExternalStore 는 같은 값이면 같은 참조를 돌려줘야 한다
|
||||||
|
let cache: { raw: string | null; value: AutoApprovePrefs } = { raw: null, value: EMPTY };
|
||||||
|
|
||||||
|
export function readAutoApprove(): AutoApprovePrefs {
|
||||||
|
let raw: string | null = null;
|
||||||
|
try {
|
||||||
|
raw = localStorage.getItem(STORAGE_KEY);
|
||||||
|
} catch {
|
||||||
|
return EMPTY; // 저장소를 못 쓰면 항상 사람이 확인한다
|
||||||
|
}
|
||||||
|
if (raw === cache.raw) return cache.value;
|
||||||
|
let value: AutoApprovePrefs = EMPTY;
|
||||||
|
try {
|
||||||
|
const parsed = raw ? JSON.parse(raw) : {};
|
||||||
|
value = Object.fromEntries(
|
||||||
|
AUTO_APPROVABLE.filter((gate) => parsed?.[gate] === true).map((gate) => [gate, true]),
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
/* 깨진 값은 꺼진 것으로 본다 */
|
||||||
|
}
|
||||||
|
cache = { raw, value };
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setAutoApprove(gate: AutoApprovable, on: boolean): void {
|
||||||
|
const next = { ...readAutoApprove() };
|
||||||
|
if (on) next[gate] = true;
|
||||||
|
else delete next[gate];
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
||||||
|
} catch {
|
||||||
|
/* 프라이빗 모드 등 — 이 세션에서만 유지되지 않는다 */
|
||||||
|
}
|
||||||
|
window.dispatchEvent(new Event(CHANGE_EVENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
function subscribe(onChange: () => void): () => void {
|
||||||
|
window.addEventListener(CHANGE_EVENT, onChange);
|
||||||
|
window.addEventListener('storage', onChange); // 다른 탭에서 바꾼 경우
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener(CHANGE_EVENT, onChange);
|
||||||
|
window.removeEventListener('storage', onChange);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAutoApprove(): AutoApprovePrefs {
|
||||||
|
return useSyncExternalStore(subscribe, readAutoApprove, () => EMPTY);
|
||||||
|
}
|
||||||
@@ -50,6 +50,11 @@ export const K = {
|
|||||||
* 로그아웃으로 지워지면 시연 중 매번 다시 물어야 한다 (utils/p2vApi.ts 참조).
|
* 로그아웃으로 지워지면 시연 중 매번 다시 물어야 한다 (utils/p2vApi.ts 참조).
|
||||||
*/
|
*/
|
||||||
POSTER_JOB_ID: 'castad_poster_job_id',
|
POSTER_JOB_ID: 'castad_poster_job_id',
|
||||||
|
/**
|
||||||
|
* 롱컷(Playreel) 진행 중 잡 id. 포스터 영상과 같은 이유로 새로고침 복구의 근거다.
|
||||||
|
* 잡이 사라졌으면 조회가 404 로 떨어지고 GenerationFlow 가 이 키를 정리한다.
|
||||||
|
*/
|
||||||
|
PLAYREEL_JOB_ID: 'castad_playreel_job_id',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +72,7 @@ export const PROJECT_KEYS: readonly string[] = [
|
|||||||
K.PIPELINE,
|
K.PIPELINE,
|
||||||
K.SSUL_TASK_ID,
|
K.SSUL_TASK_ID,
|
||||||
K.POSTER_JOB_ID,
|
K.POSTER_JOB_ID,
|
||||||
|
K.PLAYREEL_JOB_ID,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user