인디케이터 추가 및 css코드 분리
This commit is contained in:
1 parent
429c8d4708
commit
888ac4fa5e
45 files changed
+13009
-14040
No files matched your search
@@ -1,21 +0,0 @@
|
||||
|
||||
import React from 'react';
|
||||
import Sidebar from '../../components/Sidebar';
|
||||
import AssetManagementContent from './AssetManagementContent';
|
||||
|
||||
interface AssetManagementSectionProps {
|
||||
onBack: () => void;
|
||||
}
|
||||
|
||||
const AssetManagementSection: React.FC<AssetManagementSectionProps> = ({ onBack }) => {
|
||||
return (
|
||||
<div className="flex w-full h-screen bg-[#002224] text-white overflow-hidden">
|
||||
<Sidebar />
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<AssetManagementContent onBack={onBack} onNext={() => {}} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AssetManagementSection;
|
||||
@@ -409,14 +409,14 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
|
||||
return (
|
||||
<main className="comp2-page">
|
||||
<div className="comp2-header">
|
||||
{/* <div className="comp2-header">
|
||||
<button onClick={onBack} className="comp2-back-btn">
|
||||
<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>{t('completion.back')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="comp2-title-row">
|
||||
<h1 className="comp2-page-title">{t('completion.contentComplete')}</h1>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { crawlUrl, autocomplete, marketingAnalysis, AutocompleteRequest, getUser
|
||||
import { useTutorial } from '../../components/Tutorial/useTutorial';
|
||||
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
|
||||
import TutorialOverlay, { TutorialRestartPopup } from '../../components/Tutorial/TutorialOverlay';
|
||||
import WizardStepper from '../../components/WizardStepper';
|
||||
|
||||
const WIZARD_STEP_KEY = 'castad_wizard_step';
|
||||
const ACTIVE_ITEM_KEY = 'castad_active_item';
|
||||
@@ -288,19 +289,6 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
// 테스트용 랜덤 m_id 생성 (99 ~ 300)
|
||||
const generateRandomMId = (): number => {
|
||||
return Math.floor(Math.random() * (300 - 99 + 1)) + 99;
|
||||
};
|
||||
|
||||
// 테스트 데이터로 브랜드 분석 페이지 이동
|
||||
const handleTestData = (data: CrawlingResponse) => {
|
||||
const tagged = { ...data, m_id: generateRandomMId(), _isTestData: true };
|
||||
setAnalysisData(tagged);
|
||||
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(tagged));
|
||||
goToWizardStep(0); // 브랜드 분석 결과로
|
||||
};
|
||||
|
||||
// 언어 변경 시 테스트 데이터 다시 로드
|
||||
useEffect(() => {
|
||||
const saved = localStorage.getItem(ANALYSIS_DATA_KEY);
|
||||
@@ -439,7 +427,6 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
onAnalyze={handleStartAnalysis}
|
||||
onAutocomplete={handleAutocomplete}
|
||||
onManualInput={handleManualInput}
|
||||
onTestData={handleTestData}
|
||||
error={analysisError}
|
||||
/>
|
||||
);
|
||||
@@ -496,6 +483,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
businessInfo={currentBusinessInfo}
|
||||
imageTaskId={imageTaskId}
|
||||
mId={analysisData?.m_id ?? 0}
|
||||
bizType={analysisData?.biz_type ?? 'place'}
|
||||
videoGenerationStatus={videoGenerationStatus}
|
||||
videoGenerationProgress={videoGenerationProgress}
|
||||
onGoToPayment={handleGoToPayment}
|
||||
@@ -551,12 +539,22 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
||||
case '내 정보':
|
||||
return <MyInfoContent initialTab={myInfoInitialTab} />;
|
||||
case '새 프로젝트 만들기':
|
||||
// 브랜드 분석(0)과 로딩(-1)은 전체 화면으로 표시
|
||||
if (wizardStep === 0 || wizardStep === -1) {
|
||||
// 로딩(-1), URL 입력(-2)은 스텝퍼 없이 전체 화면으로 표시
|
||||
if (wizardStep === -1 || wizardStep === -2) {
|
||||
return renderWizardContent();
|
||||
}
|
||||
// 브랜드 분석(0)은 전체 화면 스크롤이지만 스텝퍼는 표시
|
||||
if (wizardStep === 0) {
|
||||
return (
|
||||
<>
|
||||
<WizardStepper currentStep={wizardStep} />
|
||||
{renderWizardContent()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="wizard-page-container">
|
||||
<WizardStepper currentStep={wizardStep} />
|
||||
{renderWizardContent()}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { generateLyric, waitForLyricComplete, generateSong, waitForSongComplete } from '../../utils/api';
|
||||
import { generateLyric, waitForLyricComplete, generateSong, waitForSongComplete, downloadSong } from '../../utils/api';
|
||||
import { LANGUAGE_MAP } from '../../types/api';
|
||||
|
||||
interface BusinessInfo {
|
||||
@@ -16,6 +16,7 @@ interface SoundStudioContentProps {
|
||||
businessInfo?: BusinessInfo;
|
||||
imageTaskId: string | null;
|
||||
mId: number;
|
||||
bizType?: string;
|
||||
onStatusChange?: (status: string) => void;
|
||||
videoGenerationStatus?: 'idle' | 'generating' | 'complete' | 'error';
|
||||
videoGenerationProgress?: number;
|
||||
@@ -26,6 +27,10 @@ type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polli
|
||||
|
||||
const MAX_RETRY_COUNT = 3;
|
||||
|
||||
// 생성 완료된 곡 상태를 새로고침 후에도 복원하기 위한 키
|
||||
// GenerationFlow의 clearAllProjectStorage가 이 키를 포함해 정리함
|
||||
const SONG_GENERATION_KEY = 'castad_song_generation';
|
||||
|
||||
const sanitizeError = (message: string, fallback: string): string => {
|
||||
if (
|
||||
message.includes('Traceback') ||
|
||||
@@ -54,6 +59,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
businessInfo,
|
||||
imageTaskId,
|
||||
mId,
|
||||
bizType = 'place',
|
||||
onStatusChange,
|
||||
videoGenerationStatus = 'idle',
|
||||
videoGenerationProgress = 0,
|
||||
@@ -89,6 +95,41 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
localStorage.setItem('castad_song_completion', JSON.stringify(completionData));
|
||||
};
|
||||
|
||||
// 새로고침 후 생성 완료된 곡 상태 복원
|
||||
useEffect(() => {
|
||||
const saved = localStorage.getItem(SONG_GENERATION_KEY);
|
||||
if (!saved) return;
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(saved);
|
||||
if (parsed.status !== 'complete' || !parsed.audioUrl || !parsed.songTaskId) return;
|
||||
|
||||
// 저장된 URL로 일단 복원 후, 서버에서 최신 URL 재조회 시도
|
||||
setSongTaskId(parsed.songTaskId);
|
||||
setAudioUrl(parsed.audioUrl);
|
||||
setLyrics(parsed.lyrics ?? '');
|
||||
setStatus('complete');
|
||||
|
||||
// downloadSong으로 최신 URL을 재조회해 갱신 (만료 방지)
|
||||
downloadSong(parsed.songTaskId)
|
||||
.then((res) => {
|
||||
if (res.success && res.song_result_url) {
|
||||
setAudioUrl(res.song_result_url);
|
||||
// 저장값도 갱신
|
||||
localStorage.setItem(SONG_GENERATION_KEY, JSON.stringify({
|
||||
...parsed,
|
||||
audioUrl: res.song_result_url,
|
||||
}));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 재조회 실패 시 저장된 URL 그대로 사용
|
||||
});
|
||||
} catch {
|
||||
// 파싱 실패 시 무시
|
||||
}
|
||||
}, []); // 마운트 1회만 실행
|
||||
|
||||
// Close language dropdown when clicking outside
|
||||
// Auto-navigate to next page when video generation is complete
|
||||
useEffect(() => {
|
||||
@@ -128,6 +169,18 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
setStatusMessage('');
|
||||
setRetryCount(0);
|
||||
|
||||
// 새로고침 후에도 복원할 수 있도록 완료된 곡 상태를 저장
|
||||
try {
|
||||
localStorage.setItem(SONG_GENERATION_KEY, JSON.stringify({
|
||||
audioUrl: statusResponse.song_result_url,
|
||||
songTaskId: taskId,
|
||||
lyrics: currentLyrics,
|
||||
status: 'complete',
|
||||
}));
|
||||
} catch {
|
||||
// localStorage 쓰기 실패는 무시
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Polling failed:', error);
|
||||
|
||||
@@ -286,6 +339,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
// 새 곡 생성 시작 — 이전에 저장된 완료 곡 제거
|
||||
localStorage.removeItem(SONG_GENERATION_KEY);
|
||||
|
||||
setStatus('generating_lyric');
|
||||
setErrorMessage(null);
|
||||
setStatusMessage(t('soundStudio.generatingLyrics'));
|
||||
@@ -306,6 +362,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
m_id: mId,
|
||||
region: businessInfo.region,
|
||||
task_id: imageTaskId,
|
||||
biz_type: bizType,
|
||||
orientation,
|
||||
...(isInstrumental && { instrumental: true }),
|
||||
});
|
||||
|
||||
@@ -1,43 +1,18 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import React from 'react';
|
||||
import { AutocompleteRequest } from '../../utils/api';
|
||||
import { CrawlingResponse } from '../../types/api';
|
||||
import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
||||
|
||||
// 환경변수에서 테스트 모드 확인
|
||||
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
||||
|
||||
interface UrlInputContentProps {
|
||||
onAnalyze: (value: string, type?: SearchType) => void;
|
||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||
onManualInput?: (businessName: string, address: string) => void;
|
||||
onTestData?: (data: CrawlingResponse) => void;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomplete, onManualInput, onTestData, error }) => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [isLoadingTest, setIsLoadingTest] = useState(false);
|
||||
|
||||
const handleTestData = async () => {
|
||||
if (!onTestData) return;
|
||||
setIsLoadingTest(true);
|
||||
try {
|
||||
const jsonFile = i18n.language === 'en' ? '/example_analysis_en.json' : '/example_analysis.json';
|
||||
const response = await fetch(jsonFile);
|
||||
const data: CrawlingResponse = await response.json();
|
||||
onTestData(data);
|
||||
} catch (err) {
|
||||
console.error('테스트 데이터 로드 실패:', err);
|
||||
} finally {
|
||||
setIsLoadingTest(false);
|
||||
}
|
||||
};
|
||||
|
||||
const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomplete, onManualInput, error }) => {
|
||||
return (
|
||||
<div className="url-input-container">
|
||||
<div className="url-input-content">
|
||||
{/* 로고 */}
|
||||
<div className="url-input-logo">
|
||||
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||
</div>
|
||||
@@ -49,17 +24,6 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
|
||||
error={error}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 테스트 버튼 (VITE_IS_TESTPAGE=true일 때만 표시) */}
|
||||
{isTestPage && onTestData && (
|
||||
<button
|
||||
onClick={handleTestData}
|
||||
disabled={isLoadingTest}
|
||||
className="test-data-button"
|
||||
>
|
||||
{isLoadingTest ? t('urlInput.testDataLoading') : t('urlInput.testData')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user