모든 ui / ux 변경 작업 .
This commit is contained in:
1 parent
95928c0b66
commit
f8bebdac52
9 files changed
+505
-445
No files matched your search
@@ -4,7 +4,6 @@ import { ImageItem, ImageUrlItem } from '../../types/api';
|
||||
import { uploadImages } from '../../utils/api';
|
||||
|
||||
interface AssetManagementContentProps {
|
||||
onBack: () => void;
|
||||
onNext: (imageTaskId: string) => void;
|
||||
imageList: ImageItem[];
|
||||
onRemoveImage: (index: number) => void;
|
||||
@@ -14,7 +13,6 @@ interface AssetManagementContentProps {
|
||||
type VideoRatio = 'vertical' | 'horizontal';
|
||||
|
||||
const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
onBack,
|
||||
onNext,
|
||||
imageList,
|
||||
onRemoveImage,
|
||||
@@ -74,20 +72,8 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
};
|
||||
|
||||
const handleImageListWheel = (e: React.WheelEvent) => {
|
||||
const el = imageListRef.current;
|
||||
if (!el) return;
|
||||
|
||||
const { scrollTop, scrollHeight, clientHeight } = el;
|
||||
const hasScrollableContent = scrollHeight > clientHeight;
|
||||
|
||||
if (!hasScrollableContent) return;
|
||||
|
||||
const atTop = scrollTop <= 0;
|
||||
const atBottom = scrollTop + clientHeight >= scrollHeight - 1;
|
||||
|
||||
if ((e.deltaY < 0 && !atTop) || (e.deltaY > 0 && !atBottom)) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
// 이 영역 안에서는 항상 스크롤 이벤트 전파 차단
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const handleDragOver = (e: React.DragEvent) => {
|
||||
@@ -122,30 +108,6 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
|
||||
return (
|
||||
<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">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>
|
||||
|
||||
@@ -158,7 +120,6 @@ const AssetManagementContent: React.FC<AssetManagementContentProps> = ({
|
||||
ref={imageListRef}
|
||||
onWheel={handleImageListWheel}
|
||||
className="asset-image-list"
|
||||
style={{ overscrollBehavior: 'contain' }}
|
||||
>
|
||||
{imageList.length > 0 ? (
|
||||
<div className="asset-image-grid">
|
||||
|
||||
@@ -282,7 +282,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
|
||||
return (
|
||||
<main className="page-container">
|
||||
{/* Header with Back Button and Progress */}
|
||||
{/* Header with Back Button */}
|
||||
<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">
|
||||
@@ -290,23 +290,6 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
</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>
|
||||
|
||||
{/* Title */}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import React, { useRef, useEffect, useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import Sidebar from '../../components/Sidebar';
|
||||
import AssetManagementContent from './AssetManagementContent';
|
||||
import SoundStudioContent from './SoundStudioContent';
|
||||
@@ -40,8 +40,6 @@ interface GenerationFlowProps {
|
||||
}
|
||||
|
||||
const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveItem = '대시보드', initialImageList = [], businessInfo }) => {
|
||||
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// localStorage에서 저장된 상태 복원
|
||||
const savedActiveItem = localStorage.getItem(ACTIVE_ITEM_KEY);
|
||||
const savedWizardStep = localStorage.getItem(WIZARD_STEP_KEY);
|
||||
@@ -49,7 +47,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
const savedImageTaskId = localStorage.getItem(IMAGE_TASK_ID_KEY);
|
||||
|
||||
const [activeItem, setActiveItem] = useState(savedActiveItem || initialActiveItem);
|
||||
const [maxWizardIndex, setMaxWizardIndex] = useState(savedWizardStep ? parseInt(savedWizardStep, 10) : 0);
|
||||
// 현재 위저드 단계 (0: Asset, 1: Sound Studio, 2: Completion)
|
||||
const [wizardStep, setWizardStep] = 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');
|
||||
@@ -84,22 +83,17 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
// 홈 버튼(로고) 클릭 시 모든 상태 초기화 후 홈으로 이동
|
||||
const handleHome = () => {
|
||||
clearAllProjectStorage();
|
||||
setMaxWizardIndex(0);
|
||||
setWizardStep(0);
|
||||
setSongTaskId(null);
|
||||
setImageTaskId(null);
|
||||
setImageList(initialImageList.map(url => ({ type: 'url', url })));
|
||||
onHome();
|
||||
};
|
||||
|
||||
const scrollToWizardSection = (index: number) => {
|
||||
if (scrollContainerRef.current) {
|
||||
const sections = scrollContainerRef.current.querySelectorAll('.flow-section');
|
||||
if (sections[index]) {
|
||||
setMaxWizardIndex(prev => Math.max(prev, index));
|
||||
localStorage.setItem(WIZARD_STEP_KEY, index.toString());
|
||||
sections[index].scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
}
|
||||
// 위저드 단계 이동
|
||||
const goToWizardStep = (step: number) => {
|
||||
setWizardStep(step);
|
||||
localStorage.setItem(WIZARD_STEP_KEY, step.toString());
|
||||
};
|
||||
|
||||
// activeItem 변경 시 localStorage에 저장
|
||||
@@ -107,60 +101,55 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
localStorage.setItem(ACTIVE_ITEM_KEY, activeItem);
|
||||
}, [activeItem]);
|
||||
|
||||
// 새로고침 시 저장된 위저드 단계로 스크롤
|
||||
useEffect(() => {
|
||||
if (activeItem === '새 프로젝트 만들기' && savedWizardStep) {
|
||||
const stepIndex = parseInt(savedWizardStep, 10);
|
||||
// 약간의 딜레이 후 스크롤 (DOM이 준비될 때까지)
|
||||
setTimeout(() => {
|
||||
if (scrollContainerRef.current) {
|
||||
const sections = scrollContainerRef.current.querySelectorAll('.flow-section');
|
||||
if (sections[stepIndex]) {
|
||||
sections[stepIndex].scrollIntoView({ behavior: 'auto', block: 'start' });
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
// 새 프로젝트 만들기 - 단계별 컨텐츠 렌더링
|
||||
const renderWizardContent = () => {
|
||||
switch (wizardStep) {
|
||||
case 0:
|
||||
return (
|
||||
<AssetManagementContent
|
||||
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);
|
||||
goToWizardStep(1);
|
||||
}}
|
||||
imageList={imageList}
|
||||
onRemoveImage={handleRemoveImage}
|
||||
onAddImages={handleAddImages}
|
||||
/>
|
||||
);
|
||||
case 1:
|
||||
return (
|
||||
<SoundStudioContent
|
||||
onBack={() => goToWizardStep(0)}
|
||||
onNext={(taskId: string) => {
|
||||
setSongTaskId(taskId);
|
||||
localStorage.setItem(SONG_TASK_ID_KEY, taskId);
|
||||
goToWizardStep(2);
|
||||
}}
|
||||
businessInfo={businessInfo}
|
||||
imageTaskId={imageTaskId}
|
||||
videoGenerationStatus={videoGenerationStatus}
|
||||
videoGenerationProgress={videoGenerationProgress}
|
||||
/>
|
||||
);
|
||||
case 2:
|
||||
return (
|
||||
<CompletionContent
|
||||
onBack={() => goToWizardStep(1)}
|
||||
songTaskId={songTaskId}
|
||||
onVideoStatusChange={setVideoGenerationStatus}
|
||||
onVideoProgressChange={setVideoGenerationProgress}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const container = scrollContainerRef.current;
|
||||
if (!container || activeItem !== '새 프로젝트 만들기') return;
|
||||
|
||||
const handleWheel = (e: WheelEvent) => {
|
||||
// 스크롤 가능한 자식 요소 내부에서 발생한 이벤트인지 확인
|
||||
const target = e.target as HTMLElement;
|
||||
|
||||
// custom-scrollbar 클래스를 가진 요소 또는 그 자식에서 발생한 이벤트인지 확인
|
||||
const scrollableParent = target.closest('.custom-scrollbar') as HTMLElement;
|
||||
if (scrollableParent) {
|
||||
const { scrollTop, scrollHeight, clientHeight } = scrollableParent;
|
||||
const hasScrollableContent = scrollHeight > clientHeight;
|
||||
const atTop = scrollTop <= 0;
|
||||
const atBottom = scrollTop + clientHeight >= scrollHeight - 1;
|
||||
|
||||
// 스크롤 가능한 콘텐츠가 있는 경우
|
||||
if (hasScrollableContent) {
|
||||
// 위로 스크롤하고 맨 위가 아니거나, 아래로 스크롤하고 맨 아래가 아니면 허용
|
||||
if ((e.deltaY < 0 && !atTop) || (e.deltaY > 0 && !atBottom)) {
|
||||
return; // 이미지 리스트 스크롤 허용 (preventDefault 하지 않음)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const h = container.clientHeight;
|
||||
const currentIdx = Math.round(container.scrollTop / h);
|
||||
|
||||
if (e.deltaY > 0) { // Down
|
||||
if (currentIdx >= maxWizardIndex) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
container.addEventListener('wheel', handleWheel, { passive: false });
|
||||
return () => container.removeEventListener('wheel', handleWheel);
|
||||
}, [maxWizardIndex, activeItem]);
|
||||
};
|
||||
|
||||
const renderContent = () => {
|
||||
switch (activeItem) {
|
||||
@@ -170,54 +159,8 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
return <BusinessSettingsContent />;
|
||||
case '새 프로젝트 만들기':
|
||||
return (
|
||||
<div
|
||||
ref={scrollContainerRef}
|
||||
className="flex-1 h-full overflow-y-auto snap-y snap-mandatory scroll-smooth no-scrollbar"
|
||||
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
|
||||
>
|
||||
{/* Step 0: Asset Management (AnalysisResultSection removed) */}
|
||||
<div className="flow-section snap-start h-full w-full flex flex-col overflow-hidden">
|
||||
<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);
|
||||
}}
|
||||
imageList={imageList}
|
||||
onRemoveImage={handleRemoveImage}
|
||||
onAddImages={handleAddImages}
|
||||
/>
|
||||
</div>
|
||||
{/* Step 1: Sound Studio */}
|
||||
<div className="flow-section snap-start h-full w-full flex flex-col">
|
||||
<SoundStudioContent
|
||||
onBack={() => scrollToWizardSection(0)}
|
||||
onNext={(taskId: string) => {
|
||||
setSongTaskId(taskId);
|
||||
localStorage.setItem(SONG_TASK_ID_KEY, taskId);
|
||||
scrollToWizardSection(2);
|
||||
}}
|
||||
businessInfo={businessInfo}
|
||||
imageTaskId={imageTaskId}
|
||||
videoGenerationStatus={videoGenerationStatus}
|
||||
videoGenerationProgress={videoGenerationProgress}
|
||||
/>
|
||||
</div>
|
||||
{/* Step 2: Completion */}
|
||||
<div className="flow-section snap-start h-full w-full flex flex-col overflow-hidden">
|
||||
<CompletionContent
|
||||
onBack={() => scrollToWizardSection(1)}
|
||||
songTaskId={songTaskId}
|
||||
onVideoStatusChange={setVideoGenerationStatus}
|
||||
onVideoProgressChange={setVideoGenerationProgress}
|
||||
/>
|
||||
</div>
|
||||
<div className="wizard-page-container">
|
||||
{renderWizardContent()}
|
||||
</div>
|
||||
);
|
||||
default:
|
||||
|
||||
@@ -430,7 +430,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
<audio ref={audioRef} src={audioUrl} preload="metadata" />
|
||||
)}
|
||||
|
||||
{/* Header with Progress */}
|
||||
{/* Header */}
|
||||
<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">
|
||||
@@ -438,19 +438,6 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
</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>
|
||||
|
||||
{/* Page Title */}
|
||||
@@ -467,16 +454,19 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
<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>
|
||||
))}
|
||||
{['보컬', '배경음악', '성우 내레이션'].map(type => {
|
||||
const isDisabled = type === '성우 내레이션' || isGenerating;
|
||||
return (
|
||||
<button
|
||||
key={type}
|
||||
onClick={() => !isDisabled && setSelectedType(type)}
|
||||
disabled={isDisabled}
|
||||
className={`sound-type-btn ${selectedType === type ? 'active' : ''} ${type === '성우 내레이션' ? 'permanently-disabled' : ''}`}
|
||||
>
|
||||
{type}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user