데모 콘솔 디자인 개편 — 미니멀 라이트 테마·컴포넌트 라이브러리 도입·제안가 추이 차트

- 연회색 바탕 위 무보더 흰 카드, 단일 파랑 악센트, 숫자 tabular-nums 통일
- 가격 트랙 → 제안가 추이 영역 차트(기준선 3종 점선·라벨 자동 스태거·합의가 종점 연결)
- 채팅 말풍선·버튼·배지·진행표시를 컴포넌트 라이브러리 기반으로 재작성
- 완료 배너에 최종 합의가·절감률 강조, 로딩·빈·오류 상태 문구 정비

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UFZ7JWdwCaQAwNYJErL8pP
This commit is contained in:
민헌andClaude Fable 5 committed 2026-08-31 14:04:05 +09:00
1 parent 156ce3817d
commit 66c0429ea2
10 files changed
+382 -246

No files matched your search

-6
View File
@@ -9,12 +9,6 @@
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="root"></div>
+10
View File
@@ -9,6 +9,7 @@
"version": "0.0.0",
"dependencies": {
"@tailwindcss/vite": "^4.3.3",
"daisyui": "^5.7.22",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"tailwindcss": "^4.3.3"
@@ -1285,6 +1286,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/daisyui": {
"version": "5.7.22",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.7.22.tgz",
"integrity": "sha512-pYii+2NCN0+OIL6Lpuc054LK0QJeNv+GRK9UzN1GRmjdYhYO6WFl0QLoj5oPcitPD7o+okiiI0SKFkn641TxmA==",
"license": "MIT",
"funding": {
"url": "https://github.com/saadeghi/daisyui?sponsor=1"
}
},
"node_modules/detect-libc": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+1
View File
@@ -11,6 +11,7 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.3.3",
"daisyui": "^5.7.22",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"tailwindcss": "^4.3.3"
+17 -6
View File
@@ -118,23 +118,27 @@ export default function App() {
return (
<div className="flex min-h-dvh flex-col min-[960px]:h-dvh">
<header className="flex items-center justify-between border-b border-line bg-panel px-6 py-3">
<header className="flex items-center justify-between bg-base-100 px-6 py-3.5">
<div className="flex items-baseline gap-3">
<h1 className="text-lg font-extrabold tracking-tight">NEGO 협상 콘솔</h1>
<span className="text-sm text-muted">구매 협상 에이전트 시연 — 당신은 공급사입니다</span>
<span className="hidden text-sm text-base-content/55 sm:inline">
구매 협상 에이전트 시연 — 당신은 공급사입니다
</span>
</div>
<div className="flex items-center gap-2 text-sm">
<span
className={`inline-block size-2 rounded-full ${
alive == null ? 'bg-line' : alive ? 'bg-green' : 'bg-amber'
alive == null ? 'bg-base-300' : alive ? 'bg-success' : 'bg-error'
}`}
aria-hidden
/>
<span className="text-muted">{alive == null ? '확인 중' : alive ? '엔진 연결됨' : '엔진 응답 없음 (:3300)'}</span>
<span className="text-base-content/55">
{alive == null ? '확인 중' : alive ? '엔진 연결됨' : '엔진 응답 없음'}
</span>
</div>
</header>
<main className="mx-auto grid w-full max-w-screen-2xl flex-1 grid-cols-1 gap-4 p-4 min-[960px]:min-h-0 min-[960px]:grid-cols-[250px_minmax(0,1fr)_320px]">
<main className="mx-auto grid w-full max-w-screen-2xl flex-1 grid-cols-1 gap-4 p-4 min-[960px]:min-h-0 min-[960px]:grid-cols-[260px_minmax(0,1fr)_330px]">
<CasePanel cases={DEMO_CASES} selected={demoCase} started={started} busy={busy} onStart={start} />
<ChatPanel
messages={messages}
@@ -148,7 +152,14 @@ export default function App() {
onOffer={offer}
onRestart={() => start(demoCase)}
/>
<Dashboard demoCase={demoCase} nego={nego} meta={meta} priceTrail={priceTrail} started={started} />
<Dashboard
demoCase={demoCase}
nego={nego}
meta={meta}
priceTrail={priceTrail}
started={started}
finalPrice={finalPrice}
/>
</main>
</div>
)
+21 -20
View File
@@ -10,10 +10,10 @@ export function CasePanel({
onStart: (c: DemoCase) => void
}) {
return (
<aside className="flex flex-col gap-3 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
<section className="rounded-xl border border-line bg-panel p-4">
<h2 className="text-xs font-semibold uppercase tracking-wider text-muted">협상 케이스</h2>
<ul className="mt-3 flex flex-col gap-2">
<aside className="flex flex-col gap-4 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
<section className="rounded-box bg-base-100 p-5">
<h2 className="text-xs font-semibold text-base-content/55">협상 케이스</h2>
<ul className="mt-3 flex flex-col gap-1.5">
{cases.map((c) => {
const active = started && c.id === selected.id
return (
@@ -22,27 +22,28 @@ export function CasePanel({
type="button"
disabled={busy}
onClick={() => onStart(c)}
className={`w-full rounded-lg border px-3 py-2.5 text-left transition-colors focus-visible:ring-2 focus-visible:ring-blue focus-visible:outline-none ${
active
? 'border-blue bg-blue-soft'
: 'border-line bg-panel hover:border-muted'
aria-pressed={active}
className={`w-full cursor-pointer rounded-field p-3 text-left transition-colors focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none ${
active ? 'bg-primary/8 ring-1 ring-primary/30' : 'hover:bg-base-200'
} ${busy ? 'opacity-60' : ''}`}
>
<div className="flex items-center justify-between gap-2">
<span className="text-sm font-semibold">{c.item_name}</span>
<span className="shrink-0 rounded bg-paper px-1.5 py-0.5 text-[11px] text-muted">{c.label}</span>
<span className={`text-sm font-bold ${active ? 'text-primary' : ''}`}>{c.item_name}</span>
<span className="shrink-0 rounded-full bg-base-200 px-2 py-0.5 text-[10px] font-medium text-base-content/55">
{c.label}
</span>
</div>
<div className="mt-1 font-mono text-xs text-muted">
기존 공급가 {c.item_price.toLocaleString()}원
<div className="num mt-1 text-xs text-base-content/55">
기존 공급가 <span className="font-semibold text-base-content/80">{c.item_price.toLocaleString()}원</span>
</div>
{active && (
<dl className="mt-2 grid grid-cols-2 gap-x-2 gap-y-1 border-t border-line pt-2 text-[11px]">
<dt className="text-muted">공급 유형</dt>
<dd className="text-right">{DIST_LABEL[c.dist]} · {c.partners_yn}</dd>
<dt className="text-muted">거래 기간</dt>
<dd className="text-right font-mono">{c.card_data.trading_period}년</dd>
<dt className="text-muted">응답률 / VOC</dt>
<dd className="text-right font-mono">{c.card_data.response_rate}% / {c.card_data.voc_count}건</dd>
<dl className="mt-2.5 grid grid-cols-2 gap-x-2 gap-y-1 border-t border-primary/15 pt-2.5 text-[11px]">
<dt className="text-base-content/50">공급 유형</dt>
<dd className="text-right font-medium">{DIST_LABEL[c.dist]} · {c.partners_yn}</dd>
<dt className="text-base-content/50">거래 기간</dt>
<dd className="num text-right font-medium">{c.card_data.trading_period}년</dd>
<dt className="text-base-content/50">응답률 / VOC</dt>
<dd className="num text-right font-medium">{c.card_data.response_rate}% / {c.card_data.voc_count}건</dd>
</dl>
)}
</button>
@@ -51,7 +52,7 @@ export function CasePanel({
})}
</ul>
{!started && (
<p className="mt-3 text-xs leading-relaxed text-muted">
<p className="mt-3 text-xs leading-relaxed text-base-content/50">
케이스를 선택하면 협상이 시작됩니다. 챗봇은 구매 담당자(MD) 역할이고,
당신은 공급사로서 가격 제안에 응답합니다.
</p>
+52 -51
View File
@@ -52,16 +52,16 @@ export function ChatPanel({
: null
return (
<section className="flex min-h-[70vh] flex-col rounded-xl border border-line bg-panel min-[960px]:h-full min-[960px]:min-h-0">
<section className="flex min-h-[70vh] flex-col rounded-box bg-base-100 min-[960px]:h-full min-[960px]:min-h-0">
{started && (
<div className="flex items-center justify-between gap-3 border-b border-line px-4 py-2.5">
<span className="truncate text-sm font-semibold">{demoCase.item_name}</span>
<div className="flex items-center justify-between gap-3 border-b border-base-300/60 px-5 py-3">
<span className="truncate text-sm font-bold">{demoCase.item_name}</span>
{!nego.done && (
<button
type="button"
onClick={onRestart}
disabled={busy}
className="shrink-0 rounded-md border border-line px-2.5 py-1 text-xs text-muted hover:border-muted hover:text-ink disabled:opacity-40 focus-visible:ring-2 focus-visible:ring-blue focus-visible:outline-none"
className="btn btn-ghost btn-xs text-base-content/55"
>
다시 시작
</button>
@@ -69,94 +69,95 @@ export function ChatPanel({
</div>
)}
<div ref={scroller} className="flex-1 overflow-y-auto p-4">
<div ref={scroller} className="flex-1 overflow-y-auto px-5 py-4">
{!started && (
<div className="flex h-full flex-col items-center justify-center gap-2 text-center text-muted">
<p className="text-base font-medium text-ink">협상 준비 완료</p>
<p className="max-w-sm text-sm leading-relaxed">
왼쪽에서 협상 케이스를 선택하세요. 협상 카드·가격 지표·긴장도가
오른쪽 계기판에 실시간으로 표시됩니다.
<div className="flex h-full flex-col items-center justify-center gap-2 text-center">
<p className="text-lg font-bold">어떤 품목으로 협상해 볼까요?</p>
<p className="max-w-sm text-sm leading-relaxed text-base-content/55">
왼쪽에서 협상 케이스를 선택하면 시작됩니다. 엔진의 판단 근거는
오른쪽 계기판에 실시간으로 표시돼요.
</p>
</div>
)}
<ol className="flex flex-col gap-3">
<ol className="flex flex-col gap-1">
{messages.map((m, i) => (
<li key={i} className={`msg-in flex ${m.role === 'user' ? 'justify-end' : 'justify-start'}`}>
<li key={i} className={`msg-in chat ${m.role === 'user' ? 'chat-end' : 'chat-start'}`}>
{m.role === 'bot' && m.step && (
<div className="chat-header mb-1 flex items-center gap-1.5 text-[11px] font-semibold text-base-content/45">
<span>{stepLabel(m.step)}</span>
{m.meta?.card_id && (
<span className="num rounded-full bg-primary/10 px-1.5 py-px font-mono text-primary">
{m.meta.card_id}
</span>
)}
</div>
)}
<div
className={`max-w-[min(82%,34rem)] rounded-2xl px-4 py-3 text-[15px] leading-relaxed whitespace-pre-line ${
className={`chat-bubble max-w-[min(85%,34rem)] text-[15px] leading-relaxed whitespace-pre-line before:hidden ${
m.role === 'user'
? 'rounded-br-md bg-blue text-white'
: 'rounded-bl-md bg-bot'
? 'bg-primary text-primary-content'
: 'bg-base-200 text-base-content'
}`}
>
{m.role === 'bot' && m.step && (
<div className="mb-1 flex items-center gap-2 text-[11px] font-semibold text-muted">
<span>{stepLabel(m.step)}</span>
{m.meta?.card_id && (
<span className="rounded bg-blue-soft px-1.5 py-px font-mono text-blue">{m.meta.card_id}</span>
)}
</div>
)}
{m.text}
</div>
</li>
))}
{busy && (
<li className="flex justify-start">
<div className="rounded-2xl rounded-bl-md bg-bot px-4 py-3 text-sm text-muted">협상 중…</div>
<li className="chat chat-start">
<div className="chat-bubble flex items-center gap-2 bg-base-200 text-sm text-base-content/55 before:hidden">
<span className="loading loading-dots loading-sm" aria-hidden />
담당자가 검토하고 있어요
</div>
</li>
)}
</ol>
{error && (
<p className="mt-3 rounded-lg bg-amber-soft px-3 py-2 text-sm text-amber">
{error} — 서버(:3300)가 켜져 있는지 확인한 뒤 다시 시도하세요.
</p>
<div className="mt-3 rounded-field bg-error/8 px-4 py-3 text-sm text-error">
{error} — 엔진 연결을 확인한 뒤 다시 시도해 주세요.
</div>
)}
</div>
<div className="border-t border-line p-3">
<div className="border-t border-base-300/60 p-4">
{nego.done ? (
<div className="flex flex-wrap items-center justify-between gap-3">
{finalPrice != null ? (
<span className="text-sm">
<span className="font-semibold text-green">협상 완료</span>
<span className="text-muted"> — 최종 합의가 </span>
<span className="font-mono font-semibold">{finalPrice.toLocaleString()}원</span>
<span className="font-mono text-blue"> (기존가 대비 −{savedPct}%)</span>
</span>
<div>
<p className="text-xs font-semibold text-success">협상 완료</p>
<p className="num mt-0.5 text-lg font-bold">
{finalPrice.toLocaleString()}원
<span className="num ml-2 align-[2px] rounded-full bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary">
기존가 대비 −{savedPct}%
</span>
</p>
</div>
) : (
<span className="text-sm font-semibold">협상이 종료되었습니다</span>
<span className="text-sm font-bold">협상이 종료되었습니다</span>
)}
<button
type="button"
onClick={onRestart}
className="rounded-lg bg-ink px-4 py-2 text-sm font-semibold text-white hover:bg-ink/85 focus-visible:ring-2 focus-visible:ring-blue focus-visible:outline-none"
>
<button type="button" onClick={onRestart} className="btn btn-neutral rounded-field">
같은 케이스로 다시 협상
</button>
</div>
) : nego.mode === 'price' ? (
<form
className="flex gap-2"
onSubmit={(e) => { e.preventDefault(); submitPrice() }}
>
<form className="flex gap-2" onSubmit={(e) => { e.preventDefault(); submitPrice() }}>
<label htmlFor="price" className="sr-only">공급 제안가 (원)</label>
<input
id="price"
inputMode="numeric"
autoComplete="off"
placeholder={`공급 제안가 입력 (기존가 ${demoCase.item_price.toLocaleString()}원)`}
placeholder={`제안가 입력 (기존가 ${demoCase.item_price.toLocaleString()}원)`}
value={priceInput}
onChange={(e) => setPriceInput(e.target.value)}
disabled={busy}
className="min-w-0 flex-1 rounded-lg border border-line bg-paper px-3 py-2.5 font-mono text-sm focus-visible:ring-2 focus-visible:ring-blue focus-visible:outline-none"
className="input num min-w-0 flex-1 bg-base-200 text-[15px] focus:outline-primary"
/>
<button
type="submit"
disabled={busy || !priceInput.trim()}
className="shrink-0 rounded-lg bg-blue px-5 py-2.5 text-sm font-semibold text-white disabled:opacity-40 hover:bg-blue/90 focus-visible:ring-2 focus-visible:ring-ink focus-visible:outline-none"
className="btn btn-primary shrink-0 rounded-field px-6"
>
제안
제안하기
</button>
</form>
) : nego.options.length > 0 ? (
@@ -167,14 +168,14 @@ export function ChatPanel({
type="button"
disabled={busy}
onClick={() => onAnswer(opt)}
className="rounded-lg border border-line bg-paper px-4 py-2.5 text-sm font-medium hover:border-blue hover:text-blue disabled:opacity-40 focus-visible:ring-2 focus-visible:ring-blue focus-visible:outline-none"
className="btn rounded-field border-0 bg-base-200 px-5 font-semibold hover:bg-primary/10 hover:text-primary"
>
{opt}
</button>
))}
</div>
) : (
<p className="py-1 text-center text-sm text-muted">
<p className="py-1 text-center text-sm text-base-content/45">
{started ? '응답을 기다리는 중…' : '케이스를 선택하면 입력이 열립니다'}
</p>
)}
+70 -36
View File
@@ -1,7 +1,7 @@
import type { ChatMetadata } from '../lib/api'
import type { DemoCase } from '../content/cases'
import type { NegoState } from '../App'
import { PriceTrack } from './PriceTrack'
import { PriceChart } from './PriceChart'
const FLOW = ['서비스안내', '담당자확인', '협상품목안내', '가격협상', '협상종료']
@@ -14,41 +14,69 @@ function flowIndex(step: string): number {
function Panel({ title, children }: { title: string; children: React.ReactNode }) {
return (
<section className="rounded-xl border border-line bg-panel p-4">
<h2 className="text-xs font-semibold uppercase tracking-wider text-muted">{title}</h2>
<section className="rounded-box bg-base-100 p-5">
<h2 className="text-xs font-semibold text-base-content/55">{title}</h2>
<div className="mt-3">{children}</div>
</section>
)
}
export function Dashboard({
demoCase, nego, meta, priceTrail, started,
demoCase, nego, meta, priceTrail, started, finalPrice,
}: {
demoCase: DemoCase
nego: NegoState
meta: ChatMetadata | null
priceTrail: number[]
started: boolean
finalPrice: number | null
}) {
const fi = started ? flowIndex(nego.step) : -1
const tension = meta?.tension ?? null
const indicator = meta?.indicator_value ?? null
// 합의가가 마지막 제안가와 다르면(1% 추가 네고 등) 차트 종점으로 잇는다
const series = finalPrice != null && priceTrail[priceTrail.length - 1] !== finalPrice
? [...priceTrail, finalPrice]
: priceTrail
const current = finalPrice ?? (priceTrail.length ? priceTrail[priceTrail.length - 1] : null)
const priceLabel = finalPrice != null ? '최종 합의가' : current != null ? '현재 제안가' : '기존 공급가'
const priceValue = current ?? demoCase.item_price
const savedPct = current != null && current < demoCase.item_price
? Math.round(((demoCase.item_price - current) / demoCase.item_price) * 1000) / 10
: null
return (
<aside className="flex flex-col gap-3 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
<Panel title="가격 트랙">
<PriceTrack demoCase={demoCase} priceTrail={priceTrail} />
<dl className="mt-3 flex items-center justify-between border-t border-line pt-2.5 text-xs">
<aside className="flex flex-col gap-4 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
<Panel title={priceLabel}>
<div className="flex items-baseline gap-2">
<p className="num text-2xl font-bold tracking-tight">
{priceValue.toLocaleString()}
<span className="ml-0.5 text-base font-semibold text-base-content/55">원</span>
</p>
{savedPct != null && (
<span className="num rounded-full bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary">
기존가 대비 −{savedPct}%
</span>
)}
</div>
<div className="mt-2">
<PriceChart demoCase={demoCase} priceTrail={series} />
</div>
<dl className="mt-2 flex items-center justify-between border-t border-base-300/60 pt-3 text-xs">
<div className="flex items-center gap-1.5">
<dt className="text-muted">시나리오</dt>
<dd className="font-mono font-medium">{demoCase.scenario.replace('Scenario_', '')}</dd>
<dt className="text-base-content/55">시나리오</dt>
<dd className="num font-semibold">{demoCase.scenario.replace('Scenario_', '')}</dd>
</div>
<div className="flex items-center gap-1.5">
<dt className="text-muted">인터넷 최저가</dt>
<dd className="font-mono font-medium">{demoCase.card_data.internet_min_price.toLocaleString()}원</dd>
<dt className="text-base-content/55">인터넷 최저가</dt>
<dd className="num font-semibold">{demoCase.card_data.internet_min_price.toLocaleString()}원</dd>
</div>
</dl>
<p className="mt-2 text-[11px] leading-relaxed text-muted">
<p className="mt-2 text-[11px] leading-relaxed text-base-content/45">
앵커가·목표가는 실제 협상에서 공급사에게 보이지 않는 구매측 내부 기준입니다.
</p>
</Panel>
@@ -58,44 +86,50 @@ export function Dashboard({
{FLOW.map((s, i) => (
<li key={s} className="flex flex-1 flex-col items-center gap-1.5">
<div
className={`h-1.5 w-full rounded-full ${
i < fi ? 'bg-blue/40' : i === fi ? 'bg-blue' : 'bg-line'
className={`h-1 w-full rounded-full ${
i < fi ? 'bg-primary/35' : i === fi ? 'bg-primary' : 'bg-base-200'
}`}
/>
<span className={`text-[10px] ${i === fi ? 'font-semibold text-ink' : 'text-muted'}`}>{s}</span>
<span
className={`text-[10px] ${i === fi ? 'font-semibold text-base-content' : 'text-base-content/45'}`}
>
{s}
</span>
</li>
))}
</ol>
<div className="mt-3 flex items-center justify-between text-sm">
<span className="text-muted">가격 라운드</span>
<span className="font-mono font-medium">{Math.min(nego.iteration + (nego.initial ? 1 : 0), 5)} / 5</span>
<span className="text-base-content/55">가격 라운드</span>
<span className="num font-semibold">{Math.min(nego.iteration + (nego.initial ? 1 : 0), 5)} / 5</span>
</div>
</Panel>
<Panel title="엔진 판단">
{meta ? (
<dl className="flex flex-col gap-3 text-sm">
<dl className="flex flex-col gap-4 text-sm">
<div className="flex items-center justify-between gap-2">
<dt className="text-muted">협상 카드</dt>
<dd className="rounded bg-blue-soft px-2 py-0.5 font-mono text-[13px] font-medium text-blue">
{meta.card_id ?? '—'}
<dt className="text-base-content/55">협상 카드</dt>
<dd>
<span className="badge badge-soft badge-primary num font-mono text-[12px] font-semibold">
{meta.card_id ?? '—'}
</span>
</dd>
</div>
<div>
<div className="flex items-center justify-between">
<dt className="text-muted">가격 지표</dt>
<dd className="font-mono text-[13px]">
<dt className="text-base-content/55">가격 지표</dt>
<dd className="num text-[13px] font-medium">
{indicator != null ? (
<>
{indicator} <span className="text-muted">/ 99 · {meta.indicator_range}</span>
{indicator} <span className="text-base-content/45">/ 99 · {meta.indicator_range}</span>
</>
) : '—'}
</dd>
</div>
<div className="mt-1.5 h-1.5 rounded-full bg-paper">
<div className="mt-2 h-1.5 rounded-full bg-base-200">
<div
className="h-full rounded-full bg-blue transition-[width] duration-500"
className="h-full rounded-full bg-primary transition-[width] duration-500 motion-reduce:transition-none"
style={{ width: `${indicator ?? 0}%` }}
/>
</div>
@@ -103,34 +137,34 @@ export function Dashboard({
<div>
<div className="flex items-center justify-between">
<dt className="text-muted">협상 긴장도</dt>
<dd className="font-mono text-[13px]">{tension != null ? tension.toFixed(2) : '—'}</dd>
<dt className="text-base-content/55">협상 긴장도</dt>
<dd className="num text-[13px] font-medium">{tension != null ? tension.toFixed(2) : '—'}</dd>
</div>
<div className="mt-1.5 h-1.5 rounded-full bg-paper">
<div className="mt-2 h-1.5 rounded-full bg-base-200">
<div
className="h-full rounded-full bg-amber transition-[width] duration-500"
className="h-full rounded-full bg-warning transition-[width] duration-500 motion-reduce:transition-none"
style={{ width: `${(tension ?? 0) * 100}%` }}
/>
</div>
</div>
<div className="flex items-center justify-between gap-2">
<dt className="text-muted">적용 페르소나</dt>
<dt className="text-base-content/55">적용 페르소나</dt>
<dd>
{meta.persona ? (
<span className="rounded bg-amber-soft px-2 py-0.5 text-[13px] font-medium text-amber">
<span className="badge badge-soft badge-warning text-[12px] font-semibold">
{meta.persona}
</span>
) : (
<span className="text-muted">—</span>
<span className="text-base-content/45">—</span>
)}
</dd>
</div>
</dl>
) : (
<p className="text-xs leading-relaxed text-muted">
<p className="text-xs leading-relaxed text-base-content/55">
{nego.done
? '카드 라운드 없이 조기 합의됐습니다 — 첫 제안가가 앵커가 이하면 협상 카드 없이 종료됩니다.'
? '카드 라운드 없이 조기 합의됐어요 — 첫 제안가가 앵커가 이하면 협상 카드 없이 종료됩니다.'
: '가격 협상이 시작되면 선택된 협상 카드와 가격 지표·긴장도·페르소나가 여기에 표시됩니다.'}
</p>
)}
+149
View File
@@ -0,0 +1,149 @@
import type { DemoCase } from '../content/cases'
/**
* 제안가 추이 차트 — 이 화면의 시그니처.
* 라운드마다 내려오는 제안가를 영역 차트로 그리고, 기존가·목표가·앵커가를
* 점선 기준선으로 깔아 "지금 제안이 어느 구간에 있는지" 하나만 전달한다.
*/
export function PriceChart({ demoCase, priceTrail }: { demoCase: DemoCase; priceTrail: number[] }) {
const { anchor, target, item_price } = demoCase
const W = 300
const H = 150
const PAD = { top: 14, right: 72, bottom: 12, left: 10 }
const plotW = W - PAD.left - PAD.right
const plotH = H - PAD.top - PAD.bottom
const hi = Math.max(item_price, ...(priceTrail.length ? priceTrail : [item_price]))
const lo = Math.min(anchor, ...(priceTrail.length ? priceTrail : [anchor]))
const span = (hi - lo) || 1
const yOf = (v: number) => PAD.top + (1 - (v - lo) / span) * plotH
// 첫 라운드부터 점이 왼쪽에 고정되도록 슬롯을 최소 3칸으로 유지
const slots = Math.max(priceTrail.length - 1, 3)
const xOf = (i: number) => PAD.left + (i / slots) * plotW
// 기준선 3종 — 라벨은 선 오른쪽에 두고, 세로로 가까우면 밀어내서 겹침을 막는다
const refs = [
{ v: item_price, label: '기존가', color: 'var(--color-base-content)', op: 0.4 },
{ v: target, label: '목표가', color: 'var(--color-base-content)', op: 0.75 },
{ v: anchor, label: '앵커가', color: 'var(--color-primary)', op: 1 },
]
.map((r) => ({ ...r, y: yOf(r.v), ly: yOf(r.v) }))
.sort((a, b) => a.y - b.y)
const MIN_GAP = 13
for (let i = 1; i < refs.length; i++) {
if (refs[i].ly - refs[i - 1].ly < MIN_GAP) refs[i].ly = refs[i - 1].ly + MIN_GAP
}
const overflow = refs[refs.length - 1].ly - (H - 4)
if (overflow > 0) for (const r of refs) r.ly -= overflow
const pts = priceTrail.map((v, i) => ({ x: xOf(i), y: yOf(v), v }))
const line = pts.map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x},${p.y}`).join(' ')
const area = pts.length >= 2
? `${line} L${pts[pts.length - 1].x},${H - PAD.bottom} L${pts[0].x},${H - PAD.bottom} Z`
: null
const last = pts.length ? pts[pts.length - 1] : null
return (
<svg
viewBox={`0 0 ${W} ${H}`}
className="w-full"
role="img"
aria-label={
last
? `제안가 추이 — 현재 ${last.v.toLocaleString()}원, 목표가 ${target.toLocaleString()}원, 앵커가 ${anchor.toLocaleString()}원`
: `가격 기준선 — 기존가 ${item_price.toLocaleString()}원, 목표가 ${target.toLocaleString()}원, 앵커가 ${anchor.toLocaleString()}원`
}
>
<defs>
<linearGradient id="trend-fill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="var(--color-primary)" stopOpacity="0.16" />
<stop offset="100%" stopColor="var(--color-primary)" stopOpacity="0" />
</linearGradient>
</defs>
{refs.map((r) => (
<g key={r.label}>
<line
x1={PAD.left}
y1={r.y}
x2={W - PAD.right + 6}
y2={r.y}
stroke={r.color}
strokeOpacity={r.op * 0.45}
strokeWidth="1"
strokeDasharray="3 4"
/>
<text
x={W - 2}
y={r.ly + 3}
textAnchor="end"
fontSize="9.5"
fill={r.color}
fillOpacity={Math.min(r.op + 0.2, 1)}
className="num"
>
{r.label} {r.v.toLocaleString()}
</text>
</g>
))}
{area && <path d={area} fill="url(#trend-fill)" />}
{pts.length >= 2 && (
<path
d={line}
fill="none"
stroke="var(--color-primary)"
strokeWidth="2"
strokeLinejoin="round"
strokeLinecap="round"
/>
)}
{pts.slice(0, -1).map((p, i) => (
<circle key={i} cx={p.x} cy={p.y} r="2.5" fill="var(--color-primary)" fillOpacity="0.4" />
))}
{last && (
<g>
<circle className="chart-pulse" cx={last.x} cy={last.y} r="6" fill="var(--color-primary)" />
<circle
cx={last.x}
cy={last.y}
r="4"
fill="var(--color-base-100)"
stroke="var(--color-primary)"
strokeWidth="2.5"
/>
<text
x={last.x}
y={last.y < 26 ? last.y + 18 : last.y - 10}
textAnchor={last.x > W - PAD.right - 30 ? 'end' : 'middle'}
fontSize="10.5"
fontWeight="700"
fill="var(--color-base-content)"
stroke="var(--color-base-100)"
strokeWidth="3"
paintOrder="stroke"
className="num"
>
{last.v.toLocaleString()}
</text>
</g>
)}
{!last && (
<text
x={PAD.left + plotW / 2}
y={PAD.top + plotH / 2 + 3}
textAnchor="middle"
fontSize="10.5"
fill="var(--color-base-content)"
fillOpacity="0.45"
>
첫 제안가를 입력하면 추이가 그려져요
</text>
)}
</svg>
)
}
-107
View File
@@ -1,107 +0,0 @@
import type { DemoCase } from '../content/cases'
/**
* 가격 트랙 — 이 페이지의 시그니처.
* 앵커가·목표가·기존 공급가를 한 수평 트랙에 놓고, 제안가가 내려오는 과정을 마커로 보여준다.
* 파랑 구간(앵커 이하) = 구매측 최적 · 앰버 구간(목표가 초과) = 협상 여지.
*/
export function PriceTrack({ demoCase, priceTrail }: { demoCase: DemoCase; priceTrail: number[] }) {
const { anchor, target, item_price } = demoCase
const current = priceTrail.length ? priceTrail[priceTrail.length - 1] : null
// 트랙 범위: min(앵커, 최저 제안가) 아래 여유 3% ~ max(기존가, 최고 제안가) 위 여유 3%
// (제안가가 앵커보다 낮아도 마커가 트랙 밖으로 클리핑되지 않도록 동적 확장)
const hi = Math.max(item_price, ...(priceTrail.length ? priceTrail : [item_price])) * 1.03
const lo = Math.min(anchor, ...(priceTrail.length ? priceTrail : [anchor])) * 0.97
const pos = (v: number) => Math.min(Math.max(((v - lo) / (hi - lo)) * 100, 0), 100)
// 기준선 3종 — 제안가가 범위를 크게 넓히면 서로 몰려 라벨이 겹치므로,
// 가까운 라벨(간격 < MIN_GAP%)은 아랫줄로 내려 층을 나눈다.
const MIN_GAP = 18
const ticks = [
{ value: anchor, label: '앵커가', cls: 'bg-blue' },
{ value: target, label: '목표가', cls: 'bg-ink/50' },
{ value: item_price, label: '기존가', cls: 'bg-muted/60' },
].sort((a, b) => a.value - b.value)
const rows = ticks.map(() => 0)
for (let i = 1; i < ticks.length; i++) {
let row = 0
for (let j = 0; j < i; j++) {
if (pos(ticks[i].value) - pos(ticks[j].value) < MIN_GAP && rows[j] === row) {
row += 1
j = -1 // 줄을 내렸으니 앞 라벨들과 다시 비교
}
}
rows[i] = row
}
const maxRow = Math.max(...rows)
// 가장자리에선 중앙정렬 대신 안쪽으로 붙여 패널 밖 클리핑을 막는다
const align = (p: number) =>
p <= 6
? 'translate-x-0 text-left'
: p >= 94
? '-translate-x-full text-right'
: '-translate-x-1/2 text-center'
const Tick = ({ value, label, cls, row }: { value: number; label: string; cls: string; row: number }) => (
<div className="absolute top-0 h-full" style={{ left: `${pos(value)}%` }}>
<div className={`h-full w-px ${cls}`} />
<div
className={`absolute whitespace-nowrap ${align(pos(value))}`}
style={{ top: `calc(100% + ${4 + row * 28}px)` }}
>
<div className="text-[10px] leading-tight text-muted">{label}</div>
<div className="font-mono text-[11px] font-medium leading-tight">{value.toLocaleString()}</div>
</div>
</div>
)
return (
<div>
<div
className="relative mt-6 h-3 rounded-full bg-paper"
style={{ marginBottom: `${2.25 + maxRow * 1.75}rem` }}
>
{/* 구간 채색: [lo~anchor]=파랑(최적) · [anchor~target]=연파랑(합의권) · [target~hi]=앰버(초과) */}
<div className="absolute inset-y-0 left-0 rounded-l-full bg-blue/70" style={{ width: `${pos(anchor)}%` }} />
<div
className="absolute inset-y-0 bg-blue-soft"
style={{ left: `${pos(anchor)}%`, width: `${pos(target) - pos(anchor)}%` }}
/>
<div
className="absolute inset-y-0 rounded-r-full bg-amber-soft"
style={{ left: `${pos(target)}%`, width: `${100 - pos(target)}%` }}
/>
{ticks.map((t, i) => (
<Tick key={t.label} value={t.value} label={t.label} cls={t.cls} row={rows[i]} />
))}
{/* 과거 제안 흔적 */}
{priceTrail.slice(0, -1).map((p, i) => (
<div
key={i}
className="absolute top-1/2 size-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-ink/25"
style={{ left: `${pos(p)}%` }}
/>
))}
{/* 현재 제안가 마커 */}
{current != null && (
<div
className="track-marker absolute top-1/2 -translate-x-1/2 -translate-y-1/2"
style={{ left: `${pos(current)}%` }}
>
<div className="size-4 rounded-full border-[3px] border-ink bg-white shadow-sm" />
<div className="absolute bottom-full left-1/2 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded bg-ink px-1.5 py-0.5 font-mono text-[11px] font-semibold text-white">
{current.toLocaleString()}
</div>
</div>
)}
</div>
{current == null && (
<p className="text-xs text-muted">첫 제안가를 입력하면 트랙 위에 표시됩니다.</p>
)}
</div>
)
}
+62 -20
View File
@@ -1,22 +1,50 @@
@import "tailwindcss";
@theme {
/* 콘솔 팔레트 — 파랑 = 인하/성공 (국내 시장 컨벤션: 파랑=하락) */
--color-paper: #f5f6f8;
--color-panel: #ffffff;
--color-ink: #171b26;
--color-muted: #68707f;
--color-line: #e2e5eb;
--color-blue: #1d4ed8; /* 인하·성공·주요 액션 */
--color-blue-soft: #eef2ff;
--color-amber: #b45309; /* 긴장도·주의 */
--color-amber-soft: #fef3e2;
--color-green: #067647; /* 협상완료 */
--color-green-soft: #e7f6ee;
--color-bot: #f0f2f6; /* 봇 말풍선 */
@plugin "daisyui" {
themes: false;
}
/* 콘솔 라이트 테마 — 연회색 바탕 위 무보더 흰 카드, 악센트는 파랑 하나만
(국내 시장 컨벤션: 파랑=인하·성공) */
@plugin "daisyui/theme" {
name: "console-light";
default: true;
color-scheme: light;
--color-base-100: #ffffff;
--color-base-200: #f2f4f6;
--color-base-300: #e5e8ec;
--color-base-content: #191f28;
--color-primary: #3182f6;
--color-primary-content: #ffffff;
--color-secondary: #191f28;
--color-secondary-content: #ffffff;
--color-accent: #3182f6;
--color-accent-content: #ffffff;
--color-neutral: #333d4b;
--color-neutral-content: #ffffff;
--color-info: #3182f6;
--color-info-content: #ffffff;
--color-success: #00885c;
--color-success-content: #ffffff;
--color-warning: #d97706;
--color-warning-content: #ffffff;
--color-error: #e5484d;
--color-error-content: #ffffff;
/* 동심원 정합: 카드 20px − 안쪽 여백 8px = 필드 12px */
--radius-box: 1.25rem;
--radius-field: 0.75rem;
--radius-selector: 0.5rem;
--border: 1px;
--depth: 0;
--noise: 0;
}
@theme {
--font-body: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, sans-serif;
--font-mono: "IBM Plex Mono", ui-monospace, monospace;
}
html, body, #root {
@@ -24,13 +52,18 @@ html, body, #root {
}
body {
background: var(--color-paper);
color: var(--color-ink);
background: var(--color-base-200);
color: var(--color-base-content);
font-family: var(--font-body);
-webkit-font-smoothing: antialiased;
word-break: keep-all;
}
/* 숫자는 고정폭 숫자로 정렬 (별도 모노 폰트 대신 본문 서체 유지) */
.num {
font-variant-numeric: tabular-nums;
}
/* 봇 응답 등장 */
@keyframes rise {
from { opacity: 0; transform: translateY(6px); }
@@ -41,8 +74,17 @@ body {
.msg-in { animation: none; }
}
/* 가격 트랙 마커 이동 */
.track-marker { transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
/* 추이 차트 마지막 점 강조 */
@keyframes pulse-dot {
0% { opacity: 0.5; transform: scale(1); }
70% { opacity: 0; transform: scale(2.4); }
100% { opacity: 0; transform: scale(2.4); }
}
.chart-pulse {
transform-origin: center;
transform-box: fill-box;
animation: pulse-dot 2s ease-out infinite;
}
@media (prefers-reduced-motion: reduce) {
.track-marker { transition: none; }
.chart-pulse { animation: none; opacity: 0; }
}