feat(front): 진단 리포트에서 사이트 빌드로 이어지는 화면
예전 전략마케팅 툴은 분석 진행 화면에서 단계를 보여 주고 리포트로 넘어갔다. 지금 버전은 진단과 사이트 빌드가 서로 모르는 상태로 떨어져 있어, 진단을 읽은 병원이 다음에 무엇을 하는지 알 수 없었다. 진단 → 빌드 → 사진 확인 → 확인 항목을 한 줄로 잇는다. - /build/:id 를 추가한다. 예전 /report/loading 의 단계 UX(스피너·체크·진행바)를 잇되, 진행 상황을 프런트가 만들지 않고 supporter_builds 를 폴링해 워커가 쓴 값을 읽는다. 프런트가 파이프라인을 돌리지 않으므로 창을 닫아도 빌드는 계속되고, 재개 로직이 필요 없다. - 워커 17단계를 고객이 읽을 수 있는 5묶음으로 접는다(src/lib/buildPhases.ts). 진행률은 묶음이 아니라 끝난 워커 단계 수로 세어 한 묶음 안에서도 바가 움직인다. - 경고로 끝난 단계는 완료 화면에 "확인 대기로 발행된 부분"으로 남긴다. 자동으로 못 채운 값을 감추지 않는다. 멈춤은 발행 게이트와 실행 실패를 구분해 문구를 나눈다. - 진단 리포트의 Action Plan 뒤에 빌드 구간을 둔다. 무엇을 만들어 주는지와 버튼만 둔다. 버튼은 supporter_builds 에 queued 를 넣고 폴러가 집어 간다. - 상단 메뉴를 경로로 가른다. 병원 작업 경로에서는 마케팅 메뉴 대신 4단계 절차를 띄운다. Pricing·Use Cases 는 사진을 고르는 중인 병원에게 방해다. - 진단 데이터가 없는 병원(빌드만 한 곳)은 막다른 길 대신 빌드·사진 확인으로 잇는다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
74c70d656e
commit
be1ea72fcc
7 files changed
+697
-33
No files matched your search
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* 병원 작업 공간 상단 메뉴.
|
||||
*
|
||||
* 마케팅 메뉴(Product·Pricing·Use Cases)는 진단을 받은 병원에게 쓸모가 없다.
|
||||
* 이 화면들은 진단 → 빌드 → 사진 확인 → 확인 항목이라는 하나의 절차이므로,
|
||||
* 상단을 그 절차로 바꾼다. 지금 어디에 있고 다음이 무엇인지가 한 줄에 보여야 한다.
|
||||
*
|
||||
* 단계의 완료 여부는 각 화면이 판단한다. 여기서는 위치만 표시한다.
|
||||
*/
|
||||
import { Link, useLocation } from 'react-router';
|
||||
import { PrismFilled } from './icons/FilledIcons';
|
||||
|
||||
type Step = { key: string; label: string; to: (id: string) => string; match: RegExp };
|
||||
|
||||
const STEPS: Step[] = [
|
||||
{ key: 'report', label: '진단 리포트', to: (id) => `/discovery/${id}`, match: /^\/discovery\/[^/]+/ },
|
||||
{ key: 'build', label: '사이트 빌드', to: (id) => `/build/${id}`, match: /^\/build\/[^/]+/ },
|
||||
{ key: 'images', label: '사진 확인', to: (id) => `/images/${id}`, match: /^\/images\/[^/]+/ },
|
||||
{ key: 'inputs', label: '확인 항목', to: (id) => `/supporters/${id}`, match: /^\/supporters\/[^/]+/ },
|
||||
];
|
||||
|
||||
/** 작업 공간 경로면 병원 id 를 돌려준다. 아니면 null. */
|
||||
export function clinicIdFromPath(pathname: string): string | null {
|
||||
for (const s of STEPS) {
|
||||
if (s.match.test(pathname)) return pathname.split('/')[2] ?? null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function ClinicNav({ clinicId }: { clinicId: string }) {
|
||||
const { pathname } = useLocation();
|
||||
const currentIndex = STEPS.findIndex((s) => s.match.test(pathname));
|
||||
|
||||
return (
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 bg-white/95 border-b border-slate-100 backdrop-blur-md" data-no-print>
|
||||
<div className="max-w-7xl mx-auto px-6 h-20 flex items-center gap-6">
|
||||
{/* 로고 + 병원 */}
|
||||
<Link to="/" className="flex items-center gap-3 shrink-0" aria-label="INFINITH 홈">
|
||||
<PrismFilled size={22} className="text-[#6C5CE7]" />
|
||||
<span className="hidden sm:block font-serif text-xl font-black tracking-[0.05em] bg-gradient-to-r from-[#4F1DA1] to-[#021341] bg-clip-text text-transparent">
|
||||
INFINITH
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
<span className="hidden md:block w-px h-7 bg-slate-200 shrink-0" />
|
||||
|
||||
<span className="hidden md:block text-sm font-semibold text-slate-500 shrink-0 max-w-[160px] truncate" title={clinicId}>
|
||||
{clinicId}
|
||||
</span>
|
||||
|
||||
{/* 단계 */}
|
||||
<ol className="flex items-center gap-1 overflow-x-auto ml-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
||||
{STEPS.map((s, i) => {
|
||||
const isCurrent = i === currentIndex;
|
||||
const isPast = currentIndex > -1 && i < currentIndex;
|
||||
return (
|
||||
<li key={s.key} className="flex items-center shrink-0">
|
||||
{i > 0 && <span className="w-4 h-px bg-slate-200 mx-0.5" aria-hidden="true" />}
|
||||
<Link
|
||||
to={s.to(clinicId)}
|
||||
aria-current={isCurrent ? 'page' : undefined}
|
||||
className={`group inline-flex items-center gap-2 rounded-full pl-2 pr-3.5 py-2 text-sm font-semibold transition-colors
|
||||
${isCurrent
|
||||
? 'bg-[#F3F0FF] text-[#4A3A7C]'
|
||||
: 'text-slate-500 hover:bg-slate-100 hover:text-[#1D0024]'}`}
|
||||
>
|
||||
<span
|
||||
className={`w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 transition-colors
|
||||
${isCurrent
|
||||
? 'bg-gradient-to-r from-[#4F1DA1] to-[#021341] text-white'
|
||||
: isPast
|
||||
? 'bg-[#D5CDF5] text-[#4A3A7C]'
|
||||
: 'bg-slate-100 text-slate-400 group-hover:bg-slate-200'}`}
|
||||
>
|
||||
{i + 1}
|
||||
</span>
|
||||
<span className="whitespace-nowrap">{s.label}</span>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -18,11 +18,17 @@
|
||||
* 예컨대 `/pricing`에서 `#solution`을 누르면 /pricing 페이지 내의 #solution을 찾다가 실패합니다.
|
||||
* `/#solution`은 React Router가 홈으로 이동시킨 뒤 브라우저가 해시 스크롤을 처리합니다.
|
||||
*/
|
||||
import { Link } from 'react-router';
|
||||
import { Link, useLocation } from 'react-router';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import { buildContactMailto } from '../lib/contact';
|
||||
import ClinicNav, { clinicIdFromPath } from './ClinicNav';
|
||||
|
||||
export default function Navbar() {
|
||||
const { pathname } = useLocation();
|
||||
// 병원 작업 공간(진단·빌드·사진 확인·확인 항목)에서는 절차 메뉴로 바꾼다.
|
||||
const clinicId = clinicIdFromPath(pathname);
|
||||
if (clinicId) return <ClinicNav clinicId={clinicId} />;
|
||||
|
||||
return (
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 bg-white/95 border-b border-slate-100 backdrop-blur-md">
|
||||
<div className="max-w-7xl mx-auto px-6 h-20 flex items-center justify-between">
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* 진단 리포트 → 사이트 빌드로 넘어가는 구간.
|
||||
*
|
||||
* Action Plan 바로 다음에 둔다. 진단에서 무엇이 나왔는지 이미 읽은 상태이므로,
|
||||
* 여기서는 "그래서 무엇을 만들어 주는가"와 버튼 하나만 둔다.
|
||||
* 버튼은 supporter_builds 에 queued 를 넣고 /build/:clinicId 로 보낸다. 폴러가 집어 간다.
|
||||
*/
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { motion } from 'motion/react';
|
||||
import { supabase } from '../../lib/supabase';
|
||||
import { STATE_LABEL } from '../../lib/buildPhases';
|
||||
import type { BuildState } from '../../lib/buildPhases';
|
||||
import { FileTextFilled, ShieldFilled, MapPinFilled, CalendarFilled, VideoFilled } from '../icons/FilledIcons';
|
||||
// CTA 버튼의 ArrowRight 는 라인 아이콘 금지 규칙의 유일한 예외다(디자인 시스템).
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
|
||||
type Props = {
|
||||
clinicId: string;
|
||||
clinicName: string;
|
||||
clinicUrl?: string;
|
||||
/** 진단에서 나온 실행 항목 수. 맥락으로만 쓴다. */
|
||||
actionCounts?: { p0: number; p1: number };
|
||||
};
|
||||
|
||||
const OUTPUTS = [
|
||||
{ icon: FileTextFilled, title: '질문에 답하는 글', detail: '병원을 알아보는 사람이 실제로 묻는 질문을 골라 공개 자료를 근거로 답합니다.' },
|
||||
{ icon: ShieldFilled, title: '의료진과 안전 근거', detail: '홈페이지에 흩어져 있는 의료진 이력과 안전 시스템을 한자리에 모읍니다.' },
|
||||
{ icon: VideoFilled, title: '원장 설명 영상과 뉴스룸', detail: '유튜브 설명 영상과 언론 보도를 글의 근거로 연결합니다.' },
|
||||
{ icon: CalendarFilled, title: '회복 일정 안내', detail: '시술별 회복 기간을 병원 원문 기준으로 정리합니다.' },
|
||||
{ icon: MapPinFilled, title: '오시는 길과 주변 안내', detail: '병원 위치를 기준으로 머무는 동안 필요한 정보를 붙입니다.' },
|
||||
];
|
||||
|
||||
export function BuildSiteCta({ clinicId, clinicName, clinicUrl, actionCounts }: Props) {
|
||||
const navigate = useNavigate();
|
||||
const [existing, setExisting] = useState<{ status: BuildState; preview_url: string | null } | null>(null);
|
||||
const [checking, setChecking] = useState(true);
|
||||
const [starting, setStarting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
void (async () => {
|
||||
const { data } = await supabase
|
||||
.from('supporter_builds')
|
||||
.select('status,preview_url')
|
||||
.eq('clinic_id', clinicId)
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(1);
|
||||
if (!alive) return;
|
||||
setExisting((data?.[0] as { status: BuildState; preview_url: string | null }) ?? null);
|
||||
setChecking(false);
|
||||
})();
|
||||
return () => { alive = false; };
|
||||
}, [clinicId]);
|
||||
|
||||
async function startBuild() {
|
||||
setStarting(true);
|
||||
setError(null);
|
||||
const { error: e } = await supabase.from('supporter_builds').insert({
|
||||
clinic_id: clinicId,
|
||||
clinic_name: clinicName,
|
||||
url: clinicUrl ?? '',
|
||||
status: 'queued',
|
||||
});
|
||||
setStarting(false);
|
||||
if (e) { setError(e.message); return; }
|
||||
navigate(`/build/${clinicId}`);
|
||||
}
|
||||
|
||||
const hasBuild = Boolean(existing);
|
||||
const inFlight = existing?.status === 'queued' || existing?.status === 'running';
|
||||
|
||||
return (
|
||||
<section className="on-dark bg-[#0A1128] text-white relative overflow-hidden py-16 md:py-20 px-6" data-no-print>
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,rgba(108,92,231,0.16),transparent_60%)]" />
|
||||
<div className="relative max-w-7xl mx-auto">
|
||||
<div className="max-w-[62ch] mb-10">
|
||||
<h2 className="font-serif text-3xl md:text-5xl font-bold tracking-[-0.02em] mb-4">
|
||||
<span className="bg-gradient-to-r from-purple-300 to-blue-300 bg-clip-text text-transparent">Build the Site</span>
|
||||
</h2>
|
||||
<p className="text-lg text-purple-200 mb-3">진단에서 나온 것을 사이트로 옮깁니다</p>
|
||||
<p className="ui-body">
|
||||
AI가 병원을 설명할 때 근거로 삼을 페이지를 만듭니다.{' '}
|
||||
홈페이지 공개 자료만 쓰고, 없는 값은 지어내지 않고 확인 대기로 둡니다.
|
||||
{actionCounts && (actionCounts.p0 + actionCounts.p1 > 0) && (
|
||||
<> 위 실행 항목 가운데 콘텐츠와 구조에 해당하는 것(P0 {actionCounts.p0}건 · P1 {actionCounts.p1}건)이 이 단계에서 채워집니다.</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4 mb-10">
|
||||
{OUTPUTS.map((o, i) => {
|
||||
const Icon = o.icon;
|
||||
return (
|
||||
<motion.div
|
||||
key={o.title}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: i * 0.07 }}
|
||||
className="on-light bg-white rounded-2xl p-5 shadow-[3px_4px_12px_rgba(0,0,0,0.2)]"
|
||||
>
|
||||
<Icon size={20} className="text-[#6C5CE7] mb-3" />
|
||||
<h3 className="font-bold text-[#1D0024] mb-1.5">{o.title}</h3>
|
||||
<p className="ui-body">{o.detail}</p>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
{checking ? (
|
||||
<span className="text-white/50 text-base">빌드 상태를 확인하는 중입니다.</span>
|
||||
) : hasBuild ? (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate(`/build/${clinicId}`)}
|
||||
className="inline-flex items-center gap-2 rounded-full bg-gradient-to-r from-[#4F1DA1] to-[#021341] text-white font-semibold px-7 py-4 text-base"
|
||||
>
|
||||
{inFlight ? '진행 상황 보기' : '빌드 결과 보기'} <ArrowRight className="w-4 h-4" />
|
||||
</button>
|
||||
<span className="text-purple-200 text-base">{STATE_LABEL[existing!.status]}</span>
|
||||
{!inFlight && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void startBuild()}
|
||||
disabled={starting}
|
||||
className="rounded-full bg-white/10 border border-white/15 text-white font-semibold px-6 py-4 text-base disabled:opacity-50"
|
||||
>
|
||||
{starting ? '시작하는 중' : '다시 빌드'}
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void startBuild()}
|
||||
disabled={starting}
|
||||
className="inline-flex items-center gap-2 rounded-full bg-gradient-to-r from-[#4F1DA1] to-[#021341] text-white font-semibold px-7 py-4 text-base disabled:opacity-50"
|
||||
>
|
||||
{starting ? '시작하는 중' : '사이트로 빌드'} <ArrowRight className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{error && <p className="text-[#F5D5DC] text-base mt-4">시작하지 못했습니다. {error}</p>}
|
||||
<p className="ui-note mt-5">
|
||||
만들어진 사이트는 검색에 노출되지 않는 상태로 올라갑니다.{' '}
|
||||
공개 여부는 병원이 확인한 뒤에 정합니다.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user