데모 콘솔 디자인 개편 — 미니멀 라이트 테마·컴포넌트 라이브러리 도입·제안가 추이 차트
- 연회색 바탕 위 무보더 흰 카드, 단일 파랑 악센트, 숫자 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:
1 parent
156ce3817d
commit
66c0429ea2
10 files changed
+382
-246
No files matched your search
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user