feat: 무빙 포스터 YouTube 업로드 연동

This commit is contained in:
skkim committed 2026-10-16 11:29:42 +09:00
1 parent c659f8c2f9
commit a5b7529f17
4 files changed
+50 -14

No files matched your search

+8 -8
View File
@@ -199,8 +199,8 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
const now = Date.now();
const seoKey =
video?.type === 'ssul'
? `ssul:${video.video_id}`
video && video.type !== 'video'
? `${video.type}:${video.video_id}`
: video?.task_id || null;
const expired = now - loadedAtRef.current > SEO_CACHE_TTL;
@@ -244,20 +244,20 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
/**
* 제목·설명·태그 자동 채움.
*
* `seoKey` 는 호출부가 만든 캐시 키다(ADO2=task_id, 썰박스=`ssul:{id}`).
* 백엔드에 보낼 식별자는 종류마다 다르다 — ADO2 는 task_id(UUID), 썰박스는
* ssul_content.id 문자열이며, 서버가 content_type 으로 어느 테이블을 볼지 가른다.
* `seoKey` 는 호출부가 만든 캐시 키다(ADO2=task_id, 썰박스=`ssul:{id}`, 무빙 포스터=`p2v_video:{id}`).
* 백엔드에 보낼 식별자는 종류마다 다르다 — ADO2 는 task_id(UUID), 썰박스·무빙 포스터는
* 콘텐츠 id 문자열이며, 서버가 content_type 으로 어느 테이블을 볼지 가른다.
*/
const loadAutocomplete = async (seoKey: string) => {
if (!video) return;
const isSsul = video.type === 'ssul';
if (!isSsul && !video.task_id) return;
const byContentId = video.type !== 'video';
if (!byContentId && !video.task_id) return;
setIsLoadingAutoDescription(true);
try {
const requestPayload = {
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);
+3 -3
View File
@@ -184,8 +184,8 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
};
const handleUploadClick = (video: VideoListItem) => {
// P2V 는 소셜 업로드를 지원하지 않는다(버튼도 막는다)
if (isP2vContent(video.type)) return;
// 롱컷(p2v_playreel)은 소셜 업로드를 지원하지 않는다(버튼도 막는다). 무빙 포스터는 지원한다.
if (video.type === 'p2v_playreel') return;
setUploadTargetVideo({ ...video, type: video.type });
setUploadModalOpen(true);
};
@@ -334,7 +334,7 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate, embedded })
<button
className="content-download-btn"
onClick={() => handleUploadClick(video)}
disabled={!video.result_movie_url || isP2vContent(video.type)}
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">
<path d="M10 13V3M10 3l-4 4M10 3l4 4"/>
+37 -1
View File
@@ -1,6 +1,8 @@
import React from 'react';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { P2vJob } from '../../utils/p2vApi';
import { SocialUploadableItem } from '../../types/api';
import SocialPostingModal from '../../components/SocialPostingModal';
interface PosterResultContentProps {
job: P2vJob;
@@ -16,10 +18,29 @@ interface PosterResultContentProps {
*/
const PosterResultContent: React.FC<PosterResultContentProps> = ({ job, onNew }) => {
const { t } = useTranslation();
const [showSocialModal, setShowSocialModal] = useState(false);
const video = job.artifacts.video ?? '';
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 (
<div className="p2v-scope p2v-result">
<h2 className="p2v-result__title">{t('poster.result.title')}</h2>
@@ -81,10 +102,25 @@ const PosterResultContent: React.FC<PosterResultContentProps> = ({ job, onNew })
{t('poster.result.downloadVideo')}
</a>
)}
{uploadItem && job.status === 'done' && (
<button
type="button"
className="p2v-btn-tonal"
onClick={() => setShowSocialModal(true)}
>
{t('ado2Contents.uploadToSocial')}
</button>
)}
</div>
</div>
</div>
<SocialPostingModal
isOpen={showSocialModal}
onClose={() => setShowSocialModal(false)}
video={uploadItem}
/>
<button type="button" className="p2v-btn-outline p2v-result__new" onClick={onNew}>
{t('poster.result.new')}
</button>
+2 -2
View File
@@ -330,8 +330,8 @@ export interface VideosListResponse {
has_prev: boolean;
}
/** 소셜 업로드 모달이 받는 항목 — P2V 는 업로드 API 가 없어 제외한다 */
export type SocialUploadableItem = VideoListItem & { type: Exclude<ContentType, P2vContentType> };
/** 소셜 업로드 모달이 받는 항목 — 무빙 포스터(p2v_video)까지 업로드를 지원하고 롱컷(p2v_playreel)은 제외한다 */
export type SocialUploadableItem = VideoListItem & { type: Exclude<ContentType, 'p2v_playreel'> };
// 댓글 대댓글
export interface CommentReply {