feat:05/14 UI/기능 변경건 커밋
This commit is contained in:
1 parent
49367756ea
commit
327a50bd41
69 files changed
+1175
-1029
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { motion } from 'motion/react';
|
||||
import { Calendar, Users, MapPin, Phone, Award, Star, Globe, ExternalLink, Building2 } from 'lucide-react';
|
||||
import { Calendar, Users, MapPin, Phone, BadgeCheck, Star, Globe, ExternalLink, Building2 } from 'lucide-react';
|
||||
import { SectionWrapper } from './ui/SectionWrapper';
|
||||
import type { ClinicSnapshot as ClinicSnapshotType } from '@/features/report/types/report';
|
||||
|
||||
@@ -32,54 +32,10 @@ const infoFields = (data: ClinicSnapshotType): InfoField[] => [
|
||||
|
||||
export default function ClinicSnapshot({ data }: ClinicSnapshotProps) {
|
||||
const fields = infoFields(data);
|
||||
const isVerified = data.source === 'registry';
|
||||
|
||||
return (
|
||||
<SectionWrapper id="clinic-snapshot" title="Clinic Overview" subtitle="병원 기본 정보">
|
||||
{/* 외부 검증 배지는 내부 관리용이므로 리포트에서 제외 */}
|
||||
|
||||
{/* Registry 외부 링크 (강남언니, 네이버 플레이스, 구글 맵) */}
|
||||
{isVerified && (data.registryData?.naverPlaceUrl || data.registryData?.gangnamUnniUrl || data.registryData?.googleMapsUrl) && (
|
||||
<motion.div
|
||||
className="flex flex-wrap gap-2 mb-6"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ duration: 0.4, delay: 0.1 }}
|
||||
>
|
||||
{data.registryData?.gangnamUnniUrl && (
|
||||
<a
|
||||
href={data.registryData.gangnamUnniUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg bg-pink-50 border border-pink-200 px-3 py-1.5 text-xs font-medium text-pink-700 hover:bg-pink-100 transition-colors"
|
||||
>
|
||||
강남언니 <ExternalLink size={11} />
|
||||
</a>
|
||||
)}
|
||||
{data.registryData?.naverPlaceUrl && (
|
||||
<a
|
||||
href={data.registryData.naverPlaceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg bg-green-50 border border-green-200 px-3 py-1.5 text-xs font-medium text-green-700 hover:bg-green-100 transition-colors"
|
||||
>
|
||||
네이버 플레이스 <ExternalLink size={11} />
|
||||
</a>
|
||||
)}
|
||||
{data.registryData?.googleMapsUrl && (
|
||||
<a
|
||||
href={data.registryData.googleMapsUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg bg-blue-50 border border-blue-200 px-3 py-1.5 text-xs font-medium text-blue-700 hover:bg-blue-100 transition-colors"
|
||||
>
|
||||
Google Maps <ExternalLink size={11} />
|
||||
</a>
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
|
||||
{fields.map((field, i) => {
|
||||
const Icon = field.icon;
|
||||
return (
|
||||
@@ -127,7 +83,7 @@ export default function ClinicSnapshot({ data }: ClinicSnapshotProps) {
|
||||
transition={{ duration: 0.5, delay: 0.3 }}
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Award size={20} className="text-[#6C5CE7]" />
|
||||
<BadgeCheck size={20} className="text-[#6C5CE7]" />
|
||||
<h3 className="font-serif font-bold text-2xl text-[#0A1128]">대표 원장</h3>
|
||||
</div>
|
||||
<p className="text-xl font-bold text-[#0A1128] mb-1">{data.leadDoctor.name}</p>
|
||||
@@ -173,7 +129,7 @@ export default function ClinicSnapshot({ data }: ClinicSnapshotProps) {
|
||||
key={cert}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-brand-tint-purple border border-brand-tint-lavender px-3 py-1 text-sm font-medium text-brand-purple-muted"
|
||||
>
|
||||
<Award size={12} className="text-brand-purple" />
|
||||
<BadgeCheck size={12} className="text-brand-purple" />
|
||||
{cert}
|
||||
</span>
|
||||
))}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* PdfDownloadButton — 리포트/플랜 PDF 다운로드 버튼.
|
||||
*
|
||||
* 브라우저 네이티브 인쇄 다이얼로그를 띄워 "PDF로 저장" 흐름을 사용합니다.
|
||||
* `@media print` 규칙(`src/styles/custom.css`)이 레이아웃·색상·페이지 분할을 담당하며,
|
||||
* `data-no-print`/`data-report-nav`/`data-plan-nav`/`data-cta-card`/`nav` 요소는
|
||||
* 인쇄에서 자동 제외됩니다.
|
||||
*/
|
||||
import { Download, Loader2 } from 'lucide-react';
|
||||
import { useExportPDF } from '@/features/report/hooks/useExportPDF';
|
||||
|
||||
interface PdfDownloadButtonProps {
|
||||
/** PDF 파일명. 자동으로 .pdf 확장자 붙음. 'Plan' 포함 시 푸터 라벨도 변경 */
|
||||
filename: string;
|
||||
/** 버튼 표시 라벨. 기본: PDF */
|
||||
label?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function PdfDownloadButton({
|
||||
filename,
|
||||
label = 'PDF',
|
||||
className,
|
||||
}: PdfDownloadButtonProps) {
|
||||
const { exportPDF, isExporting } = useExportPDF();
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => exportPDF(filename)}
|
||||
disabled={isExporting}
|
||||
className={
|
||||
className ??
|
||||
'inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full text-xs font-medium text-slate-600 bg-slate-50 border border-slate-200 hover:bg-white hover:border-slate-300 transition-all disabled:opacity-60 disabled:cursor-wait'
|
||||
}
|
||||
title="PDF로 다운로드"
|
||||
>
|
||||
{isExporting ? (
|
||||
<>
|
||||
<Loader2 size={12} className="animate-spin" />
|
||||
생성 중...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Download size={12} />
|
||||
{label}
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -39,13 +39,14 @@ export function ReportNav({ sections, leftSlot, rightSlot }: ReportNavProps) {
|
||||
|
||||
useEffect(() => {
|
||||
const activeTab = tabRefs.current.get(activeId);
|
||||
if (activeTab && navRef.current) {
|
||||
activeTab.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'nearest',
|
||||
inline: 'center',
|
||||
});
|
||||
}
|
||||
const navEl = navRef.current;
|
||||
if (!activeTab || !navEl) return;
|
||||
|
||||
// scrollIntoView 는 sticky 컨테이너에서 세로 스크롤까지 트리거하는 부작용이 있어
|
||||
// (초기 마운트 시 sticky 위치 계산 전 탭의 실제 y 로 페이지를 끌어내림 → 첫 섹션 점프)
|
||||
// 가로 스크롤만 직접 제어합니다.
|
||||
const targetLeft = activeTab.offsetLeft - (navEl.clientWidth - activeTab.offsetWidth) / 2;
|
||||
navEl.scrollTo({ left: targetLeft, behavior: 'smooth' });
|
||||
}, [activeId]);
|
||||
|
||||
const handleClick = (id: string) => {
|
||||
@@ -61,7 +62,7 @@ export function ReportNav({ sections, leftSlot, rightSlot }: ReportNavProps) {
|
||||
<nav data-report-nav className="sticky top-20 z-40 bg-white/95 border-b border-slate-100">
|
||||
<PageContainer className="px-0 flex items-center gap-3">
|
||||
{leftSlot && (
|
||||
<div className="shrink-0 pl-4 md:pl-6" data-no-print>
|
||||
<div className="shrink-0 pl-4 md:pl-6 pt-2" data-no-print>
|
||||
{leftSlot}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { motion } from 'motion/react';
|
||||
import { Youtube, Users, Video, Eye, TrendingUp, ExternalLink, ListVideo } from 'lucide-react';
|
||||
import { Youtube, Users, Video, Eye, TrendingUp, ExternalLink, Play } from 'lucide-react';
|
||||
import { SectionWrapper } from './ui/SectionWrapper';
|
||||
import { EmptyState } from './ui/EmptyState';
|
||||
import { MetricCard } from './ui/MetricCard';
|
||||
@@ -125,7 +125,7 @@ export default function YouTubeAudit({ data }: YouTubeAuditProps) {
|
||||
key={pl}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-rose-50 border border-rose-200 px-3 py-1 text-sm font-medium text-rose-700"
|
||||
>
|
||||
<ListVideo size={12} className="text-rose-500" />
|
||||
<Play size={12} className="text-rose-500 fill-rose-500" />
|
||||
{pl}
|
||||
</span>
|
||||
))}
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useNavigate, useLocation, useParams } from 'react-router';
|
||||
import { useCreateClinic } from '@/shared/api/generated/clinics/clinics';
|
||||
import { useStartAnalysis, getAnalysisStatus } from '@/shared/api/generated/analyses/analyses';
|
||||
import { getReport } from '@/shared/api/generated/reports/reports';
|
||||
|
||||
export type ManualChannels = {
|
||||
instagram?: string;
|
||||
youtube?: string;
|
||||
facebook?: string;
|
||||
naverBlog?: string;
|
||||
gangnamUnni?: string;
|
||||
};
|
||||
|
||||
export type Phase =
|
||||
| 'resuming'
|
||||
| 'discovering'
|
||||
| 'collecting'
|
||||
| 'generating'
|
||||
| 'planning'
|
||||
| 'complete';
|
||||
|
||||
const SESSION_KEYS = {
|
||||
reportId: 'infinith_reportId',
|
||||
clinicId: 'infinith_clinicId',
|
||||
runId: 'infinith_runId',
|
||||
url: 'infinith_url',
|
||||
};
|
||||
|
||||
function saveSession(data: { reportId: string; clinicId?: string; runId?: string; url?: string }) {
|
||||
sessionStorage.setItem(SESSION_KEYS.reportId, data.reportId);
|
||||
if (data.clinicId) sessionStorage.setItem(SESSION_KEYS.clinicId, data.clinicId);
|
||||
if (data.runId) sessionStorage.setItem(SESSION_KEYS.runId, data.runId);
|
||||
if (data.url) sessionStorage.setItem(SESSION_KEYS.url, data.url);
|
||||
}
|
||||
|
||||
function loadSession() {
|
||||
return {
|
||||
reportId: sessionStorage.getItem(SESSION_KEYS.reportId),
|
||||
clinicId: sessionStorage.getItem(SESSION_KEYS.clinicId),
|
||||
runId: sessionStorage.getItem(SESSION_KEYS.runId),
|
||||
url: sessionStorage.getItem(SESSION_KEYS.url),
|
||||
};
|
||||
}
|
||||
|
||||
function clearSession() {
|
||||
Object.values(SESSION_KEYS).forEach((k) => sessionStorage.removeItem(k));
|
||||
}
|
||||
|
||||
// 백엔드 AnalysisStatus enum: discovering | collecting | analyzing | completed | failed
|
||||
// UI Phase 스텝과 매핑
|
||||
function phaseFromStatus(s: string): Phase {
|
||||
if (s === 'discovering') return 'collecting';
|
||||
if (s === 'collecting') return 'generating';
|
||||
if (s === 'analyzing') return 'planning';
|
||||
if (s === 'completed') return 'complete';
|
||||
return 'discovering';
|
||||
}
|
||||
|
||||
function resumePhaseFromStatus(s: string): Phase {
|
||||
if (s === 'discovering') return 'collecting';
|
||||
if (s === 'collecting') return 'generating';
|
||||
if (s === 'analyzing') return 'planning';
|
||||
return 'discovering';
|
||||
}
|
||||
|
||||
interface UseAnalysisPipelineResult {
|
||||
phase: Phase;
|
||||
error: string | null;
|
||||
errorCode: string | null;
|
||||
errorDomain: string | null;
|
||||
errorDetails: Record<string, string> | null;
|
||||
url: string | undefined;
|
||||
sessionUrl: string | null;
|
||||
handleRetry: () => void;
|
||||
handleAbort: () => void;
|
||||
}
|
||||
|
||||
export function useAnalysisPipeline(): UseAnalysisPipelineResult {
|
||||
const [phase, setPhase] = useState<Phase>('discovering');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [errorCode, setErrorCode] = useState<string | null>(null);
|
||||
const [errorDomain, setErrorDomain] = useState<string | null>(null);
|
||||
const [errorDetails, setErrorDetails] = useState<Record<string, string> | null>(null);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { reportId: urlReportId } = useParams<{ reportId?: string }>();
|
||||
|
||||
const locState = (location.state as { url?: string; manualChannels?: ManualChannels }) ?? {};
|
||||
const url = locState.url;
|
||||
const manualChannels = locState.manualChannels;
|
||||
|
||||
const hasStarted = useRef(false);
|
||||
const { mutateAsync: createClinicAsync } = useCreateClinic();
|
||||
const { mutateAsync: startAnalysisAsync } = useStartAnalysis();
|
||||
|
||||
const runPipeline = useCallback(
|
||||
async (
|
||||
startUrl?: string,
|
||||
resumeFrom?: { reportId: string; clinicId?: string; runId?: string; phase: Phase },
|
||||
) => {
|
||||
try {
|
||||
let reportId = resumeFrom?.reportId || '';
|
||||
let clinicId = resumeFrom?.clinicId;
|
||||
let runId = resumeFrom?.runId;
|
||||
|
||||
// Phase 1: 신규 분석이면 createClinic → startAnalysis
|
||||
if (!resumeFrom?.runId) {
|
||||
if (!startUrl) throw new Error('No URL provided');
|
||||
setPhase('discovering');
|
||||
|
||||
// 1-a) 클리닉 등록
|
||||
const clinicRes = await createClinicAsync({ data: { url: startUrl } });
|
||||
if (clinicRes.status !== 201) throw new Error('병원 등록에 실패했습니다.');
|
||||
clinicId = clinicRes.data.id;
|
||||
|
||||
// 1-b) 분석 시작
|
||||
const startRes = await startAnalysisAsync({
|
||||
data: {
|
||||
clinic_id: clinicId,
|
||||
channels: {
|
||||
youtube: manualChannels?.youtube ?? null,
|
||||
instagram: manualChannels?.instagram ?? null,
|
||||
facebook: manualChannels?.facebook ?? null,
|
||||
naver_blog: manualChannels?.naverBlog ?? null,
|
||||
gangnam_unni: manualChannels?.gangnamUnni ?? null,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (startRes.status !== 202) throw new Error('분석 시작에 실패했습니다.');
|
||||
runId = startRes.data.analysis_run_id;
|
||||
reportId = runId; // 백엔드: analysis_run_id 가 report 조회 키와 동일
|
||||
|
||||
saveSession({ reportId, clinicId, runId, url: startUrl });
|
||||
window.history.replaceState(null, '', `/report/loading/${reportId}`);
|
||||
}
|
||||
|
||||
if (!runId) throw new Error('runId 없음');
|
||||
|
||||
// Phase 2-4: 상태 폴링 (1.5초 간격, 최대 ~3분)
|
||||
const maxAttempts = 120;
|
||||
let attempts = 0;
|
||||
while (attempts < maxAttempts) {
|
||||
attempts++;
|
||||
const statusRes = await getAnalysisStatus(runId);
|
||||
if (statusRes.status !== 200) throw new Error('분석 상태 조회에 실패했습니다.');
|
||||
const statusData = statusRes.data;
|
||||
setPhase(phaseFromStatus(statusData.status));
|
||||
if (statusData.channel_errors && Object.keys(statusData.channel_errors).length > 0) {
|
||||
console.warn('[pipeline] Partial failures:', statusData.channel_errors);
|
||||
}
|
||||
if (statusData.status === 'completed') break;
|
||||
if (statusData.status === 'failed') {
|
||||
throw new Error('파이프라인 실패: failed');
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
}
|
||||
|
||||
setPhase('complete');
|
||||
clearSession();
|
||||
|
||||
// 최종 리포트 조회 (best effort)
|
||||
const reportRes = await getReport(reportId).catch(() => null);
|
||||
const reportPayload = reportRes && reportRes.status === 200 ? reportRes.data : null;
|
||||
setTimeout(() => {
|
||||
navigate(`/report/${reportId}`, {
|
||||
replace: true,
|
||||
state: reportPayload
|
||||
? {
|
||||
report: reportPayload,
|
||||
metadata: {
|
||||
url: startUrl,
|
||||
clinicName: '',
|
||||
generatedAt: new Date().toISOString(),
|
||||
},
|
||||
reportId,
|
||||
clinicId,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
}, 800);
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : 'An error occurred';
|
||||
setError(msg);
|
||||
if (err && typeof err === 'object' && 'code' in err) {
|
||||
setErrorCode((err as { code?: string }).code || null);
|
||||
}
|
||||
if (err && typeof err === 'object' && 'domain' in err) {
|
||||
setErrorDomain((err as { domain?: string }).domain || null);
|
||||
}
|
||||
}
|
||||
},
|
||||
[navigate, manualChannels, createClinicAsync, startAnalysisAsync],
|
||||
);
|
||||
|
||||
const handleRetry = useCallback(() => {
|
||||
setError(null);
|
||||
setErrorDetails(null);
|
||||
const session = loadSession();
|
||||
if (session.reportId) {
|
||||
runPipeline(undefined, {
|
||||
reportId: session.reportId,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId: session.runId || undefined,
|
||||
phase,
|
||||
});
|
||||
} else if (url || session.url) {
|
||||
hasStarted.current = false;
|
||||
runPipeline(url || session.url || undefined);
|
||||
}
|
||||
}, [phase, url, runPipeline]);
|
||||
|
||||
const handleAbort = useCallback(() => {
|
||||
clearSession();
|
||||
navigate('/', { replace: true });
|
||||
}, [navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasStarted.current) return;
|
||||
hasStarted.current = true;
|
||||
|
||||
// 1. URL 파라미터 resume (예: /report/loading/abc-123)
|
||||
if (urlReportId) {
|
||||
setPhase('resuming');
|
||||
const session = loadSession();
|
||||
const runId = session.runId || urlReportId;
|
||||
getAnalysisStatus(runId)
|
||||
.then((res) => {
|
||||
if (res.status !== 200) throw new Error('status fetch failed');
|
||||
const status = res.data;
|
||||
if (status.status === 'completed') {
|
||||
navigate(`/report/${urlReportId}`, { replace: true });
|
||||
return;
|
||||
}
|
||||
if (status.status === 'failed') {
|
||||
setError('Data collection failed. Please retry.');
|
||||
setPhase('collecting');
|
||||
return;
|
||||
}
|
||||
saveSession({
|
||||
reportId: urlReportId,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId,
|
||||
url: session.url || undefined,
|
||||
});
|
||||
runPipeline(undefined, {
|
||||
reportId: urlReportId,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId,
|
||||
phase: resumePhaseFromStatus(status.status),
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
setError('Could not resume analysis. Please try again.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. sessionStorage resume
|
||||
const session = loadSession();
|
||||
if (session.reportId && !url) {
|
||||
setPhase('resuming');
|
||||
const runId = session.runId || session.reportId;
|
||||
getAnalysisStatus(runId)
|
||||
.then((res) => {
|
||||
if (res.status !== 200) throw new Error('status fetch failed');
|
||||
const status = res.data;
|
||||
if (status.status === 'completed') {
|
||||
clearSession();
|
||||
navigate(`/report/${session.reportId}`, { replace: true });
|
||||
return;
|
||||
}
|
||||
runPipeline(undefined, {
|
||||
reportId: session.reportId!,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId,
|
||||
phase: resumePhaseFromStatus(status.status),
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
clearSession();
|
||||
navigate('/', { replace: true });
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. URL 없이 진입 → 홈으로
|
||||
if (!url) {
|
||||
navigate('/', { replace: true });
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. 신규 분석 시작
|
||||
runPipeline(url);
|
||||
}, [url, urlReportId, navigate, runPipeline]);
|
||||
|
||||
return {
|
||||
phase,
|
||||
error,
|
||||
errorCode,
|
||||
errorDomain,
|
||||
errorDetails,
|
||||
url,
|
||||
sessionUrl: loadSession().url,
|
||||
handleRetry,
|
||||
handleAbort,
|
||||
};
|
||||
}
|
||||
@@ -40,6 +40,8 @@ interface UseReportResult {
|
||||
isEnriched: boolean;
|
||||
/** DB 또는 API 메타데이터에서 복원한 정규화된 소셜 핸들 */
|
||||
socialHandles: Record<string, string | null> | null;
|
||||
/** DB row의 clinic_id (FK). 게스트 페이지에서 워크스페이스 점프 버튼 노출에 사용 */
|
||||
clinicId: string | null;
|
||||
}
|
||||
|
||||
interface LocationState {
|
||||
@@ -61,6 +63,7 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isEnriched, setIsEnriched] = useState(false);
|
||||
const [socialHandles, setSocialHandles] = useState<Record<string, string | null> | null>(null);
|
||||
const [clinicId, setClinicId] = useState<string | null>(null);
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -69,11 +72,13 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
setData(DEMO_REPORTS[id]);
|
||||
setIsEnriched(true);
|
||||
setSocialHandles(DEMO_HANDLES[id] ?? null);
|
||||
setClinicId(null); // 데모는 워크스페이스 연결 없음
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const state = location.state as LocationState | undefined;
|
||||
const stateClinicId = (state as Record<string, unknown> | undefined)?.clinicId as string | undefined;
|
||||
|
||||
// Source 1: 네비게이션 state로 전달된 리포트 데이터 (AnalysisLoadingPage에서)
|
||||
if (state?.report && state?.metadata) {
|
||||
@@ -84,6 +89,7 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
state.report,
|
||||
state.metadata,
|
||||
);
|
||||
setClinicId(stateClinicId ?? null);
|
||||
// V2 파이프라인: 리포트에 Phase 2의 channelEnrichment 이미 포함됨
|
||||
const enrichment = state.report.channelEnrichment as EnrichmentData | undefined;
|
||||
if (enrichment) {
|
||||
@@ -112,6 +118,7 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
}
|
||||
const row = res.data as unknown as Record<string, unknown>;
|
||||
const reportJson = (row.report as Record<string, unknown>) || row;
|
||||
setClinicId((row.clinic_id as string) || stateClinicId || null);
|
||||
|
||||
// V2 파이프라인: 리포트가 비어있지만 status가 'complete'가 아니면 메시지 표시
|
||||
if (!reportJson || Object.keys(reportJson).length === 0 || reportJson.parseError) {
|
||||
@@ -191,5 +198,5 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
setIsLoading(false);
|
||||
}, [id, location.state]);
|
||||
|
||||
return { data, isLoading, error, isEnriched, socialHandles };
|
||||
return { data, isLoading, error, isEnriched, socialHandles, clinicId };
|
||||
}
|
||||
@@ -15,6 +15,8 @@ interface UseReportPageDataResult {
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
enrichStatus: ReturnType<typeof useEnrichment>['status'];
|
||||
/** DB row 의 clinic_id — 게스트 페이지에서 워크스페이스 점프 버튼 노출에 사용 */
|
||||
clinicId: string | null;
|
||||
}
|
||||
|
||||
export function useReportPageData(id: string | undefined): UseReportPageDataResult {
|
||||
@@ -25,6 +27,7 @@ export function useReportPageData(id: string | undefined): UseReportPageDataResu
|
||||
error,
|
||||
isEnriched,
|
||||
socialHandles: dbSocialHandles,
|
||||
clinicId,
|
||||
} = useReport(id);
|
||||
|
||||
const enrichmentParams = useMemo(() => {
|
||||
@@ -62,5 +65,6 @@ export function useReportPageData(id: string | undefined): UseReportPageDataResu
|
||||
isLoading,
|
||||
error,
|
||||
enrichStatus,
|
||||
clinicId,
|
||||
};
|
||||
}
|
||||
@@ -1,266 +1,31 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useNavigate, useLocation, useParams } from 'react-router';
|
||||
import { motion } from 'motion/react';
|
||||
import { Check, AlertCircle, RefreshCw, ShieldX } from 'lucide-react';
|
||||
import { useStartAnalysis, getAnalysisStatus } from '@/shared/api/generated/analyses/analyses';
|
||||
import { getReport } from '@/shared/api/generated/reports/reports';
|
||||
import { useAnalysisPipeline, type Phase } from '../hooks/useAnalysisPipeline';
|
||||
|
||||
// 분석 파이프라인은 단일 startAnalysis + 폴링 모델로 통합됨.
|
||||
// 기존의 discoverChannels / collectChannelData / generateReportV2 / generateContentPlan
|
||||
// 단계는 백엔드(FastAPI) 비동기 워커가 수행하므로 여기서는 startAnalysis 1회 호출 후
|
||||
// /api/analyses/{run_id}/status 폴링으로 대체.
|
||||
|
||||
export type ManualChannels = {
|
||||
instagram?: string;
|
||||
youtube?: string;
|
||||
facebook?: string;
|
||||
};
|
||||
|
||||
type Phase = 'resuming' | 'discovering' | 'collecting' | 'generating' | 'planning' | 'complete';
|
||||
|
||||
const PHASE_STEPS = [
|
||||
{ key: 'discovering' as Phase, label: 'Scanning website & discovering channels...', labelDone: 'Channels discovered' },
|
||||
{ key: 'collecting' as Phase, label: 'Collecting channel data & market analysis...', labelDone: 'Data collected' },
|
||||
{ key: 'generating' as Phase, label: 'Generating AI marketing report...', labelDone: 'Report generated' },
|
||||
{ key: 'planning' as Phase, label: 'Generating AI content strategy...', labelDone: 'Content plan generated' },
|
||||
{ key: 'complete' as Phase, label: 'Finalizing report...', labelDone: 'Complete' },
|
||||
const PHASE_STEPS: { key: Phase; label: string; labelDone: string }[] = [
|
||||
{ key: 'discovering', label: 'Scanning website & discovering channels...', labelDone: 'Channels discovered' },
|
||||
{ key: 'collecting', label: 'Collecting channel data & market analysis...', labelDone: 'Data collected' },
|
||||
{ key: 'generating', label: 'Generating AI marketing report...', labelDone: 'Report generated' },
|
||||
{ key: 'planning', label: 'Generating AI content strategy...', labelDone: 'Content plan generated' },
|
||||
{ key: 'complete', label: 'Finalizing report...', labelDone: 'Complete' },
|
||||
];
|
||||
|
||||
// 파이프라인 resume용 세션 키
|
||||
const SESSION_KEYS = {
|
||||
reportId: 'infinith_reportId',
|
||||
clinicId: 'infinith_clinicId',
|
||||
runId: 'infinith_runId',
|
||||
url: 'infinith_url',
|
||||
};
|
||||
|
||||
function saveSession(data: { reportId: string; clinicId?: string; runId?: string; url?: string }) {
|
||||
sessionStorage.setItem(SESSION_KEYS.reportId, data.reportId);
|
||||
if (data.clinicId) sessionStorage.setItem(SESSION_KEYS.clinicId, data.clinicId);
|
||||
if (data.runId) sessionStorage.setItem(SESSION_KEYS.runId, data.runId);
|
||||
if (data.url) sessionStorage.setItem(SESSION_KEYS.url, data.url);
|
||||
}
|
||||
|
||||
function loadSession() {
|
||||
return {
|
||||
reportId: sessionStorage.getItem(SESSION_KEYS.reportId),
|
||||
clinicId: sessionStorage.getItem(SESSION_KEYS.clinicId),
|
||||
runId: sessionStorage.getItem(SESSION_KEYS.runId),
|
||||
url: sessionStorage.getItem(SESSION_KEYS.url),
|
||||
};
|
||||
}
|
||||
|
||||
function clearSession() {
|
||||
Object.values(SESSION_KEYS).forEach(k => sessionStorage.removeItem(k));
|
||||
}
|
||||
|
||||
export default function AnalysisLoadingPage() {
|
||||
const [phase, setPhase] = useState<Phase>('discovering');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [errorCode, setErrorCode] = useState<string | null>(null);
|
||||
const [errorDomain, setErrorDomain] = useState<string | null>(null);
|
||||
const [errorDetails, setErrorDetails] = useState<Record<string, string> | null>(null);
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { reportId: urlReportId } = useParams<{ reportId?: string }>();
|
||||
const locState = (location.state as {
|
||||
url?: string;
|
||||
manualChannels?: ManualChannels;
|
||||
}) ?? {};
|
||||
const url = locState.url;
|
||||
const manualChannels = locState.manualChannels;
|
||||
const hasStarted = useRef(false);
|
||||
const { mutateAsync: startAnalysisAsync } = useStartAnalysis();
|
||||
const {
|
||||
phase,
|
||||
error,
|
||||
errorCode,
|
||||
errorDomain,
|
||||
errorDetails,
|
||||
url,
|
||||
sessionUrl,
|
||||
handleRetry,
|
||||
handleAbort,
|
||||
} = useAnalysisPipeline();
|
||||
|
||||
const phaseIndex = PHASE_STEPS.findIndex(s => s.key === phase);
|
||||
|
||||
const runPipeline = useCallback(async (
|
||||
startUrl?: string,
|
||||
resumeFrom?: { reportId: string; clinicId?: string; runId?: string; phase: Phase },
|
||||
) => {
|
||||
try {
|
||||
let reportId = resumeFrom?.reportId || '';
|
||||
let clinicId = resumeFrom?.clinicId;
|
||||
let runId = resumeFrom?.runId;
|
||||
|
||||
// Phase 1: 백엔드 분석 시작 (기존 runId로 resume 중이면 스킵)
|
||||
if (!resumeFrom?.runId) {
|
||||
if (!startUrl) throw new Error('No URL provided');
|
||||
setPhase('discovering');
|
||||
const startRes = await startAnalysisAsync({
|
||||
data: {
|
||||
url: startUrl,
|
||||
// manualChannels는 백엔드에서 verified_channels로 주입
|
||||
manual_channels: manualChannels,
|
||||
} as unknown as Parameters<typeof startAnalysisAsync>[0]['data'],
|
||||
});
|
||||
if (startRes.status !== 202) {
|
||||
throw new Error('분석 시작에 실패했습니다.');
|
||||
}
|
||||
const startData = startRes.data as unknown as { run_id?: string; report_id?: string; clinic_id?: string };
|
||||
runId = startData.run_id || '';
|
||||
reportId = startData.report_id || runId;
|
||||
clinicId = startData.clinic_id;
|
||||
|
||||
saveSession({ reportId, clinicId, runId, url: startUrl });
|
||||
window.history.replaceState(null, '', `/report/loading/${reportId}`);
|
||||
}
|
||||
|
||||
if (!runId) throw new Error('runId 없음');
|
||||
|
||||
// Phase 2-4: 완료될 때까지 상태 폴링
|
||||
const phaseFromStatus = (s: string): Phase => {
|
||||
if (['discovering', 'discovered'].includes(s)) return 'collecting';
|
||||
if (['collecting', 'collected', 'partial'].includes(s)) return 'generating';
|
||||
if (['generating'].includes(s)) return 'planning';
|
||||
if (['complete'].includes(s)) return 'complete';
|
||||
return 'discovering';
|
||||
};
|
||||
|
||||
// backoff 적용 폴링 루프
|
||||
const maxAttempts = 120; // ~2분
|
||||
let attempts = 0;
|
||||
while (attempts < maxAttempts) {
|
||||
attempts++;
|
||||
const statusRes = await getAnalysisStatus(runId);
|
||||
if (statusRes.status !== 200) {
|
||||
throw new Error('분석 상태 조회에 실패했습니다.');
|
||||
}
|
||||
const statusData = statusRes.data as unknown as { status: string; channel_errors?: Record<string, string> };
|
||||
const next = phaseFromStatus(statusData.status);
|
||||
setPhase(next);
|
||||
if (statusData.channel_errors && Object.keys(statusData.channel_errors).length > 0) {
|
||||
console.warn('[pipeline] Partial failures:', statusData.channel_errors);
|
||||
}
|
||||
if (statusData.status === 'complete') break;
|
||||
if (statusData.status === 'failed' || statusData.status === 'collection_failed') {
|
||||
throw new Error(`파이프라인 실패: ${statusData.status}`);
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
}
|
||||
|
||||
setPhase('complete');
|
||||
clearSession();
|
||||
|
||||
// 최종 리포트 조회 (best effort)
|
||||
const reportRes = await getReport(reportId).catch(() => null);
|
||||
const reportPayload = reportRes && reportRes.status === 200 ? reportRes.data : null;
|
||||
setTimeout(() => {
|
||||
navigate(`/report/${reportId}`, {
|
||||
replace: true,
|
||||
state: reportPayload
|
||||
? { report: reportPayload, metadata: { url: startUrl, clinicName: '', generatedAt: new Date().toISOString() }, reportId, clinicId }
|
||||
: undefined,
|
||||
});
|
||||
}, 800);
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : 'An error occurred';
|
||||
setError(msg);
|
||||
if (err && typeof err === 'object' && 'code' in err) {
|
||||
setErrorCode((err as { code?: string }).code || null);
|
||||
}
|
||||
if (err && typeof err === 'object' && 'domain' in err) {
|
||||
setErrorDomain((err as { domain?: string }).domain || null);
|
||||
}
|
||||
}
|
||||
}, [navigate, manualChannels, startAnalysisAsync]);
|
||||
|
||||
// 현재 실패한 단계부터 재시도
|
||||
const handleRetry = useCallback(() => {
|
||||
setError(null);
|
||||
setErrorDetails(null);
|
||||
const session = loadSession();
|
||||
if (session.reportId) {
|
||||
// 실패한 단계부터 resume
|
||||
runPipeline(undefined, {
|
||||
reportId: session.reportId,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId: session.runId || undefined,
|
||||
phase,
|
||||
});
|
||||
} else if (url || session.url) {
|
||||
// 처음부터 재시작
|
||||
hasStarted.current = false;
|
||||
runPipeline(url || session.url || undefined);
|
||||
}
|
||||
}, [phase, url, runPipeline]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasStarted.current) return;
|
||||
hasStarted.current = true;
|
||||
|
||||
// 1. URL 파라미터 resume 시도 (예: /report/loading/abc-123)
|
||||
if (urlReportId) {
|
||||
setPhase('resuming');
|
||||
const session = loadSession();
|
||||
const runId = session.runId || urlReportId;
|
||||
getAnalysisStatus(runId)
|
||||
.then((res) => {
|
||||
if (res.status !== 200) throw new Error('status fetch failed');
|
||||
const status = res.data as unknown as { status: string };
|
||||
if (status.status === 'complete') {
|
||||
navigate(`/report/${urlReportId}`, { replace: true });
|
||||
return;
|
||||
}
|
||||
if (status.status === 'collection_failed') {
|
||||
setError('Data collection failed. Please retry.');
|
||||
setPhase('collecting');
|
||||
return;
|
||||
}
|
||||
let resumePhase: Phase = 'discovering';
|
||||
if (['discovered', 'discovering'].includes(status.status)) resumePhase = 'collecting';
|
||||
else if (['collecting', 'collected', 'partial'].includes(status.status)) resumePhase = 'generating';
|
||||
saveSession({ reportId: urlReportId, clinicId: session.clinicId || undefined, runId, url: session.url || undefined });
|
||||
runPipeline(undefined, { reportId: urlReportId, clinicId: session.clinicId || undefined, runId, phase: resumePhase });
|
||||
})
|
||||
.catch(() => {
|
||||
setError('Could not resume analysis. Please try again.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. sessionStorage resume 시도
|
||||
const session = loadSession();
|
||||
if (session.reportId && !url) {
|
||||
setPhase('resuming');
|
||||
const runId = session.runId || session.reportId;
|
||||
getAnalysisStatus(runId)
|
||||
.then((res) => {
|
||||
if (res.status !== 200) throw new Error('status fetch failed');
|
||||
const status = res.data as unknown as { status: string };
|
||||
if (status.status === 'complete') {
|
||||
clearSession();
|
||||
navigate(`/report/${session.reportId}`, { replace: true });
|
||||
return;
|
||||
}
|
||||
let resumePhase: Phase = 'discovering';
|
||||
if (['discovered', 'discovering'].includes(status.status)) resumePhase = 'collecting';
|
||||
else if (['collecting', 'collected', 'partial'].includes(status.status)) resumePhase = 'generating';
|
||||
runPipeline(undefined, {
|
||||
reportId: session.reportId!,
|
||||
clinicId: session.clinicId || undefined,
|
||||
runId,
|
||||
phase: resumePhase,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
clearSession();
|
||||
navigate('/', { replace: true });
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. URL로 처음부터 시작
|
||||
if (!url) {
|
||||
navigate('/', { replace: true });
|
||||
return;
|
||||
}
|
||||
|
||||
runPipeline(url);
|
||||
}, [url, urlReportId, navigate, runPipeline]);
|
||||
|
||||
// 'resuming' 상태일 때 phaseIndex 조정
|
||||
const phaseIndex = PHASE_STEPS.findIndex((s) => s.key === phase);
|
||||
const displayPhaseIndex = phase === 'resuming' ? -1 : phaseIndex;
|
||||
const displayUrl = url || sessionUrl;
|
||||
|
||||
return (
|
||||
<div className="relative min-h-screen bg-primary-900 flex flex-col items-center justify-center px-6 overflow-hidden">
|
||||
@@ -282,14 +47,14 @@ export default function AnalysisLoadingPage() {
|
||||
INFINITH
|
||||
</motion.h1>
|
||||
|
||||
{(url || loadSession().url) && (
|
||||
{displayUrl && (
|
||||
<motion.p
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.6, delay: 0.1 }}
|
||||
className="text-purple-300/80 text-sm font-mono mb-12 truncate max-w-full"
|
||||
>
|
||||
{url || loadSession().url}
|
||||
{displayUrl}
|
||||
</motion.p>
|
||||
)}
|
||||
|
||||
@@ -309,7 +74,7 @@ export default function AnalysisLoadingPage() {
|
||||
현재 분석 대상 병원 목록에 포함되지 않은 도메인입니다.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => { clearSession(); navigate('/', { replace: true }); }}
|
||||
onClick={handleAbort}
|
||||
className="px-6 py-2 text-sm font-medium text-white bg-purple-600/30 rounded-lg hover:bg-purple-600/50 transition-colors"
|
||||
>
|
||||
돌아가기
|
||||
@@ -344,7 +109,7 @@ export default function AnalysisLoadingPage() {
|
||||
Retry
|
||||
</button>
|
||||
<button
|
||||
onClick={() => { clearSession(); navigate('/', { replace: true }); }}
|
||||
onClick={handleAbort}
|
||||
className="px-6 py-2 text-sm font-medium text-white bg-white/10 rounded-lg hover:bg-white/20 transition-colors"
|
||||
>
|
||||
Start Over
|
||||
@@ -352,74 +117,73 @@ export default function AnalysisLoadingPage() {
|
||||
</div>
|
||||
</motion.div>
|
||||
)
|
||||
) : phase === 'resuming' ? (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="flex flex-col items-center gap-4 mb-14"
|
||||
>
|
||||
<div className="w-7 h-7 rounded-full border-2 border-purple-400 border-t-transparent animate-spin" />
|
||||
<p className="text-purple-200 text-sm">Resuming analysis...</p>
|
||||
</motion.div>
|
||||
) : (
|
||||
<>
|
||||
{phase === 'resuming' ? (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="flex flex-col items-center gap-4 mb-14"
|
||||
>
|
||||
<div className="w-7 h-7 rounded-full border-2 border-purple-400 border-t-transparent animate-spin" />
|
||||
<p className="text-purple-200 text-sm">Resuming analysis...</p>
|
||||
</motion.div>
|
||||
) : (
|
||||
<>
|
||||
<div className="w-full space-y-5 mb-14">
|
||||
{PHASE_STEPS.map((step, index) => {
|
||||
const isCompleted = displayPhaseIndex > index || (step.key === 'complete' && phase === 'complete');
|
||||
const isActive = displayPhaseIndex === index && phase !== 'complete';
|
||||
<div className="w-full space-y-5 mb-14">
|
||||
{PHASE_STEPS.map((step, index) => {
|
||||
const isCompleted =
|
||||
displayPhaseIndex > index || (step.key === 'complete' && phase === 'complete');
|
||||
const isActive = displayPhaseIndex === index && phase !== 'complete';
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
key={step.key}
|
||||
initial={{ opacity: 0, x: -20 }}
|
||||
animate={{ opacity: isActive || isCompleted ? 1 : 0.3, x: 0 }}
|
||||
transition={{ duration: 0.4, delay: index * 0.15 }}
|
||||
className="flex items-center gap-4"
|
||||
>
|
||||
<div className="w-7 h-7 flex-shrink-0 flex items-center justify-center">
|
||||
{isCompleted ? (
|
||||
<motion.div
|
||||
initial={{ scale: 0 }}
|
||||
animate={{ scale: 1 }}
|
||||
transition={{ type: 'spring', stiffness: 300, damping: 20 }}
|
||||
className="w-7 h-7 rounded-full bg-gradient-to-r from-[#4F1DA1] to-[#6C5CE7] flex items-center justify-center"
|
||||
>
|
||||
<Check className="w-4 h-4 text-white" strokeWidth={3} />
|
||||
</motion.div>
|
||||
) : isActive ? (
|
||||
<div className="w-7 h-7 rounded-full border-2 border-purple-400 border-t-transparent animate-spin" />
|
||||
) : (
|
||||
<div className="w-7 h-7 rounded-full border-2 border-white/10" />
|
||||
)}
|
||||
</div>
|
||||
<span
|
||||
className={`text-base font-sans transition-colors duration-300 ${
|
||||
isCompleted ? 'text-white' : isActive ? 'text-purple-200' : 'text-white/30'
|
||||
}`}
|
||||
>
|
||||
{isCompleted ? step.labelDone : step.label}
|
||||
</span>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="w-full h-2 bg-white/10 rounded-full overflow-hidden">
|
||||
return (
|
||||
<motion.div
|
||||
initial={{ width: '0%' }}
|
||||
animate={{ width: `${((displayPhaseIndex + (phase === 'complete' ? 1 : 0.5)) / PHASE_STEPS.length) * 100}%` }}
|
||||
transition={{ duration: 0.8, ease: 'easeInOut' }}
|
||||
className="h-full bg-gradient-to-r from-[#4F1DA1] to-[#6C5CE7] rounded-full"
|
||||
/>
|
||||
</div>
|
||||
key={step.key}
|
||||
initial={{ opacity: 0, x: -20 }}
|
||||
animate={{ opacity: isActive || isCompleted ? 1 : 0.3, x: 0 }}
|
||||
transition={{ duration: 0.4, delay: index * 0.15 }}
|
||||
className="flex items-center gap-4"
|
||||
>
|
||||
<div className="w-7 h-7 flex-shrink-0 flex items-center justify-center">
|
||||
{isCompleted ? (
|
||||
<motion.div
|
||||
initial={{ scale: 0 }}
|
||||
animate={{ scale: 1 }}
|
||||
transition={{ type: 'spring', stiffness: 300, damping: 20 }}
|
||||
className="w-7 h-7 rounded-full bg-gradient-to-r from-[#4F1DA1] to-[#6C5CE7] flex items-center justify-center"
|
||||
>
|
||||
<Check className="w-4 h-4 text-white" strokeWidth={3} />
|
||||
</motion.div>
|
||||
) : isActive ? (
|
||||
<div className="w-7 h-7 rounded-full border-2 border-purple-400 border-t-transparent animate-spin" />
|
||||
) : (
|
||||
<div className="w-7 h-7 rounded-full border-2 border-white/10" />
|
||||
)}
|
||||
</div>
|
||||
<span
|
||||
className={`text-base font-sans transition-colors duration-300 ${
|
||||
isCompleted ? 'text-white' : isActive ? 'text-purple-200' : 'text-white/30'
|
||||
}`}
|
||||
>
|
||||
{isCompleted ? step.labelDone : step.label}
|
||||
</span>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<p className="text-white/40 text-xs mt-4">
|
||||
AI가 마케팅 데이터를 분석하고 있습니다. 약 1~2분 소요됩니다.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<div className="w-full h-2 bg-white/10 rounded-full overflow-hidden">
|
||||
<motion.div
|
||||
initial={{ width: '0%' }}
|
||||
animate={{
|
||||
width: `${((displayPhaseIndex + (phase === 'complete' ? 1 : 0.5)) / PHASE_STEPS.length) * 100}%`,
|
||||
}}
|
||||
transition={{ duration: 0.8, ease: 'easeInOut' }}
|
||||
className="h-full bg-gradient-to-r from-[#4F1DA1] to-[#6C5CE7] rounded-full"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<p className="text-white/40 text-xs mt-4">
|
||||
AI가 마케팅 데이터를 분석하고 있습니다. 약 1~2분 소요됩니다.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
* 워크스페이스용 액션바는 노출되지 않습니다.
|
||||
*/
|
||||
import { Link, useParams } from 'react-router';
|
||||
import { ArrowRight, Sparkles } from 'lucide-react';
|
||||
import { ArrowRight, ArrowLeft } from 'lucide-react';
|
||||
import { AppIcon } from '@/shared/icons/AppIcon';
|
||||
import { useReportPageData } from '../hooks/useReportPageData';
|
||||
import { ReportNav } from '../components/ReportNav';
|
||||
import { ScreenshotProvider } from '../stores/ScreenshotContext';
|
||||
@@ -46,6 +47,15 @@ export default function GuestReportPage() {
|
||||
<div className="pt-20">
|
||||
<ReportNav
|
||||
sections={REPORT_SECTIONS}
|
||||
leftSlot={
|
||||
<Link
|
||||
to="/clinics/view-clinic"
|
||||
className="inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 hover:text-primary-900 transition-colors"
|
||||
>
|
||||
<ArrowLeft size={14} />
|
||||
클리닉으로
|
||||
</Link>
|
||||
}
|
||||
rightSlot={
|
||||
<div className="flex items-center gap-2">
|
||||
<DownloadMenuButton
|
||||
@@ -56,7 +66,7 @@ export default function GuestReportPage() {
|
||||
to={`/plan/${id}`}
|
||||
className="inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-semibold text-brand-purple bg-brand-tint-purple/60 border border-brand-tint-lavender hover:bg-brand-tint-purple transition-colors"
|
||||
>
|
||||
<Sparkles size={12} />
|
||||
<AppIcon kind="plan" size={12} />
|
||||
마케팅 기획 보기
|
||||
<ArrowRight size={11} className="opacity-80" />
|
||||
</Link>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* - 하단의 도입 문의 CTA 없음
|
||||
*/
|
||||
import { Link, useParams } from 'react-router';
|
||||
import { ArrowLeft, Sparkles, RefreshCw } from 'lucide-react';
|
||||
import { ArrowLeft, RefreshCw } from 'lucide-react';
|
||||
import { AppIcon } from '@/shared/icons/AppIcon';
|
||||
import { useReportPageData } from '../hooks/useReportPageData';
|
||||
import { ReportNav } from '../components/ReportNav';
|
||||
import { ScreenshotProvider } from '../stores/ScreenshotContext';
|
||||
@@ -52,7 +53,7 @@ export default function UserReportPage() {
|
||||
className="inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 hover:text-primary-900 transition-colors"
|
||||
>
|
||||
<ArrowLeft size={14} />
|
||||
워크스페이스로
|
||||
클리닉으로
|
||||
</Link>
|
||||
}
|
||||
rightSlot={
|
||||
@@ -72,7 +73,7 @@ export default function UserReportPage() {
|
||||
to={`/clinics/${clinicId}/plan/${id}`}
|
||||
className="inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-semibold text-white bg-gradient-to-r from-[#4F1DA1] to-[#021341] shadow-sm hover:opacity-90 transition-all"
|
||||
>
|
||||
<Sparkles size={12} />
|
||||
<AppIcon kind="plan" size={12} />
|
||||
마케팅 기획 보기
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user