ui 디자인 수정 .
This commit is contained in:
1 parent
24d61f925a
commit
07ba65cca6
27 files changed
+2738
-725
No files matched your search
@@ -4,13 +4,12 @@ import React from 'react';
|
||||
const Header: React.FC = () => {
|
||||
return (
|
||||
<header className="landing-header">
|
||||
<div className="header-logo">CASTAD</div>
|
||||
<div className="header-avatar">
|
||||
<img
|
||||
src="https://picsum.photos/seed/user/100/100"
|
||||
alt="User Profile"
|
||||
/>
|
||||
<div className="header-logo">
|
||||
<img src="/assets/images/logo.svg" alt="CASTAD" />
|
||||
</div>
|
||||
<button className="header-login-btn">
|
||||
로그인
|
||||
</button>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,20 +4,24 @@ import React from 'react';
|
||||
const LoadingSection: React.FC = () => {
|
||||
return (
|
||||
<div className="loading-container">
|
||||
<div className="loading-spinner">
|
||||
{/* Spinning Outer Ring */}
|
||||
<div className="loading-ring"></div>
|
||||
{/* Pulsing center icon */}
|
||||
<div className="loading-dot">
|
||||
<div className="loading-dot-inner"></div>
|
||||
<div className="loading-content">
|
||||
{/* Logo */}
|
||||
<div className="loading-logo">
|
||||
<img src="/assets/images/loading-logo.svg" alt="CASTAD" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="loading-text">
|
||||
<h2 className="loading-title">비즈니스 분석 중</h2>
|
||||
<p className="loading-description">
|
||||
AI가 입력하신 정보를 바탕으로 마케팅 핵심 가치를 추출하고 있습니다...
|
||||
</p>
|
||||
{/* Loading Spinner and Text */}
|
||||
<div className="loading-section">
|
||||
<h2 className="loading-title">브랜드 분석 중</h2>
|
||||
|
||||
<div className="loading-spinner-wrapper">
|
||||
<img
|
||||
src="/assets/images/loading-spinner.svg"
|
||||
alt="Loading"
|
||||
className="loading-spinner-icon"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useRef, useState, useEffect } from 'react';
|
||||
import { ImageItem, ImageUrlItem } from '../../types/api';
|
||||
import { uploadImages } from '../../utils/api';
|
||||
|
||||
@@ -11,6 +11,8 @@ interface AssetManagementContentProps {
|
||||
onAddImages: (files: File[]) => void;
|
||||
}
|
||||
|
||||
type VideoRatio = 'vertical' | 'horizontal';
|
||||
|
||||
const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
onBack,
|
||||
onNext,
|
||||
@@ -22,6 +24,21 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
const imageListRef = useRef<HTMLDivElement>(null);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [uploadError, setUploadError] = useState<string | null>(null);
|
||||
const [videoRatio, setVideoRatio] = useState<VideoRatio>('vertical');
|
||||
|
||||
// Load video ratio from localStorage on mount
|
||||
useEffect(() => {
|
||||
const savedRatio = localStorage.getItem('castad_video_ratio') as VideoRatio;
|
||||
if (savedRatio === 'vertical' || savedRatio === 'horizontal') {
|
||||
setVideoRatio(savedRatio);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Save video ratio to localStorage when it changes
|
||||
const handleVideoRatioChange = (ratio: VideoRatio) => {
|
||||
setVideoRatio(ratio);
|
||||
localStorage.setItem('castad_video_ratio', ratio);
|
||||
};
|
||||
|
||||
const getImageSrc = (item: ImageItem): string => {
|
||||
return item.type === 'url' ? item.url : item.preview;
|
||||
@@ -105,54 +122,60 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
|
||||
return (
|
||||
<main className="page-container">
|
||||
{/* Back Button */}
|
||||
<div className="back-button-container">
|
||||
<button onClick={onBack} className="btn-back">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
{/* Header with Back Button and Progress */}
|
||||
<div className="asset-header">
|
||||
<button onClick={onBack} className="btn-back-new">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
<span>뒤로가기</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Header */}
|
||||
<div className="page-header">
|
||||
<h1 className="page-title">브랜드 에셋</h1>
|
||||
<p className="page-subtitle">
|
||||
쉽고 빠르게, 브랜드 소셜 미디어 캠페인을 만드세요.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="main-content">
|
||||
{/* Selected Images Card */}
|
||||
<div className="card card-flex card-flex-2 card-overflow-hidden">
|
||||
<div className="flex-between mb-4 shrink-0">
|
||||
<h3 className="section-title mb-0">선택된 이미지</h3>
|
||||
<span className="text-gray-400 text-sm">{imageList.length}장</span>
|
||||
<div className="progress-indicator">
|
||||
<div className="progress-label">
|
||||
<span className="progress-text">단계</span>
|
||||
<div className="progress-numbers">
|
||||
<span className="progress-current">1</span>
|
||||
<span className="progress-divider">/</span>
|
||||
<span className="progress-total">2</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress-bar-wrapper">
|
||||
<div className="progress-bar-fill" style={{ width: '50%' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<h1 className="asset-title">브랜드 에셋</h1>
|
||||
|
||||
{/* Main Content Container */}
|
||||
<div className="asset-container">
|
||||
{/* Left Column - Selected Images */}
|
||||
<div className="asset-column asset-column-left">
|
||||
<h3 className="asset-section-title">선택된 이미지</h3>
|
||||
<div
|
||||
ref={imageListRef}
|
||||
onWheel={handleImageListWheel}
|
||||
className="overflow-y-auto flex-1 min-h-0 custom-scrollbar"
|
||||
className="asset-image-list"
|
||||
style={{ overscrollBehavior: 'contain' }}
|
||||
>
|
||||
{imageList.length > 0 ? (
|
||||
<div className="image-grid">
|
||||
<div className="asset-image-grid">
|
||||
{imageList.map((item, i) => (
|
||||
<div key={i} className="image-item">
|
||||
<div key={i} className="asset-image-item">
|
||||
<img
|
||||
src={getImageSrc(item)}
|
||||
alt={`이미지 ${i + 1}`}
|
||||
/>
|
||||
{item.type === 'file' && (
|
||||
<div className="image-item-badge">NEW</div>
|
||||
<div className="asset-image-badge">업로드</div>
|
||||
)}
|
||||
<button
|
||||
onClick={() => onRemoveImage(i)}
|
||||
className="image-item-remove"
|
||||
className="asset-image-remove"
|
||||
>
|
||||
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
<line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
@@ -160,57 +183,71 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex-center text-gray-500 text-base h-full">
|
||||
이미지가 없습니다
|
||||
</div>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Upload Card */}
|
||||
<div className="card card-flex card-flex-1" style={{ minHeight: '200px' }}>
|
||||
<h3 className="section-title">이미지 업로드</h3>
|
||||
<div
|
||||
onClick={handleFileSelect}
|
||||
onDragOver={handleDragOver}
|
||||
onDrop={handleDrop}
|
||||
className="upload-zone"
|
||||
>
|
||||
<div className="upload-zone-icon">
|
||||
<svg className="w-12 h-12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
||||
<polyline points="17 8 12 3 7 8"/>
|
||||
<line x1="12" y1="3" x2="12" y2="15"/>
|
||||
</svg>
|
||||
{/* Right Column - Upload and Video Ratio */}
|
||||
<div className="asset-column asset-column-right">
|
||||
{/* Image Upload Section */}
|
||||
<div className="asset-upload-section">
|
||||
<h3 className="asset-section-title">이미지 업로드</h3>
|
||||
<div
|
||||
onClick={handleFileSelect}
|
||||
onDragOver={handleDragOver}
|
||||
onDrop={handleDrop}
|
||||
className="asset-upload-zone"
|
||||
>
|
||||
<p className="asset-upload-text">
|
||||
이미지를 드래그하여<br/>업로드
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
onChange={handleFileChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Video Ratio Section */}
|
||||
<div className="asset-ratio-section">
|
||||
<h3 className="asset-section-title">영상 비율</h3>
|
||||
<div className="asset-ratio-buttons">
|
||||
<button
|
||||
onClick={() => handleVideoRatioChange('vertical')}
|
||||
className={`asset-ratio-button ${videoRatio === 'vertical' ? 'active' : ''}`}
|
||||
>
|
||||
<div className="asset-ratio-icon asset-ratio-icon-vertical">
|
||||
<div className="asset-ratio-box"></div>
|
||||
</div>
|
||||
<span>9:16</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleVideoRatioChange('horizontal')}
|
||||
className={`asset-ratio-button ${videoRatio === 'horizontal' ? 'active' : ''}`}
|
||||
>
|
||||
<div className="asset-ratio-icon asset-ratio-icon-horizontal">
|
||||
<div className="asset-ratio-box"></div>
|
||||
</div>
|
||||
<span>16:9</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="upload-zone-title">
|
||||
이미지를 드래그하여<br/>업로드
|
||||
</p>
|
||||
<p className="upload-zone-subtitle">
|
||||
또는 클릭하여 파일 선택
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
onChange={handleFileChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom Button */}
|
||||
<div className="bottom-button-container">
|
||||
<div className="asset-bottom">
|
||||
{uploadError && (
|
||||
<p className="text-red-500 text-sm mb-2">{uploadError}</p>
|
||||
)}
|
||||
<button
|
||||
onClick={handleNextWithUpload}
|
||||
disabled={imageList.length === 0 || isUploading}
|
||||
className={`btn-primary ${imageList.length === 0 || isUploading ? 'disabled' : ''}`}
|
||||
className="asset-next-button"
|
||||
>
|
||||
{isUploading ? '업로드 중...' : '다음 단계'}
|
||||
</button>
|
||||
|
||||
@@ -5,6 +5,8 @@ import { generateVideo, waitForVideoComplete } from '../../utils/api';
|
||||
interface CompletionContentProps {
|
||||
onBack: () => void;
|
||||
songTaskId: string | null;
|
||||
onVideoStatusChange?: (status: 'idle' | 'generating' | 'complete' | 'error') => void;
|
||||
onVideoProgressChange?: (progress: number) => void;
|
||||
}
|
||||
|
||||
type VideoStatus = 'idle' | 'generating' | 'polling' | 'complete' | 'error';
|
||||
@@ -20,17 +22,38 @@ interface SavedVideoState {
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskId }) => {
|
||||
const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
onBack,
|
||||
songTaskId,
|
||||
onVideoStatusChange,
|
||||
onVideoProgressChange
|
||||
}) => {
|
||||
const [selectedSocials, setSelectedSocials] = useState<string[]>([]);
|
||||
const [videoStatus, setVideoStatus] = useState<VideoStatus>('idle');
|
||||
const [videoUrl, setVideoUrl] = useState<string | null>(null);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
const [statusMessage, setStatusMessage] = useState('');
|
||||
const [renderProgress, setRenderProgress] = useState(0); // 영상 렌더링 진행률 (0-100)
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const videoRef = useRef<HTMLVideoElement>(null);
|
||||
const hasStartedGeneration = useRef(false);
|
||||
|
||||
// Notify parent of video status changes
|
||||
useEffect(() => {
|
||||
if (onVideoStatusChange) {
|
||||
const mappedStatus = videoStatus === 'polling' ? 'generating' : videoStatus;
|
||||
onVideoStatusChange(mappedStatus);
|
||||
}
|
||||
}, [videoStatus, onVideoStatusChange]);
|
||||
|
||||
// Notify parent of progress changes
|
||||
useEffect(() => {
|
||||
if (onVideoProgressChange) {
|
||||
onVideoProgressChange(renderProgress);
|
||||
}
|
||||
}, [renderProgress, onVideoProgressChange]);
|
||||
|
||||
const saveToStorage = (videoTaskId: string, currentSongTaskId: string, status: VideoStatus, url: string | null) => {
|
||||
const data: SavedVideoState = {
|
||||
videoTaskId,
|
||||
@@ -74,7 +97,11 @@ const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskI
|
||||
setErrorMessage(null);
|
||||
|
||||
try {
|
||||
const videoResponse = await generateVideo(songTaskId);
|
||||
// Get video ratio from localStorage (default to 'vertical' if not set)
|
||||
const savedRatio = localStorage.getItem('castad_video_ratio');
|
||||
const orientation = (savedRatio === 'horizontal' || savedRatio === 'vertical') ? savedRatio : 'vertical';
|
||||
|
||||
const videoResponse = await generateVideo(songTaskId, orientation);
|
||||
|
||||
if (!videoResponse.success) {
|
||||
throw new Error(videoResponse.error_message || '영상 생성 요청에 실패했습니다.');
|
||||
@@ -96,7 +123,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskI
|
||||
}
|
||||
};
|
||||
|
||||
// 상태별 한글 메시지 매핑
|
||||
// 상태별 한글 메시지 및 진행률 매핑
|
||||
const getStatusMessage = (status: string): string => {
|
||||
switch (status) {
|
||||
case 'planned':
|
||||
@@ -114,6 +141,24 @@ const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskI
|
||||
}
|
||||
};
|
||||
|
||||
// 상태별 진행률 계산
|
||||
const getProgressForStatus = (status: string): number => {
|
||||
switch (status) {
|
||||
case 'planned':
|
||||
return 20;
|
||||
case 'waiting':
|
||||
return 40;
|
||||
case 'transcribing':
|
||||
return 60;
|
||||
case 'rendering':
|
||||
return 80;
|
||||
case 'succeeded':
|
||||
return 100;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
const pollVideoStatus = async (videoTaskId: string, currentSongTaskId: string) => {
|
||||
try {
|
||||
// 영상 생성 상태 폴링 (3분 타임아웃, 3초 간격)
|
||||
@@ -121,6 +166,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskI
|
||||
videoTaskId,
|
||||
(status: string) => {
|
||||
setStatusMessage(getStatusMessage(status));
|
||||
setRenderProgress(getProgressForStatus(status));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -227,160 +273,181 @@ const CompletionContent: React.FC<CompletionContentProps> = ({ onBack, songTaskI
|
||||
};
|
||||
|
||||
const socials = [
|
||||
{ id: 'Youtube', email: 'o2ocorp@o2o.kr', color: '#ff0000', icon: <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 4-8 4z"/></svg> },
|
||||
{ id: 'Instagram', email: 'o2ocorp@o2o.kr', color: '#e4405f', icon: <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259 0 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.791-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.209-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg> },
|
||||
{ id: 'Youtube', email: 'o2ocorp@o2o.kr', logo: '/assets/images/social-youtube.png' },
|
||||
{ id: 'Instagram', email: 'o2ocorp@o2o.kr', logo: '/assets/images/social-instagram.png' },
|
||||
{ id: 'Facebook', email: 'o2ocorp@o2o.kr', logo: '/assets/images/social-facebook.png' },
|
||||
];
|
||||
|
||||
const isLoading = videoStatus === 'generating' || videoStatus === 'polling';
|
||||
|
||||
return (
|
||||
<main className="completion-container">
|
||||
{/* Back Button */}
|
||||
<div className="back-button-container">
|
||||
<button onClick={onBack} className="btn-back">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<main className="page-container">
|
||||
{/* Header with Back Button and Progress */}
|
||||
<div className="asset-header">
|
||||
<button onClick={onBack} className="btn-back-new">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
<span>뒤로가기</span>
|
||||
</button>
|
||||
|
||||
<div className="progress-indicator">
|
||||
<div className="progress-label">
|
||||
<span className="progress-text">단계</span>
|
||||
<div className="progress-numbers">
|
||||
<span className="progress-current">2</span>
|
||||
<span className="progress-divider">/</span>
|
||||
<span className="progress-total">2</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress-bar-wrapper">
|
||||
<div
|
||||
className="progress-bar-fill"
|
||||
style={{ width: videoStatus === 'complete' ? '100%' : `${renderProgress}%` }}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Header */}
|
||||
<div className="page-header">
|
||||
<h1 className="page-title">
|
||||
{isLoading ? '영상 생성 중' : videoStatus === 'error' ? '영상 생성 실패' : '콘텐츠 제작 완료'}
|
||||
</h1>
|
||||
<p className="page-subtitle">
|
||||
{isLoading
|
||||
? statusMessage || '잠시만 기다려주세요...'
|
||||
: videoStatus === 'error'
|
||||
? errorMessage || '오류가 발생했습니다.'
|
||||
: '인스타그램 릴스 및 틱톡에 최적화된 고성능 영상을 제작했습니다.'}
|
||||
</p>
|
||||
</div>
|
||||
{/* Title */}
|
||||
<h1 className="completion-title">
|
||||
{isLoading ? '영상 생성 중' : videoStatus === 'error' ? '영상 생성 실패' : '콘텐츠 제작 완료'}
|
||||
</h1>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="completion-content">
|
||||
{/* Main Content Container */}
|
||||
<div className="completion-container">
|
||||
{/* Left: Video Preview */}
|
||||
<div className="video-preview-card">
|
||||
<h3 className="section-title mb-4 shrink-0">이미지 및 영상</h3>
|
||||
<div className="completion-column completion-column-left video-preview-card">
|
||||
<h3 className="asset-section-title">이미지 및 영상</h3>
|
||||
|
||||
<div className="video-container">
|
||||
{isLoading ? (
|
||||
/* Loading State */
|
||||
<div className="video-loading">
|
||||
<div className="loading-spinner">
|
||||
<div className="loading-ring"></div>
|
||||
<div className="loading-dot">
|
||||
<div className="loading-dot-inner"></div>
|
||||
<div className="completion-video-wrapper">
|
||||
<div className="video-container">
|
||||
{isLoading ? (
|
||||
/* Loading State */
|
||||
<div className="video-loading">
|
||||
<div className="loading-spinner">
|
||||
<div className="loading-ring"></div>
|
||||
<div className="loading-dot">
|
||||
<div className="loading-dot-inner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-gray-400 mt-4">{statusMessage}</p>
|
||||
</div>
|
||||
<p className="text-gray-400 mt-4">{statusMessage}</p>
|
||||
</div>
|
||||
) : videoStatus === 'error' ? (
|
||||
/* Error State */
|
||||
<div className="video-error">
|
||||
<svg className="w-16 h-16 text-red-500 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 8v4M12 16h.01" />
|
||||
</svg>
|
||||
<p className="text-gray-400 mb-4">{errorMessage}</p>
|
||||
<button onClick={handleRetry} className="btn-secondary">
|
||||
다시 시도
|
||||
</button>
|
||||
</div>
|
||||
) : videoUrl ? (
|
||||
/* Video Player */
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={videoUrl}
|
||||
className="video-player"
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
onEnded={handleVideoEnded}
|
||||
onClick={togglePlayPause}
|
||||
/>
|
||||
) : (
|
||||
<div className="video-pattern"></div>
|
||||
)}
|
||||
|
||||
{/* Video Player Controls - only show when video is ready */}
|
||||
{videoStatus === 'complete' && videoUrl && (
|
||||
<div className="video-controls">
|
||||
<div className="video-controls-inner">
|
||||
<button className="video-play-btn" onClick={togglePlayPause}>
|
||||
{isPlaying ? (
|
||||
<svg className="w-7 h-7" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
||||
) : (
|
||||
<svg className="w-7 h-7" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
)}
|
||||
) : videoStatus === 'error' ? (
|
||||
/* Error State */
|
||||
<div className="video-error">
|
||||
<svg className="w-16 h-16 text-red-500 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 8v4M12 16h.01" />
|
||||
</svg>
|
||||
<p className="text-gray-400 mb-4">{errorMessage}</p>
|
||||
<button onClick={handleRetry} className="btn-secondary">
|
||||
다시 시도
|
||||
</button>
|
||||
<div className="video-progress">
|
||||
<div className="video-progress-fill" style={{ width: `${progress}%` }}></div>
|
||||
</div>
|
||||
) : videoUrl ? (
|
||||
<>
|
||||
{/* Video Player */}
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={videoUrl}
|
||||
className="video-player"
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
onEnded={handleVideoEnded}
|
||||
onClick={togglePlayPause}
|
||||
/>
|
||||
{/* Video Overlay */}
|
||||
<div className="video-overlay">
|
||||
<div className="video-overlay-content">
|
||||
<h3 className="video-overlay-title">
|
||||
군산, 그 시간 속에 머물다<br/>
|
||||
스테이, 머뭄
|
||||
</h3>
|
||||
<span className="video-overlay-logo">CASTAD</span>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="video-pattern"></div>
|
||||
)}
|
||||
|
||||
{/* Video Player Controls - only show when video is ready */}
|
||||
{videoStatus === 'complete' && videoUrl && (
|
||||
<div className="video-controls">
|
||||
<div className="video-controls-inner">
|
||||
<button className="video-play-btn" onClick={togglePlayPause}>
|
||||
{isPlaying ? (
|
||||
<svg className="w-7 h-7" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
||||
) : (
|
||||
<svg className="w-7 h-7" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
)}
|
||||
</button>
|
||||
<div className="video-progress">
|
||||
<div className="video-progress-fill" style={{ width: `${progress}%` }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tags - only show when complete */}
|
||||
{/* AI Optimization Tags - only show when complete */}
|
||||
{videoStatus === 'complete' && (
|
||||
<div className="tags-container">
|
||||
{['AI 최적화', '색상 보정', '다이나믹 자막', '비트 싱크', 'SEO 메타 태그'].map(tag => (
|
||||
<span key={tag} className="tag-dot">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
<div className="ai-optimization-section">
|
||||
<h3 className="ai-optimization-title">AI 최적화</h3>
|
||||
<div className="ai-optimization-tags">
|
||||
{['색상 보정', '다이나믹 자막', '비트 싱크', 'SEO 메타 태그'].map(tag => (
|
||||
<div key={tag} className="ai-tag">
|
||||
<div className="ai-tag-dot"></div>
|
||||
<span className="ai-tag-text">{tag}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Right: Sharing */}
|
||||
<div className="sharing-card">
|
||||
<h3 className="section-title mb-6 shrink-0">공유</h3>
|
||||
<div className="completion-column completion-column-right sharing-card">
|
||||
<div className="sharing-content">
|
||||
<h3 className="asset-section-title">공유</h3>
|
||||
|
||||
<div className="social-list custom-scrollbar">
|
||||
{socials.map(social => {
|
||||
const isSelected = selectedSocials.includes(social.id);
|
||||
return (
|
||||
<div
|
||||
key={social.id}
|
||||
onClick={() => videoStatus === 'complete' && toggleSocial(social.id)}
|
||||
className={`social-card ${isSelected ? 'selected' : ''} ${videoStatus !== 'complete' ? 'disabled' : ''}`}
|
||||
>
|
||||
<div className="social-list-new">
|
||||
{socials.map(social => {
|
||||
const isSelected = selectedSocials.includes(social.id);
|
||||
return (
|
||||
<div
|
||||
className="social-icon"
|
||||
style={{ backgroundColor: social.color }}
|
||||
key={social.id}
|
||||
onClick={() => videoStatus === 'complete' && toggleSocial(social.id)}
|
||||
className={`completion-social-card ${videoStatus !== 'complete' ? 'disabled' : ''}`}
|
||||
>
|
||||
<div className="social-icon-inner">{social.icon}</div>
|
||||
{isSelected && (
|
||||
<div className="social-check">
|
||||
<svg className="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="4"><polyline points="20 6 9 17 4 12"/></svg>
|
||||
</div>
|
||||
)}
|
||||
<div className="completion-social-info">
|
||||
<img src={social.logo} alt={social.id} className="completion-social-logo" />
|
||||
<span className="completion-social-name">{social.id}</span>
|
||||
</div>
|
||||
<span className="completion-social-email">{social.email}</span>
|
||||
</div>
|
||||
<span className="social-name">
|
||||
{social.id}
|
||||
</span>
|
||||
<span className="social-email">{social.email}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
disabled={selectedSocials.length === 0 || videoStatus !== 'complete'}
|
||||
className="btn-deploy"
|
||||
>
|
||||
소셜 채널에 배포
|
||||
</button>
|
||||
<div className="sharing-actions">
|
||||
<button
|
||||
disabled={selectedSocials.length === 0 || videoStatus !== 'complete'}
|
||||
className="btn-completion-deploy"
|
||||
>
|
||||
소셜 채널에 배포
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={handleDownload}
|
||||
disabled={videoStatus !== 'complete' || !videoUrl}
|
||||
className="btn-download"
|
||||
>
|
||||
MP4 파일 다운로드
|
||||
</button>
|
||||
<button
|
||||
onClick={handleDownload}
|
||||
disabled={videoStatus !== 'complete' || !videoUrl}
|
||||
className="btn-completion-download"
|
||||
>
|
||||
MP4 파일 다운로드
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -52,6 +52,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
const [maxWizardIndex, setMaxWizardIndex] = useState(savedWizardStep ? parseInt(savedWizardStep, 10) : 0);
|
||||
const [songTaskId, setSongTaskId] = useState<string | null>(savedSongTaskId);
|
||||
const [imageTaskId, setImageTaskId] = useState<string | null>(savedImageTaskId);
|
||||
const [videoGenerationStatus, setVideoGenerationStatus] = useState<'idle' | 'generating' | 'complete' | 'error'>('idle');
|
||||
const [videoGenerationProgress, setVideoGenerationProgress] = useState(0);
|
||||
|
||||
// URL 이미지를 ImageItem 형태로 변환하여 초기화
|
||||
const [imageList, setImageList] = useState<ImageItem[]>(
|
||||
@@ -75,7 +77,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
file,
|
||||
preview: URL.createObjectURL(file),
|
||||
}));
|
||||
setImageList(prev => [...prev, ...newImages]);
|
||||
// 새로 업로드된 이미지를 배열 앞에 추가 (최신 이미지가 상단에 표시)
|
||||
setImageList(prev => [...newImages, ...prev]);
|
||||
};
|
||||
|
||||
// 홈 버튼(로고) 클릭 시 모든 상태 초기화 후 홈으로 이동
|
||||
@@ -177,6 +180,11 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
<AssetManagementContent
|
||||
onBack={() => setActiveItem('대시보드')}
|
||||
onNext={(taskId: string) => {
|
||||
// Clear video generation state to start fresh
|
||||
localStorage.removeItem(VIDEO_GENERATION_KEY);
|
||||
setVideoGenerationStatus('idle');
|
||||
setVideoGenerationProgress(0);
|
||||
|
||||
setImageTaskId(taskId);
|
||||
localStorage.setItem(IMAGE_TASK_ID_KEY, taskId);
|
||||
scrollToWizardSection(1);
|
||||
@@ -197,6 +205,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
}}
|
||||
businessInfo={businessInfo}
|
||||
imageTaskId={imageTaskId}
|
||||
videoGenerationStatus={videoGenerationStatus}
|
||||
videoGenerationProgress={videoGenerationProgress}
|
||||
/>
|
||||
</div>
|
||||
{/* Step 2: Completion */}
|
||||
@@ -204,6 +214,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
<CompletionContent
|
||||
onBack={() => scrollToWizardSection(1)}
|
||||
songTaskId={songTaskId}
|
||||
onVideoStatusChange={setVideoGenerationStatus}
|
||||
onVideoProgressChange={setVideoGenerationProgress}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,8 @@ interface SoundStudioContentProps {
|
||||
onNext: (songTaskId: string) => void;
|
||||
businessInfo?: BusinessInfo;
|
||||
imageTaskId: string | null;
|
||||
videoGenerationStatus?: 'idle' | 'generating' | 'complete' | 'error';
|
||||
videoGenerationProgress?: number;
|
||||
}
|
||||
|
||||
type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polling' | 'complete' | 'error';
|
||||
@@ -30,10 +32,26 @@ const STORAGE_KEY = 'castad_song_generation';
|
||||
const STORAGE_EXPIRY = 30 * 60 * 1000;
|
||||
const MAX_RETRY_COUNT = 3;
|
||||
|
||||
const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext, businessInfo, imageTaskId }) => {
|
||||
const LANGUAGE_FLAGS: Record<string, string> = {
|
||||
'한국어': '🇰🇷',
|
||||
'English': '🇺🇸',
|
||||
'中文': '🇨🇳',
|
||||
'日本語': '🇯🇵',
|
||||
'ไทย': '🇹🇭',
|
||||
'Tiếng Việt': '🇻🇳',
|
||||
};
|
||||
|
||||
const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
onBack,
|
||||
onNext,
|
||||
businessInfo,
|
||||
imageTaskId,
|
||||
videoGenerationStatus = 'idle',
|
||||
videoGenerationProgress = 0
|
||||
}) => {
|
||||
const [selectedType, setSelectedType] = useState('보컬');
|
||||
const [selectedLang, setSelectedLang] = useState('한국어');
|
||||
const [selectedGenre, setSelectedGenre] = useState('AI 추천');
|
||||
const [selectedGenre, setSelectedGenre] = useState('자동 선택');
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [status, setStatus] = useState<GenerationStatus>('idle');
|
||||
@@ -47,9 +65,11 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext,
|
||||
const [statusMessage, setStatusMessage] = useState('');
|
||||
const [retryCount, setRetryCount] = useState(0);
|
||||
const [songTaskId, setSongTaskId] = useState<string | null>(null);
|
||||
const [isLanguageDropdownOpen, setIsLanguageDropdownOpen] = useState(false);
|
||||
|
||||
const progressBarRef = useRef<HTMLDivElement>(null);
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
const languageDropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const saveToStorage = (taskId: string, sunoTaskId: string, currentLyrics: string, currentStatus: GenerationStatus) => {
|
||||
const data: SavedGenerationState = {
|
||||
@@ -98,6 +118,23 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext,
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Close language dropdown when clicking outside
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (languageDropdownRef.current && !languageDropdownRef.current.contains(event.target as Node)) {
|
||||
setIsLanguageDropdownOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (isLanguageDropdownOpen) {
|
||||
document.addEventListener('mousedown', handleClickOutside);
|
||||
}
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleClickOutside);
|
||||
};
|
||||
}, [isLanguageDropdownOpen]);
|
||||
|
||||
const resumePolling = async (taskId: string, sunoTaskId: string, currentLyrics: string, currentRetryCount: number = 0) => {
|
||||
try {
|
||||
const downloadResponse = await waitForSongComplete(
|
||||
@@ -153,10 +190,14 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext,
|
||||
try {
|
||||
const language = LANGUAGE_MAP[selectedLang] || 'Korean';
|
||||
const genreMap: Record<string, string> = {
|
||||
'AI 추천': 'pop',
|
||||
'로파이': 'lofi',
|
||||
'힙합': 'hip-hop',
|
||||
'어쿠스틱': 'acoustic',
|
||||
'자동 선택': 'pop',
|
||||
'K-POP': 'kpop',
|
||||
'발라드': 'ballad',
|
||||
'Hip-Hop': 'hip-hop',
|
||||
'R&B': 'rnb',
|
||||
'EDM': 'edm',
|
||||
'JAZZ': 'jazz',
|
||||
'ROCK': 'rock',
|
||||
};
|
||||
|
||||
const songResponse = await generateSong(imageTaskId, {
|
||||
@@ -322,10 +363,14 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext,
|
||||
setStatusMessage('음악을 생성하고 있습니다...');
|
||||
|
||||
const genreMap: Record<string, string> = {
|
||||
'AI 추천': 'pop',
|
||||
'로파이': 'lofi',
|
||||
'힙합': 'hip-hop',
|
||||
'어쿠스틱': 'acoustic',
|
||||
'자동 선택': 'pop',
|
||||
'K-POP': 'kpop',
|
||||
'발라드': 'ballad',
|
||||
'Hip-Hop': 'hip-hop',
|
||||
'R&B': 'rnb',
|
||||
'EDM': 'edm',
|
||||
'JAZZ': 'jazz',
|
||||
'ROCK': 'rock',
|
||||
};
|
||||
|
||||
const songResponse = await generateSong(imageTaskId, {
|
||||
@@ -369,217 +414,270 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({ onBack, onNext,
|
||||
const isGenerating = status === 'generating_lyric' || status === 'generating_song' || status === 'polling';
|
||||
|
||||
return (
|
||||
<div className="flex-col h-full overflow-hidden" style={{ display: 'flex' }}>
|
||||
<main className="page-container">
|
||||
{audioUrl && (
|
||||
<audio ref={audioRef} src={audioUrl} preload="metadata" />
|
||||
)}
|
||||
|
||||
{/* Header Section */}
|
||||
<div className="shrink-0 p-6 md:p-8 pb-0">
|
||||
<div className="back-button-container">
|
||||
<button onClick={onBack} className="btn-back">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="page-header">
|
||||
<h1 className="page-title">사운드 스튜디오</h1>
|
||||
<p className="page-subtitle">
|
||||
쉽고 빠르게, 브랜드 소셜 미디어 캠페인을 만드세요.
|
||||
</p>
|
||||
{/* Header with Progress */}
|
||||
<div className="sound-studio-header">
|
||||
<button onClick={onBack} className="btn-back-new">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
</button>
|
||||
<div className="progress-indicator">
|
||||
<div className="progress-label">
|
||||
<span className="progress-text">단계</span>
|
||||
<div className="progress-numbers">
|
||||
<span className="progress-current">2</span>
|
||||
<span className="progress-divider">/</span>
|
||||
<span className="progress-total">2</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress-bar-wrapper">
|
||||
<div className="progress-bar-track"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 px-6 md:px-8 min-h-0 overflow-hidden">
|
||||
<div className="main-content h-full justify-center">
|
||||
{/* Audio Style Card */}
|
||||
<div
|
||||
className={`card card-flex card-overflow-hidden transition-all duration-700 ease-out ${
|
||||
showLyrics ? 'lg:flex-[1.5]' : 'flex-1 lg:max-w-2xl'
|
||||
}`}
|
||||
>
|
||||
<h3 className="section-title">오디오 스타일</h3>
|
||||
{/* Page Title */}
|
||||
<h1 className="sound-studio-title">사운드 스튜디오</h1>
|
||||
|
||||
<div className="space-y-5 flex-1 min-h-0 overflow-y-auto custom-scrollbar">
|
||||
<div>
|
||||
<p className="text-sm text-gray-400 mb-3 font-medium">AI 사운드 유형 선택</p>
|
||||
<div className="grid-cols-3 gap-3" style={{ display: 'grid' }}>
|
||||
{['보컬', '성우 내레이션', '배경음악'].map(type => (
|
||||
<button
|
||||
key={type}
|
||||
onClick={() => setSelectedType(type)}
|
||||
disabled={isGenerating}
|
||||
className={`btn-select ${selectedType === type ? 'active' : ''}`}
|
||||
>
|
||||
{type}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{/* Main Content - Two Column Layout */}
|
||||
<div className="sound-studio-container">
|
||||
<div className="sound-studio-columns">
|
||||
{/* Left Column - Sound Settings */}
|
||||
<div className="sound-column">
|
||||
<h3 className="column-title">사운드</h3>
|
||||
|
||||
<div>
|
||||
<p className="text-sm text-gray-400 mb-3 font-medium">언어 선택</p>
|
||||
<div className="grid-cols-3 gap-3" style={{ display: 'grid' }}>
|
||||
{[
|
||||
{ label: '한국어', flag: '🇰🇷' },
|
||||
{ label: 'English', flag: '🇺🇸' },
|
||||
{ label: '中文', flag: '🇨🇳' },
|
||||
{ label: '日本語', flag: '🇯🇵' },
|
||||
{ label: 'ไทย', flag: '🇹🇭' },
|
||||
{ label: 'Tiếng Việt', flag: '🇻🇳' }
|
||||
].map(lang => (
|
||||
<button
|
||||
key={lang.label}
|
||||
onClick={() => setSelectedLang(lang.label)}
|
||||
disabled={isGenerating}
|
||||
className={`btn-select flex-col gap-1 ${selectedLang === lang.label ? 'active' : ''}`}
|
||||
style={{ display: 'flex', alignItems: 'center' }}
|
||||
>
|
||||
<span className="text-lg">{lang.flag}</span>
|
||||
<span>{lang.label}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p className="text-sm text-gray-400 mb-3 font-medium">음악 장르 선택</p>
|
||||
<select
|
||||
value={selectedGenre}
|
||||
onChange={(e) => setSelectedGenre(e.target.value)}
|
||||
disabled={isGenerating}
|
||||
className="select-input"
|
||||
>
|
||||
<option>AI 추천</option>
|
||||
<option>로파이</option>
|
||||
<option>힙합</option>
|
||||
<option>어쿠스틱</option>
|
||||
</select>
|
||||
{/* Sound Type Selection */}
|
||||
<div className="sound-studio-section">
|
||||
<label className="input-label">AI 사운드 유형 선택</label>
|
||||
<div className="sound-type-grid">
|
||||
{['보컬', '성우 내레이션', '배경음악'].map(type => (
|
||||
<button
|
||||
key={type}
|
||||
onClick={() => setSelectedType(type)}
|
||||
disabled={isGenerating}
|
||||
className={`sound-type-btn ${selectedType === type ? 'active' : ''}`}
|
||||
>
|
||||
{type}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{errorMessage && (
|
||||
<div className="error-message">
|
||||
{errorMessage}
|
||||
{/* Genre Selection */}
|
||||
<div className="sound-studio-section">
|
||||
<label className="input-label">장르 선택</label>
|
||||
<div className="genre-grid">
|
||||
<div className="genre-row">
|
||||
{['자동 선택', 'K-POP', '발라드'].map(genre => (
|
||||
<button
|
||||
key={genre}
|
||||
onClick={() => setSelectedGenre(genre)}
|
||||
disabled={isGenerating}
|
||||
className={`genre-btn ${selectedGenre === genre ? 'active' : ''}`}
|
||||
>
|
||||
{genre}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="genre-row">
|
||||
{['Hip-Hop', 'R&B', 'EDM'].map(genre => (
|
||||
<button
|
||||
key={genre}
|
||||
onClick={() => setSelectedGenre(genre)}
|
||||
disabled={isGenerating}
|
||||
className={`genre-btn ${selectedGenre === genre ? 'active' : ''}`}
|
||||
>
|
||||
{genre}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="genre-row">
|
||||
{['JAZZ', 'ROCK'].map(genre => (
|
||||
<button
|
||||
key={genre}
|
||||
onClick={() => setSelectedGenre(genre)}
|
||||
disabled={isGenerating}
|
||||
className={`genre-btn ${selectedGenre === genre ? 'active' : ''}`}
|
||||
>
|
||||
{genre}
|
||||
</button>
|
||||
))}
|
||||
<div className="genre-btn-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isGenerating && statusMessage && (
|
||||
<div className="status-message">
|
||||
<svg className="animate-spin h-4 w-4" viewBox="0 0 24 24">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none"/>
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"/>
|
||||
</svg>
|
||||
{statusMessage}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-4 shrink-0">
|
||||
<button
|
||||
onClick={handleGenerateMusic}
|
||||
disabled={isGenerating}
|
||||
className={`btn-secondary ${isGenerating ? 'disabled' : ''}`}
|
||||
>
|
||||
{isGenerating ? (
|
||||
<>
|
||||
<svg className="animate-spin h-4 w-4" viewBox="0 0 24 24">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none"/>
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"/>
|
||||
</svg>
|
||||
생성 중...
|
||||
</>
|
||||
) : (
|
||||
'음악 생성'
|
||||
{/* Language Selection */}
|
||||
<div className="sound-studio-section">
|
||||
<label className="input-label">언어</label>
|
||||
<div className="language-selector-wrapper" ref={languageDropdownRef}>
|
||||
<button
|
||||
onClick={() => setIsLanguageDropdownOpen(!isLanguageDropdownOpen)}
|
||||
disabled={isGenerating}
|
||||
className="language-selector"
|
||||
>
|
||||
<div className="language-display">
|
||||
<span className="language-flag">{LANGUAGE_FLAGS[selectedLang]}</span>
|
||||
<span className="language-name">{selectedLang}</span>
|
||||
</div>
|
||||
<img
|
||||
src="/assets/images/icon-dropdown.svg"
|
||||
alt=""
|
||||
className={`language-dropdown-icon ${isLanguageDropdownOpen ? 'open' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
{isLanguageDropdownOpen && (
|
||||
<div className="language-dropdown-menu">
|
||||
{Object.keys(LANGUAGE_MAP).map((lang) => (
|
||||
<button
|
||||
key={lang}
|
||||
onClick={() => {
|
||||
setSelectedLang(lang);
|
||||
setIsLanguageDropdownOpen(false);
|
||||
}}
|
||||
className={`language-dropdown-item ${selectedLang === lang ? 'active' : ''}`}
|
||||
>
|
||||
<span className="language-flag">{LANGUAGE_FLAGS[lang]}</span>
|
||||
<span className="language-name">{lang}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lyrics Card */}
|
||||
{showLyrics && (
|
||||
<div
|
||||
className="card card-flex flex-1 animate-slide-in card-overflow-hidden min-w-280"
|
||||
>
|
||||
<h3 className="section-title mb-1">가사</h3>
|
||||
<p className="text-gray-500 text-sm mb-4 shrink-0">가사 영역을 선택해서 수정 가능해요</p>
|
||||
{/* Right Column - Lyrics */}
|
||||
<div className="lyrics-column">
|
||||
<div className="lyrics-header">
|
||||
<h3 className="column-title">가사</h3>
|
||||
<p className="lyrics-subtitle">가사 영역을 선택해서 수정 가능해요</p>
|
||||
</div>
|
||||
|
||||
<div className="card-inner flex-col gap-3 min-h-0 overflow-hidden" style={{ display: 'flex', flex: 1 }}>
|
||||
{/* Player Bar */}
|
||||
<div className="player-bar">
|
||||
<button
|
||||
onClick={togglePlayPause}
|
||||
disabled={!audioUrl}
|
||||
className={`play-btn ${!audioUrl ? 'disabled' : ''}`}
|
||||
>
|
||||
{isPlaying ? (
|
||||
<svg className="w-6 h-6" viewBox="0 0 24 24" fill="currentColor">
|
||||
<rect x="6" y="4" width="4" height="16" rx="1" />
|
||||
<rect x="14" y="4" width="4" height="16" rx="1" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg className="w-6 h-6" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
)}
|
||||
</button>
|
||||
{/* Audio Player */}
|
||||
<div className="audio-player">
|
||||
<button
|
||||
onClick={togglePlayPause}
|
||||
disabled={!audioUrl}
|
||||
className={`play-btn-new ${!audioUrl ? 'disabled' : ''}`}
|
||||
>
|
||||
{isPlaying ? (
|
||||
<svg className="w-6 h-6" viewBox="0 0 24 24" fill="currentColor">
|
||||
<rect x="6" y="4" width="4" height="16" rx="1" />
|
||||
<rect x="14" y="4" width="4" height="16" rx="1" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg className="w-6 h-6" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M8 5v14l11-7z"/>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
|
||||
<div
|
||||
ref={progressBarRef}
|
||||
onMouseDown={onMouseDown}
|
||||
className={`progress-bar-container ${!audioUrl ? 'disabled' : ''}`}
|
||||
>
|
||||
<div
|
||||
className="progress-bar-fill"
|
||||
style={{ width: `${progress}%` }}
|
||||
></div>
|
||||
<div
|
||||
ref={progressBarRef}
|
||||
onMouseDown={onMouseDown}
|
||||
className={`audio-progress-container ${!audioUrl ? 'disabled' : ''}`}
|
||||
>
|
||||
<div
|
||||
className="audio-progress-fill"
|
||||
style={{ width: `${progress}%` }}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="progress-bar-thumb"
|
||||
style={{ left: `${progress}%` }}
|
||||
>
|
||||
<div className="progress-bar-thumb-glow"></div>
|
||||
<div className="progress-bar-thumb-dot"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span className="audio-time">
|
||||
{formatTime(Math.max(0, duration - currentTime))}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span className="time-display">
|
||||
{formatTime(Math.max(0, duration - currentTime))}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Lyrics Textarea */}
|
||||
{/* Lyrics Display */}
|
||||
<div className="lyrics-display">
|
||||
{lyrics ? (
|
||||
<textarea
|
||||
value={lyrics}
|
||||
onChange={(e) => setLyrics(e.target.value)}
|
||||
className="textarea-lyrics custom-scrollbar"
|
||||
placeholder="가사가 여기에 표시됩니다..."
|
||||
className="lyrics-textarea"
|
||||
placeholder="사운드 생성 시 가사 표시됩니다."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={handleRegenerate}
|
||||
disabled={isGenerating}
|
||||
className="btn-regenerate"
|
||||
>
|
||||
재생성
|
||||
</button>
|
||||
) : (
|
||||
<div className="lyrics-placeholder">
|
||||
사운드 생성 시 가사 표시됩니다.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Generate Button */}
|
||||
<button
|
||||
onClick={handleGenerateMusic}
|
||||
disabled={isGenerating}
|
||||
className={`btn-generate-sound ${isGenerating ? 'disabled' : ''}`}
|
||||
>
|
||||
{isGenerating ? (
|
||||
<>
|
||||
<svg className="animate-spin h-4 w-4" viewBox="0 0 24 24">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none"/>
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"/>
|
||||
</svg>
|
||||
생성 중...
|
||||
</>
|
||||
) : (
|
||||
'사운드 생성'
|
||||
)}
|
||||
</button>
|
||||
|
||||
{errorMessage && (
|
||||
<div className="error-message-new">
|
||||
{errorMessage}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isGenerating && statusMessage && (
|
||||
<div className="status-message-new">
|
||||
<svg className="animate-spin h-4 w-4" viewBox="0 0 24 24">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none"/>
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"/>
|
||||
</svg>
|
||||
{statusMessage}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Bottom Button */}
|
||||
<div className="bottom-button-container">
|
||||
<button
|
||||
onClick={() => songTaskId && onNext(songTaskId)}
|
||||
disabled={status !== 'complete' || !songTaskId}
|
||||
className={`btn-primary ${status !== 'complete' || !songTaskId ? 'disabled' : ''}`}
|
||||
disabled={status !== 'complete' || !songTaskId || videoGenerationStatus === 'generating'}
|
||||
className={`btn-video-generate ${
|
||||
videoGenerationStatus === 'generating'
|
||||
? 'generating'
|
||||
: status !== 'complete' || !songTaskId
|
||||
? 'disabled'
|
||||
: ''
|
||||
}`}
|
||||
>
|
||||
영상 생성하기
|
||||
{videoGenerationStatus === 'generating' ? (
|
||||
<>
|
||||
<span className="video-gen-text">영상 생성 중</span>
|
||||
<div className="video-gen-progress-bar">
|
||||
<div
|
||||
className="video-gen-progress-fill"
|
||||
style={{ width: `${videoGenerationProgress}%` }}
|
||||
></div>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
'영상 생성하기'
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@ interface DisplaySectionProps {
|
||||
}
|
||||
|
||||
const DisplaySection: React.FC<DisplaySectionProps> = ({ onStartClick }) => {
|
||||
const videoIds = ['dM8_d6Aud68', 'bb8nKmKcT0c', 'dM8_d6Aud68'];
|
||||
const frames = [
|
||||
{ id: 1, image: '/assets/images/display-frame-1.png' },
|
||||
{ id: 2, image: '/assets/images/display-frame-1.png' },
|
||||
{ id: 3, image: '/assets/images/display-frame-1.png' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="display-section">
|
||||
@@ -15,27 +19,13 @@ const DisplaySection: React.FC<DisplaySectionProps> = ({ onStartClick }) => {
|
||||
|
||||
<div className="content-safe-area" style={{ paddingTop: '7rem' }}>
|
||||
{/* Main visual frames container */}
|
||||
<div className="video-frames">
|
||||
{videoIds.map((videoId, index) => (
|
||||
<div className="display-frames">
|
||||
{frames.map((frame, index) => (
|
||||
<div
|
||||
key={`${videoId}-${index}`}
|
||||
className={`phone-frame ${index === 2 ? 'hidden-mobile' : ''}`}
|
||||
key={frame.id}
|
||||
className={`display-frame ${index === 2 ? 'display-frame-hidden-mobile' : ''}`}
|
||||
>
|
||||
{/* YouTube Embed Container */}
|
||||
<div className="phone-video-container">
|
||||
<iframe
|
||||
src={`https://www.youtube.com/embed/${videoId}?autoplay=1&mute=1&loop=1&playlist=${videoId}&controls=0&showinfo=0&rel=0&modestbranding=1&iv_load_policy=3&disablekb=1&playsinline=1`}
|
||||
title="YouTube video player"
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
{/* Device Bezel/Frame */}
|
||||
<div className="phone-bezel"></div>
|
||||
{/* Notch */}
|
||||
<div className="phone-notch"></div>
|
||||
<img src={frame.image} alt={`Display ${frame.id}`} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -12,17 +12,23 @@ const WelcomeSection: React.FC<WelcomeSectionProps> = ({ onStartClick, onNext })
|
||||
{
|
||||
id: 1,
|
||||
title: '비즈니스 핵심 정보 분석',
|
||||
description: '홈페이지, 네이버 지도, 블로그 등의 URL을 입력하세요',
|
||||
description: '홈페이지, 네이버 지도, 블로그 등의\nURL을 입력하세요',
|
||||
icon: '/assets/images/icon-analysis.svg',
|
||||
iconBg: '#9BCACC'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '홍보 콘텐츠 자동 제작',
|
||||
description: '분석 정보를 바탕으로 제작합니다',
|
||||
description: '분석된 정보를 바탕으로\n비즈니스에 맞는 음악, 자막, 노래, 영상을\n자동으로 제작해요',
|
||||
icon: '/assets/images/icon-content.svg',
|
||||
iconBg: '#DFC7FD'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '멀티채널 자동 배포',
|
||||
description: '다운로드 또는 SNS 즉시 업로드',
|
||||
description: '완성된 영상은 다운로드하거나\n바로 SNS에 업로드 할 수 있어요',
|
||||
icon: '/assets/images/icon-deploy.svg',
|
||||
iconBg: '#D4FDF3'
|
||||
},
|
||||
];
|
||||
|
||||
@@ -33,34 +39,28 @@ const WelcomeSection: React.FC<WelcomeSectionProps> = ({ onStartClick, onNext })
|
||||
<div className="content-safe-area" style={{ paddingTop: '5rem' }}>
|
||||
<div className="welcome-header">
|
||||
<div className="welcome-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M12 2l2.4 7.2L22 12l-7.6 2.4L12 22l-2.4-7.2L2 12l7.6-2.4z" />
|
||||
</svg>
|
||||
<img src="/assets/images/star-icon.svg" alt="star" />
|
||||
</div>
|
||||
<h2 className="welcome-title">CASTAD에 오신 것을 환영합니다.</h2>
|
||||
<p className="welcome-subtitle">분석, 제작, 배포까지 콘텐츠 마케팅 자동화</p>
|
||||
<p className="welcome-subtitle">분석, 제작, 배포까지 콘텐츠 마케팅의 전과정을 자동화</p>
|
||||
</div>
|
||||
|
||||
<div className="feature-grid">
|
||||
{features.map((feature) => (
|
||||
<div key={feature.id} className="feature-item">
|
||||
<div className="feature-number">{feature.id}</div>
|
||||
<div className="feature-content">
|
||||
<h3 className="feature-title">{feature.title}</h3>
|
||||
<p className="feature-description">{feature.description}</p>
|
||||
<h3 className="feature-title">{feature.title}</h3>
|
||||
<div className="feature-icon" style={{ backgroundColor: feature.iconBg }}>
|
||||
<img src={feature.icon} alt={feature.title} />
|
||||
</div>
|
||||
<p className="feature-description">{feature.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="welcome-buttons">
|
||||
<button onClick={onStartClick} className="btn-ghost">
|
||||
처음으로
|
||||
</button>
|
||||
<button onClick={onNext} className="btn-cta">
|
||||
시작하기
|
||||
</button>
|
||||
</div>
|
||||
<button onClick={onNext} className="btn-start">
|
||||
시작하기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -11,18 +11,17 @@ const LoginSection: React.FC<LoginSectionProps> = ({ onBack, onLogin }) => {
|
||||
<div className="login-container">
|
||||
{/* Back Button */}
|
||||
<button onClick={onBack} className="login-back-btn">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M15 18l-6-6 6-6" />
|
||||
</svg>
|
||||
뒤로가기
|
||||
<img src="/assets/images/icon-back.svg" alt="Back" />
|
||||
<span>뒤로가기</span>
|
||||
</button>
|
||||
|
||||
<div className="login-content">
|
||||
<h1 className="login-title">CASTAD</h1>
|
||||
<p className="login-subtitle">
|
||||
Marketing Automation for Location Based Business
|
||||
</p>
|
||||
{/* Logo */}
|
||||
<div className="login-logo">
|
||||
<img src="/assets/images/login-logo.svg" alt="CASTAD" />
|
||||
</div>
|
||||
|
||||
{/* Kakao Login Button */}
|
||||
<button onClick={onLogin} className="btn-kakao">
|
||||
카카오로 시작하기
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user