feat(p2v): 무빙 포스터·롱컷 통합 및 상세·소셜 기능 연결
This commit is contained in:
1 parent
cd71f6d9d3
commit
c06018d88c
42 files changed
+3020
-1610
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getAllVideos } from '../../utils/api';
|
||||
import { isP2vContent } from '../../utils/p2vApi';
|
||||
import { VideoListItem } from '../../types/api';
|
||||
import VideoDetailModal from '../../components/VideoDetailModal';
|
||||
import CitySelectModal from '../../components/CitySelectModal';
|
||||
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
||||
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
||||
import P2vViewerModal from '../../components/P2vViewerModal';
|
||||
|
||||
interface ADO2ContentsPageProps {
|
||||
onBack?: () => void;
|
||||
@@ -17,6 +19,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
||||
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
||||
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
||||
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
||||
const [selectedP2v, setSelectedP2v] = useState<VideoListItem | null>(null);
|
||||
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -149,17 +152,21 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
||||
className="ado2-content-card"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() =>
|
||||
video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: handleCardClick(video.video_id)
|
||||
isP2vContent(video.type)
|
||||
? setSelectedP2v(video)
|
||||
: video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: handleCardClick(video.video_id)
|
||||
}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) =>
|
||||
e.key === 'Enter' &&
|
||||
(video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: handleCardClick(video.video_id))
|
||||
(isP2vContent(video.type)
|
||||
? setSelectedP2v(video)
|
||||
: video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: handleCardClick(video.video_id))
|
||||
}
|
||||
>
|
||||
<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>
|
||||
<div className="content-card-meta">
|
||||
<p className="content-card-date">{formatDate(video.created_at)}</p>
|
||||
{/* 좋아요·댓글 API 가 type 을 받으므로 썰박스에도 노출한다.
|
||||
contentType 이 없으면 id 가 겹치는 다른 영상에 반영된다. */}
|
||||
{/* 모든 콘텐츠는 ID 와 종류를 함께 보내 소셜 반응을 구분한다. */}
|
||||
<ContentCardSocialActions
|
||||
videoId={video.video_id}
|
||||
contentType={video.type}
|
||||
@@ -243,6 +249,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
||||
)}
|
||||
|
||||
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
||||
<P2vViewerModal item={selectedP2v} onClose={() => setSelectedP2v(null)} />
|
||||
|
||||
{selectedVideoId !== null && (
|
||||
<VideoDetailModal
|
||||
|
||||
@@ -37,8 +37,13 @@ import SsulResultContent from '../Ssulbox/SsulResultContent';
|
||||
import PosterMakingContent from '../Poster/PosterMakingContent';
|
||||
import PosterReviewContent from '../Poster/PosterReviewContent';
|
||||
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 { deletePosterJob, isPastReview, retryPosterJob } from '../../utils/p2vApi';
|
||||
import { deletePosterJob, isPastReview } from '../../utils/p2vApi';
|
||||
import {
|
||||
K,
|
||||
clearProjectStorage,
|
||||
@@ -83,6 +88,21 @@ const SSUL_STEP_INDEX: Record<SsulStep, number> = {
|
||||
*/
|
||||
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단계인 이유는 검수 게이트 **앞뒤가 서로 다른 작업**이기 때문이다 —
|
||||
* 분석(검출·나레이션·모션)과 생성(음성·음악·애니메이션·렌더)을 한 칸에 묶으면
|
||||
@@ -215,8 +235,18 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
() => localStorage.getItem(K.POSTER_JOB_ID),
|
||||
);
|
||||
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 } =
|
||||
useP2vJob('f1', pipeline === 'poster' ? posterJobId : null);
|
||||
useP2vJob(pipeline === 'poster' ? posterJobId : null);
|
||||
|
||||
const changePipeline = (next: Pipeline) => {
|
||||
setPipeline(next);
|
||||
@@ -241,12 +271,40 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
? 4
|
||||
: 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 =
|
||||
pipeline === 'ado2' ? wizardStep === -2
|
||||
: pipeline === 'ssul' ? ssulStep === 'entry'
|
||||
: pipeline === 'poster' ? posterStep === 'entry'
|
||||
// 스타일링은 전 과정이 진입 화면 안에서 끝난다 (위저드 없음)
|
||||
: pipeline === 'playreel' ? playreelStep === 'entry'
|
||||
: true;
|
||||
const [songTaskId, setSongTaskId] = useState<string | null>(savedSongTaskId);
|
||||
const [imageTaskId, setImageTaskId] = useState<string | null>(savedImageTaskId);
|
||||
@@ -623,24 +681,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
setPosterJobId(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* 실패한 스테이지부터 다시. 업로드부터 다시 하지 않는다 —
|
||||
* i2v 실패(모델 큐·크레딧)는 같은 입력으로 재시도하면 자주 통과한다.
|
||||
*/
|
||||
const handlePosterRetry = async () => {
|
||||
if (!posterJobId || posterBusy) return;
|
||||
setPosterBusy(true);
|
||||
try {
|
||||
await retryPosterJob(posterJobId);
|
||||
refreshPosterJob();
|
||||
} catch {
|
||||
// 재시도 요청 자체가 실패해도 잡 상태는 그대로다 — 폴링 결과가 계속 화면을 그린다
|
||||
} finally {
|
||||
setPosterBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
/** 실패한 잡과 산출물을 지우고 처음부터. 되돌릴 수 없다 */
|
||||
/** 실패한 잡과 산출물을 지우고 처음부터. 크레딧은 실패 시점에 이미 환불됐다. 되돌릴 수 없다 */
|
||||
const handlePosterDiscard = async () => {
|
||||
if (!posterJobId || posterBusy) 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 가 복구의 유일한 근거다. 그런데 서버를 재시작하거나 다른
|
||||
* 사람이 그 잡을 지우면 id 만 남아 **빈 진행 화면에서 영원히 멈춘다** — 실제로 겪었다.
|
||||
* 404 를 만나면 업로드 화면으로 되돌린다.
|
||||
* 복구의 근거는 localStorage 의 id 다. 그런데 그 잡이 지워졌거나 로그인한 사용자의
|
||||
* 것이 아니면(백엔드는 남의 잡을 404 로 답한다) id 만 남아 **빈 진행 화면에서
|
||||
* 영원히 멈춘다**. 404 를 만나면 업로드 화면으로 되돌린다.
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (posterNotFound) handlePosterNew();
|
||||
@@ -718,6 +793,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
setSsulStep('entry');
|
||||
// clearProjectStorage() 가 POSTER_JOB_ID 를 지우므로 state 도 함께 비운다
|
||||
setPosterJobId(null);
|
||||
setPlayreelJobId(null);
|
||||
setSongTaskId(null);
|
||||
setImageTaskId(null);
|
||||
setAnalysisData(null);
|
||||
@@ -745,6 +821,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
error={analysisError}
|
||||
onSsulJobStarted={handleSsulJobStarted}
|
||||
onPosterJobStarted={handlePosterJobStarted}
|
||||
onPlayreelJobStarted={handlePlayreelJobStarted}
|
||||
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 파생)
|
||||
if (pipeline === 'poster') {
|
||||
switch (posterStep) {
|
||||
@@ -781,7 +886,6 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
return (
|
||||
<PosterMakingContent
|
||||
job={posterJob}
|
||||
onRetry={handlePosterRetry}
|
||||
onDiscard={handlePosterDiscard}
|
||||
busy={posterBusy}
|
||||
/>
|
||||
@@ -913,6 +1017,18 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
</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)은 전체 화면 스크롤이지만 스텝퍼는 표시
|
||||
if (wizardStep === 0) {
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
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 VideoDetailModal from '../../components/VideoDetailModal';
|
||||
import ContentCardSocialActions from '../../components/ContentCardSocialActions';
|
||||
import SsulViewerModal from '../Ssulbox/SsulViewerModal';
|
||||
import P2vViewerModal from '../../components/P2vViewerModal';
|
||||
import { useOverlayClose } from '../../hooks/useOverlayClose';
|
||||
|
||||
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 [isDeleting, setIsDeleting] = 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);
|
||||
// 썰박스는 별도 뷰어를 쓴다 — VideoDetailModal 은 video_id 로 조회하므로
|
||||
// 썰박스 id 를 넘기면 id 가 겹치는 다른 영상이 열린다.
|
||||
const [selectedSsul, setSelectedSsul] = useState<VideoListItem | null>(null);
|
||||
const [selectedP2v, setSelectedP2v] = useState<VideoListItem | null>(null);
|
||||
|
||||
const pageSize = 12;
|
||||
|
||||
@@ -181,7 +184,9 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
};
|
||||
|
||||
const handleUploadClick = (video: VideoListItem) => {
|
||||
setUploadTargetVideo(video);
|
||||
// P2V 는 소셜 업로드를 지원하지 않는다(버튼도 막는다)
|
||||
if (isP2vContent(video.type)) return;
|
||||
setUploadTargetVideo({ ...video, type: video.type });
|
||||
setUploadModalOpen(true);
|
||||
};
|
||||
|
||||
@@ -202,7 +207,9 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
try {
|
||||
// 종류별 삭제 API 가 다르다. deleteVideo 는 Video.id 로 지우므로
|
||||
// 썰박스 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);
|
||||
} else {
|
||||
await deleteVideo(deleteTarget.video_id);
|
||||
@@ -259,9 +266,11 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
className="content-card-thumbnail"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() =>
|
||||
video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: setSelectedVideoId(video.video_id)
|
||||
isP2vContent(video.type)
|
||||
? setSelectedP2v(video)
|
||||
: video.type === 'ssul'
|
||||
? setSelectedSsul(video)
|
||||
: setSelectedVideoId(video.video_id)
|
||||
}
|
||||
>
|
||||
{video.poster_url ? (
|
||||
@@ -303,8 +312,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
<p className="content-card-date">
|
||||
{formatDate(video.created_at)}
|
||||
</p>
|
||||
{/* 좋아요·댓글 API 가 type 을 받으므로 썰박스에도 노출한다.
|
||||
contentType 이 없으면 id 가 겹치는 다른 영상에 반영된다. */}
|
||||
{/* 모든 콘텐츠는 ID 와 종류를 함께 보내 소셜 반응을 구분한다. */}
|
||||
<ContentCardSocialActions
|
||||
videoId={video.video_id}
|
||||
contentType={video.type}
|
||||
@@ -326,7 +334,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
<button
|
||||
className="content-download-btn"
|
||||
onClick={() => handleUploadClick(video)}
|
||||
disabled={!video.result_movie_url}
|
||||
disabled={!video.result_movie_url || isP2vContent(video.type)}
|
||||
>
|
||||
<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"/>
|
||||
@@ -418,6 +426,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
|
||||
)}
|
||||
|
||||
<SsulViewerModal item={selectedSsul} onClose={() => setSelectedSsul(null)} />
|
||||
<P2vViewerModal item={selectedP2v} onClose={() => setSelectedP2v(null)} />
|
||||
|
||||
{/* 소셜 미디어 업로드 모달 */}
|
||||
<SocialPostingModal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AutocompleteRequest } from '../../utils/api';
|
||||
import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
||||
@@ -6,7 +6,8 @@ import PipelineTabs, { Pipeline } from '../../components/PipelineTabs';
|
||||
import SsulCreateForm from '../Ssulbox/SsulCreateForm';
|
||||
import { Scen } from '../Ssulbox/ssulData';
|
||||
import PosterCreateForm from '../Poster/PosterCreateForm';
|
||||
import StylingContent from '../Poster/StylingContent';
|
||||
import PosterStartChoice from '../Poster/PosterStartChoice';
|
||||
import PlayreelCreateForm from '../P2v/PlayreelCreateForm';
|
||||
|
||||
interface UrlInputContentProps {
|
||||
/** 현재 선택된 파이프라인. 소유자는 GenerationFlow (분기·리셋 때문) */
|
||||
@@ -20,6 +21,8 @@ interface UrlInputContentProps {
|
||||
onSsulJobStarted: (taskId: number, scenario: Scen) => void;
|
||||
/** 포스터 영상(F1) 생성 요청 접수 시. 폴링 소유는 GenerationFlow */
|
||||
onPosterJobStarted: (jobId: string) => void;
|
||||
/** 롱컷 생성 요청 접수 시. 폴링 소유는 GenerationFlow */
|
||||
onPlayreelJobStarted: (jobId: string) => void;
|
||||
/** 크레딧 부족 시 충전 화면으로 */
|
||||
onGoToPayment: () => void;
|
||||
}
|
||||
@@ -38,12 +41,28 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
||||
error,
|
||||
onSsulJobStarted,
|
||||
onPosterJobStarted,
|
||||
onPlayreelJobStarted,
|
||||
onGoToPayment,
|
||||
}) => {
|
||||
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 = () => {
|
||||
switch (pipeline) {
|
||||
@@ -59,10 +78,26 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
||||
case 'ssul':
|
||||
return <SsulCreateForm onSubmitted={onSsulJobStarted} onNeedCredit={onGoToPayment} />;
|
||||
case 'poster':
|
||||
return <PosterCreateForm onSubmitted={onPosterJobStarted} />;
|
||||
case 'styling':
|
||||
// 스타일링은 위저드가 아니라 도구다 — 진입 화면 안에서 처음부터 끝까지 끝난다
|
||||
return <StylingContent />;
|
||||
return posterStart === 'choose' ? (
|
||||
<PosterStartChoice
|
||||
onPickImage={() => setPosterStart('image')}
|
||||
onPickUrl={() => onPipelineChange('playreel')}
|
||||
/>
|
||||
) : (
|
||||
<PosterCreateForm
|
||||
onSubmitted={onPosterJobStarted}
|
||||
onNeedCredit={onGoToPayment}
|
||||
onBack={backToChoice}
|
||||
/>
|
||||
);
|
||||
case 'playreel':
|
||||
return (
|
||||
<PlayreelCreateForm
|
||||
onSubmitted={onPlayreelJobStarted}
|
||||
onNeedCredit={onGoToPayment}
|
||||
onBack={backToChoice}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -70,16 +105,16 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({
|
||||
|
||||
return (
|
||||
<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">
|
||||
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||
</div>
|
||||
|
||||
<PipelineTabs value={pipeline} onChange={onPipelineChange} />
|
||||
<PipelineTabs value={pipeline} onChange={handleTabChange} />
|
||||
|
||||
{/* 고른 기능이 무엇을 해주는지 한 줄. 탭 라벨(2~6자)만으로는 네 기능의 차이가
|
||||
전달되지 않아 처음 온 사람이 아무거나 눌러본다. STEP 1 위에 둔다. */}
|
||||
<p className="pipeline-desc">{t(`pipelineTabs.desc.${pipeline}`)}</p>
|
||||
{!showChoice && <p className="pipeline-desc">{t(`pipelineTabs.desc.${pipeline}`)}</p>}
|
||||
|
||||
{renderForm()}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user