레퍼런스(statworx·jitter·infinith) 실측값으로 디자인 시스템을 다시 잡고, 스크롤 재생형 콘솔을 사용자가 직접 협상하는 데모로 교체했다. 디자인 토큰 - 타이포: 굵기·크기·자간을 함께 조정(섹션 제목 44→64px/600→800/자간 -0.042em). 한글 행간은 1.07 — 라틴 기준 0.95 를 쓰면 네모틀이 꽉 차 줄이 닿는다. - 모서리: 12가지로 흩어져 있던 값을 card 8px / control 4px / full 셋으로 수렴. 20~32px 짜리 뭉툭한 카드가 제네릭 SaaS 의 가장 강한 신호였다. - 다크 무대 토큰 신설(stage/on-stage/counter) + 배경 그라데이션. - primary-on-stage(#7C8CFF) 추가 — #0101F3 은 무대 배경 대비 2.0:1 로 WCAG 최소(4.5:1)의 절반도 안 돼 다크 위에서 읽히지 않았다. - 영문 디스플레이 서체 Playfair Display self-host(latin 서브셋 39KB). 히어로 - 배경 캔버스가 실제 파이프라인을 그린다: 수집→분류→대조→산정→협상→학습. 분류 단계는 거래 품목(시트)·사용자·협력사로 갈라지고 라벨이 붙는다. - z 좌표 + 원근 투영. 군집마다 z 평면을 하나씩 줘 격자는 온전한 채 깊이만 생긴다. - 순환 링(정원, 점선 궤도 회전). 진행도는 ref 로 공유해 60fps 리렌더를 피한다. - 카피에 진입 애니메이션을 걸지 않는다 — LCP 요소라 opacity:0 으로 시작하면 하이드레이션 전까지 첫 화면이 빈다. 협상 데모 (신규) - 역할 선택(공급사/구매 담당자) → 품목·단가 제시 → 턴 협상 → 낙찰/개찰 → 상담 신청. - 판정 규칙은 실제 엔진과 동일: 앵커링가 이하 낙찰, 협상 카드 3장, 소진 시 개찰. - 로직은 lib/negotiation-sim.ts 순수 함수로 분리 — 나중에 agent 서비스 연동 시 컴포넌트를 건드리지 않는다. 카피 감사 - "봇" 21곳 → "에이전트"(로봇 아이콘 3개 포함). 대리인은 조달 실무의 정당한 역할이다. - "악역은 봇이", "단가를 깎는 악역" 제거 — 협력사를 적으로 규정하는 프레임은 같은 페이지 FAQ(공급사 만족도 82%)와 모순이고, 동반성장 평가를 받는 대기업 구매팀 결재 라인에 올릴 수 없다. - 번역투 최상급(초정밀·압도적·완벽히·최적의)과 데모 대화문 전면 재작성. 버그 수정 - 헤더가 흰 배경 위에 흰 글자 버튼을 그리던 문제. onStage 를 스크롤 수치로 계산해 하이드레이션 전 스크롤 복원 시 초기값이 굳었다 → IntersectionObserver 로 교체. - 버튼 transition-all → transition-colors (variant 교체 시 배경 플리커). - 폼 입력 14px → 16px. iOS 사파리는 16px 미만 입력에 포커스하면 화면을 확대해 모바일 폼 이탈을 만든다. 정리 - 대체된 히어로 3종·기존 협상 콘솔 삭제(약 760줄). - 라벨 아이콘·알약 배지·blur(120px) 글로우 블롭 제거. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
153 lines
5.3 KiB
TypeScript
153 lines
5.3 KiB
TypeScript
import { useEffect, useRef, type RefObject } from "react"
|
|
|
|
import type { DataFlowPhase } from "@/components/ui/data-flow-canvas"
|
|
|
|
/**
|
|
* 파이프라인 순환 링 — 정원.
|
|
*
|
|
* 앞서 3D 로 눕힌 타원을 썼는데, 깊이는 생기지만 정원의 완결감이 사라진다.
|
|
* negotium 의 메시지는 "닫힌 루프"라서 완결감 쪽이 맞다.
|
|
*
|
|
* 구조는 레퍼런스(infinith)와 같다 — 점선 원만 천천히 돌고, 마디와 글자는 고정이다.
|
|
* 글자까지 같이 돌면 읽을 수가 없다.
|
|
*/
|
|
|
|
const NODES: { key: DataFlowPhase; label: string }[] = [
|
|
{ key: "scatter", label: "Collect" },
|
|
{ key: "cluster", label: "Classify" },
|
|
{ key: "stream", label: "Benchmark" },
|
|
{ key: "card", label: "Anchor" },
|
|
{ key: "negotiate", label: "Negotiate" },
|
|
{ key: "learn", label: "Learn" },
|
|
]
|
|
|
|
/* viewBox 는 정사각이 아니다. 라벨이 궤도 바깥 좌우로 뻗기 때문에 가로 여백이 더 필요한데,
|
|
정사각으로 두면 "Benchmark" 같은 긴 라벨이 잘린다(SVG 는 viewBox 밖을 그냥 자른다).
|
|
가로만 넓히면 링 크기는 유지한 채 라벨 자리를 확보할 수 있다. */
|
|
const VB_W = 176
|
|
const VB_H = 150
|
|
const CX = VB_W / 2
|
|
const CY = VB_H / 2
|
|
const R = 46 // 궤도 반지름
|
|
const R_LABEL = 58 // 라벨은 궤도 바깥에
|
|
|
|
const rad = (ratio: number) => ratio * Math.PI * 2 - Math.PI / 2 // 12시에서 시계방향
|
|
const at = (ratio: number, radius: number) => ({
|
|
x: CX + Math.cos(rad(ratio)) * radius,
|
|
y: CY + Math.sin(rad(ratio)) * radius,
|
|
})
|
|
|
|
export function OrbitRing({
|
|
phase,
|
|
progressRef,
|
|
className = "",
|
|
}: {
|
|
phase: DataFlowPhase
|
|
/** 캔버스가 매 프레임 써 넣는 루프 진행도 0..1 */
|
|
progressRef: RefObject<number>
|
|
className?: string
|
|
}) {
|
|
const activeIndex = Math.max(
|
|
0,
|
|
NODES.findIndex((n) => n.key === phase),
|
|
)
|
|
const headRef = useRef<SVGCircleElement>(null)
|
|
|
|
// 궤도를 도는 머리는 rAF 로 직접 갱신한다. 60fps 로 setState 를 부르면 페이지가 매 프레임 리렌더된다.
|
|
useEffect(() => {
|
|
let raf = 0
|
|
const tick = () => {
|
|
const p = progressRef.current ?? 0
|
|
const { x, y } = at(p, R)
|
|
if (headRef.current) {
|
|
headRef.current.setAttribute("cx", String(x))
|
|
headRef.current.setAttribute("cy", String(y))
|
|
}
|
|
raf = requestAnimationFrame(tick)
|
|
}
|
|
raf = requestAnimationFrame(tick)
|
|
return () => cancelAnimationFrame(raf)
|
|
}, [progressRef])
|
|
|
|
return (
|
|
<svg viewBox={`0 0 ${VB_W} ${VB_H}`} className={className} role="img" aria-label="협상 파이프라인 순환">
|
|
<defs>
|
|
<linearGradient id="orbitGrad" x1="0" y1="0" x2="1" y2="1">
|
|
<stop offset="0%" stopColor="var(--color-primary-on-stage)" stopOpacity="0.9" />
|
|
<stop offset="55%" stopColor="var(--color-on-stage-soft)" stopOpacity="0.35" />
|
|
<stop offset="100%" stopColor="var(--color-counter)" stopOpacity="0.55" />
|
|
</linearGradient>
|
|
</defs>
|
|
|
|
{/* 점선 궤도 — 이 레이어만 돈다 */}
|
|
<g className="animate-[spin_22s_linear_infinite] motion-reduce:animate-none" style={{ transformOrigin: `${CX}px ${CY}px` }}>
|
|
<circle cx={CX} cy={CY} r={R} fill="none" stroke="url(#orbitGrad)" strokeWidth="0.6" strokeDasharray="2.2 2.4" />
|
|
</g>
|
|
|
|
{/* 바깥 보조 호 — 정지. 원이 하나면 심심하고, 둘이면 공간이 생긴다. */}
|
|
<circle
|
|
cx={CX}
|
|
cy={CY}
|
|
r={R + 9}
|
|
fill="none"
|
|
stroke="var(--color-on-stage-soft)"
|
|
strokeOpacity="0.1"
|
|
strokeWidth="0.4"
|
|
/>
|
|
|
|
{/* 마디 + 라벨 — 고정 레이어 */}
|
|
{NODES.map((n, i) => {
|
|
const ratio = i / NODES.length
|
|
const p = at(ratio, R)
|
|
const l = at(ratio, R_LABEL)
|
|
const cos = Math.cos(rad(ratio))
|
|
const anchor = cos > 0.3 ? "start" : cos < -0.3 ? "end" : "middle"
|
|
const active = i === activeIndex
|
|
return (
|
|
<g key={n.key}>
|
|
<circle
|
|
cx={p.x}
|
|
cy={p.y}
|
|
r={active ? 2.6 : 1.4}
|
|
fill={active ? "var(--color-primary-on-stage)" : "var(--color-on-stage-soft)"}
|
|
opacity={active ? 1 : 0.45}
|
|
style={{ transition: "r 240ms ease-out, opacity 240ms ease-out" }}
|
|
/>
|
|
<text
|
|
x={l.x}
|
|
y={l.y + 1.6}
|
|
textAnchor={anchor}
|
|
fontSize="5"
|
|
fontWeight={active ? 700 : 500}
|
|
fill={active ? "#FFFFFF" : "var(--color-on-stage-soft)"}
|
|
opacity={active ? 1 : 0.5}
|
|
style={{ transition: "opacity 240ms ease-out" }}
|
|
>
|
|
{n.label}
|
|
</text>
|
|
</g>
|
|
)
|
|
})}
|
|
|
|
{/* 궤도를 도는 머리 */}
|
|
<circle ref={headRef} cx={CX} cy={CY - R} r="2" fill="#FFFFFF" opacity="0.95" />
|
|
|
|
{/* 가운데 */}
|
|
<text x={CX} y={CY - 1} textAnchor="middle" fontSize="7" fontWeight="700" fill="#FFFFFF">
|
|
{NODES[activeIndex].label}
|
|
</text>
|
|
<text
|
|
x={CX}
|
|
y={CY + 8.5}
|
|
textAnchor="middle"
|
|
fontSize="4.2"
|
|
fontWeight="500"
|
|
fill="var(--color-on-stage-soft)"
|
|
opacity="0.5"
|
|
>
|
|
{String(activeIndex + 1).padStart(2, "0")} / {String(NODES.length).padStart(2, "0")}
|
|
</text>
|
|
</svg>
|
|
)
|
|
}
|