인디케이터 추가 및 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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AutocompleteRequest, isLoggedIn } from '../../utils/api';
|
||||
import { CrawlingResponse } from '../../types/api';
|
||||
import { useTutorial } from '../../components/Tutorial/useTutorial';
|
||||
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
|
||||
import TutorialOverlay from '../../components/Tutorial/TutorialOverlay';
|
||||
@@ -11,9 +10,6 @@ import LoginPromptModal from '../../components/LoginPromptModal';
|
||||
import SearchInputForm from '../../components/SearchInputForm';
|
||||
import { SearchType } from '../../components/SearchInputForm';
|
||||
|
||||
// 환경변수에서 테스트 모드 확인
|
||||
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
||||
|
||||
// Orb configuration with movement zones to prevent overlap
|
||||
interface OrbConfig {
|
||||
id: string;
|
||||
@@ -40,18 +36,15 @@ interface HeroSectionProps {
|
||||
onAnalyze?: (value: string, type?: SearchType) => void;
|
||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||
onManualInput?: (businessName: string, address: string) => void;
|
||||
onTestData?: (data: CrawlingResponse) => void;
|
||||
onNext?: () => void;
|
||||
error?: string | null;
|
||||
scrollProgress?: number;
|
||||
}
|
||||
|
||||
const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, onManualInput, onTestData, onNext, error: externalError, scrollProgress = 0 }) => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, onManualInput, onNext, error: externalError, scrollProgress = 0 }) => {
|
||||
const { t } = useTranslation();
|
||||
const [isManualModalOpen, setIsManualModalOpen] = useState(false);
|
||||
const [isLoginPromptOpen, setIsLoginPromptOpen] = useState(false);
|
||||
const [testError, setTestError] = useState('');
|
||||
const [isLoadingTest, setIsLoadingTest] = useState(false);
|
||||
const orbRefs = useRef<(HTMLDivElement | null)[]>([]);
|
||||
const animationRefs = useRef<number[]>([]);
|
||||
const tutorial = useTutorial();
|
||||
@@ -66,22 +59,6 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 테스트 데이터 로드 핸들러
|
||||
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 {
|
||||
setTestError(t('landing.hero.testDataLoadFailed'));
|
||||
} finally {
|
||||
setIsLoadingTest(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Orb 랜덤 이동 애니메이션
|
||||
useEffect(() => {
|
||||
const moveOrb = (orb: HTMLDivElement, index: number) => {
|
||||
@@ -179,7 +156,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
||||
setIsLoginPromptOpen(true);
|
||||
}
|
||||
}}
|
||||
error={externalError || testError || null}
|
||||
error={externalError || null}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -193,13 +170,6 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{/* 테스트 버튼 */}
|
||||
{isTestPage && onTestData && (
|
||||
<button onClick={handleTestData} disabled={isLoadingTest} className="test-data-button">
|
||||
{isLoadingTest ? t('landing.hero.testDataLoading') : t('landing.hero.testData')}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{tutorial.isActive && !isManualModalOpen && (
|
||||
<TutorialOverlay
|
||||
hints={tutorial.hints}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const SocialConnectError: React.FC = () => {
|
||||
// URL 파라미터 파싱
|
||||
const { t } = useTranslation();
|
||||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const platform = searchParams.get('platform') || 'unknown';
|
||||
const errorMessage = searchParams.get('error') || '알 수 없는 오류가 발생했습니다.';
|
||||
const errorMessage = searchParams.get('error') || t('social.connectError.defaultError');
|
||||
|
||||
const platformName = platform === 'youtube' ? 'YouTube' :
|
||||
platform === 'instagram' ? 'Instagram' :
|
||||
@@ -25,19 +27,19 @@ const SocialConnectError: React.FC = () => {
|
||||
<line x1="9" y1="9" x2="15" y2="15" />
|
||||
</svg>
|
||||
</div>
|
||||
<h1 className="social-connect-title">{platformName} 연결 실패</h1>
|
||||
<h1 className="social-connect-title">{t('social.connectError.title', { platform: platformName })}</h1>
|
||||
<p className="social-connect-message">
|
||||
{errorMessage}
|
||||
</p>
|
||||
<p className="social-connect-detail">
|
||||
다시 시도해주세요. 문제가 지속되면 고객 지원에 문의해주세요.
|
||||
{t('social.connectError.detail')}
|
||||
</p>
|
||||
<div className="social-connect-actions">
|
||||
<button
|
||||
onClick={navigateToHome}
|
||||
className="social-connect-button"
|
||||
>
|
||||
다시 시도
|
||||
{t('social.connectError.retry')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
// 연결된 소셜 계정 정보를 저장하는 localStorage 키
|
||||
const SOCIAL_CONNECTED_KEY = 'castad_social_connected';
|
||||
|
||||
interface ConnectedSocialAccount {
|
||||
@@ -13,9 +13,9 @@ interface ConnectedSocialAccount {
|
||||
}
|
||||
|
||||
const SocialConnectSuccess: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const [countdown, setCountdown] = useState(3);
|
||||
|
||||
// URL 파라미터 파싱
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const platform = searchParams.get('platform') || 'unknown';
|
||||
const accountId = searchParams.get('account_id') || '';
|
||||
@@ -26,7 +26,6 @@ const SocialConnectSuccess: React.FC = () => {
|
||||
platform === 'instagram' ? 'Instagram' :
|
||||
platform === 'facebook' ? 'Facebook' : platform;
|
||||
|
||||
// 연결된 계정 정보를 localStorage에 저장
|
||||
useEffect(() => {
|
||||
if (platform && accountId) {
|
||||
const connectedAccount: ConnectedSocialAccount = {
|
||||
@@ -42,7 +41,6 @@ const SocialConnectSuccess: React.FC = () => {
|
||||
}, [platform, accountId, channelName, profileImage]);
|
||||
|
||||
const navigateToHome = () => {
|
||||
// URL을 루트로 변경하고 페이지 새로고침하여 generation_flow로 이동
|
||||
window.location.href = '/';
|
||||
};
|
||||
|
||||
@@ -64,7 +62,6 @@ const SocialConnectSuccess: React.FC = () => {
|
||||
return (
|
||||
<div className="social-connect-page">
|
||||
<div className="social-connect-card success">
|
||||
{/* 프로필 이미지가 있으면 표시 */}
|
||||
{profileImage ? (
|
||||
<img
|
||||
src={profileImage}
|
||||
@@ -81,15 +78,13 @@ const SocialConnectSuccess: React.FC = () => {
|
||||
)}
|
||||
|
||||
<h1 className="social-connect-title">
|
||||
{channelName || platformName} 연결 완료
|
||||
{t('social.connectSuccess.title', { name: channelName || platformName })}
|
||||
</h1>
|
||||
|
||||
<p className="social-connect-message">
|
||||
{channelName ? (
|
||||
<>{platformName} 계정이 성공적으로 연결되었습니다.</>
|
||||
) : (
|
||||
<>계정이 성공적으로 연결되었습니다.</>
|
||||
)}
|
||||
{channelName
|
||||
? t('social.connectSuccess.messageWithChannel', { platform: platformName })
|
||||
: t('social.connectSuccess.messageWithoutChannel')}
|
||||
</p>
|
||||
|
||||
{channelName && (
|
||||
@@ -98,20 +93,20 @@ const SocialConnectSuccess: React.FC = () => {
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<polyline points="20 6 9 17 4 12" />
|
||||
</svg>
|
||||
인증됨
|
||||
{t('social.connectSuccess.verified')}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="social-connect-countdown">
|
||||
{countdown}초 후 자동으로 이동합니다...
|
||||
{t('social.connectSuccess.countdown', { count: countdown })}
|
||||
</p>
|
||||
|
||||
<button
|
||||
onClick={navigateToHome}
|
||||
className="social-connect-button"
|
||||
>
|
||||
지금 이동
|
||||
{t('social.connectSuccess.goNow')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://40.82.133.44';
|
||||
|
||||
const YouTubeOAuthCallback: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const [status, setStatus] = useState<'processing' | 'error'>('processing');
|
||||
const [errorMessage, setErrorMessage] = useState<string>('');
|
||||
|
||||
@@ -18,7 +20,7 @@ const YouTubeOAuthCallback: React.FC = () => {
|
||||
if (error) {
|
||||
console.error('[YouTube OAuth] Error from Google:', error);
|
||||
setStatus('error');
|
||||
setErrorMessage('Google 인증이 취소되었거나 실패했습니다.');
|
||||
setErrorMessage(t('social.youtubeCallback.errorAuthCancelled'));
|
||||
setTimeout(() => {
|
||||
window.location.href = '/social/connect/error?platform=youtube&error=' + encodeURIComponent(error);
|
||||
}, 1500);
|
||||
@@ -28,7 +30,7 @@ const YouTubeOAuthCallback: React.FC = () => {
|
||||
if (!code) {
|
||||
console.error('[YouTube OAuth] No code received');
|
||||
setStatus('error');
|
||||
setErrorMessage('인증 코드를 받지 못했습니다.');
|
||||
setErrorMessage(t('social.youtubeCallback.errorNoCode'));
|
||||
setTimeout(() => {
|
||||
window.location.href = '/social/connect/error?platform=youtube&error=no_code';
|
||||
}, 1500);
|
||||
@@ -46,7 +48,7 @@ const YouTubeOAuthCallback: React.FC = () => {
|
||||
} catch (err) {
|
||||
console.error('[YouTube OAuth] Failed to process callback:', err);
|
||||
setStatus('error');
|
||||
setErrorMessage('YouTube 연결 처리 중 오류가 발생했습니다.');
|
||||
setErrorMessage(t('social.youtubeCallback.errorProcessing'));
|
||||
setTimeout(() => {
|
||||
window.location.href = '/social/connect/error?platform=youtube&error=processing_failed';
|
||||
}, 1500);
|
||||
@@ -66,8 +68,8 @@ const YouTubeOAuthCallback: React.FC = () => {
|
||||
<circle cx="25" cy="25" r="20" fill="none" strokeWidth="4" />
|
||||
</svg>
|
||||
</div>
|
||||
<h1 className="social-connect-title">YouTube 연결 중...</h1>
|
||||
<p className="social-connect-message">잠시만 기다려주세요.</p>
|
||||
<h1 className="social-connect-title">{t('social.youtubeCallback.connecting')}</h1>
|
||||
<p className="social-connect-message">{t('social.youtubeCallback.pleaseWait')}</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -78,7 +80,7 @@ const YouTubeOAuthCallback: React.FC = () => {
|
||||
<line x1="9" y1="9" x2="15" y2="15" />
|
||||
</svg>
|
||||
</div>
|
||||
<h1 className="social-connect-title">연결 실패</h1>
|
||||
<h1 className="social-connect-title">{t('social.youtubeCallback.failed')}</h1>
|
||||
<p className="social-connect-message">{errorMessage}</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user