레이아웃 재배치 + 미니 사분면 즉시 전환 + 가격 라운드 섹션 신설
- 좌측: 협상 케이스(상시 미니 4분면 — 클릭 시 해당 케이스로 즉시 재시작)·상품 정보·가격/차트 - 우측: 협상 진행(스텝 전용)·가격 라운드·엔진 판단 - 가격 라운드: 라운드별 제안가·기존가 대비 %·응수 협상 카드 기록 (카드는 확인 뒤 응답에 실려오므로 비어 있는 마지막 라운드에 지연 채움) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UFZ7JWdwCaQAwNYJErL8pP
This commit is contained in:
1 parent
fdfb235774
commit
cf23ca264a
4 files changed
+186
-87
No files matched your search
@@ -1,30 +1,30 @@
|
||||
import { DIST_LABEL, PARTNER_LABEL, SCENARIO_QUADRANTS, type DemoCase } from '../content/cases'
|
||||
|
||||
export function CasePanel({
|
||||
selected, busy, onChange,
|
||||
cases, selected, busy, onSelect, onChange,
|
||||
}: {
|
||||
cases: DemoCase[]
|
||||
selected: DemoCase | null
|
||||
busy: boolean
|
||||
onSelect: (c: DemoCase) => void
|
||||
onChange: () => void
|
||||
}) {
|
||||
if (!selected) {
|
||||
return (
|
||||
<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-[13px] font-semibold text-base-content/55">협상 케이스</h2>
|
||||
<p className="mt-3 text-[13px] leading-relaxed text-base-content/50">
|
||||
가운데 화면에서 시나리오를 선택하면 진행 중인 케이스와 상품 정보가
|
||||
여기에 표시됩니다.
|
||||
</p>
|
||||
</section>
|
||||
</aside>
|
||||
<section className="rounded-box bg-base-100 p-5">
|
||||
<h2 className="text-[13px] font-semibold text-base-content/55">협상 케이스</h2>
|
||||
<p className="mt-3 text-[13px] leading-relaxed text-base-content/50">
|
||||
가운데 화면에서 시나리오를 선택하면 진행 중인 케이스와 상품 정보가
|
||||
여기에 표시됩니다.
|
||||
</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const q = SCENARIO_QUADRANTS.find((x) => x.scenario === selected.scenario)
|
||||
const selectedQ = SCENARIO_QUADRANTS.find((x) => x.scenario === selected.scenario)
|
||||
|
||||
return (
|
||||
<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">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<h2 className="text-[13px] font-semibold text-base-content/55">협상 케이스</h2>
|
||||
@@ -34,20 +34,40 @@ export function CasePanel({
|
||||
disabled={busy}
|
||||
className="btn btn-ghost btn-xs -mr-1 text-base-content/55"
|
||||
>
|
||||
시나리오 변경
|
||||
처음으로
|
||||
</button>
|
||||
</div>
|
||||
<div className="mt-2 flex items-center gap-2.5">
|
||||
<span
|
||||
className={`flex size-10 shrink-0 items-center justify-center rounded-field text-xl font-extrabold ${q?.badgeCls ?? 'bg-base-200'}`}
|
||||
>
|
||||
{q?.letter ?? '?'}
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<p className="text-[15px] font-bold">시나리오 {q?.letter}</p>
|
||||
<p className="truncate text-xs text-base-content/50">{q?.axis}</p>
|
||||
</div>
|
||||
{/* 미니 사분면 — 누르면 해당 케이스로 즉시 새 협상 시작 */}
|
||||
<div className="mt-3 grid grid-cols-2 gap-1.5">
|
||||
{[['B', 'A'], ['C', 'D']].flat().map((letter) => {
|
||||
const q = SCENARIO_QUADRANTS.find((x) => x.letter === letter)
|
||||
const c = q && cases.find((x) => x.scenario === q.scenario)
|
||||
if (!q || !c) return null
|
||||
const active = c.id === selected.id
|
||||
return (
|
||||
<button
|
||||
key={q.scenario}
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => !active && onSelect(c)}
|
||||
aria-pressed={active}
|
||||
aria-label={`시나리오 ${q.letter} — ${q.axis}`}
|
||||
className={`cursor-pointer rounded-field py-2 text-center text-base font-extrabold transition-colors focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none ${
|
||||
active
|
||||
? `${q.badgeCls} ring-1 ring-current`
|
||||
: 'bg-base-200/60 text-base-content/55 hover:bg-base-200'
|
||||
}`}
|
||||
>
|
||||
{q.letter}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<p className="mt-2.5 text-xs text-base-content/50">
|
||||
시나리오 <span className={`font-bold ${selectedQ?.textCls ?? ''}`}>{selectedQ?.letter}</span>
|
||||
<span className="mx-1">·</span>
|
||||
{selectedQ?.axis}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section className="rounded-box bg-base-100 p-5">
|
||||
@@ -80,6 +100,6 @@ export function CasePanel({
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
</aside>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ChatMetadata } from '../lib/api'
|
||||
import type { DemoCase } from '../content/cases'
|
||||
import type { NegoState } from '../App'
|
||||
import { PriceChart } from './PriceChart'
|
||||
import type { NegoState, Round } from '../App'
|
||||
|
||||
const FLOW = ['서비스안내', '담당자확인', '협상품목안내', '가격협상', '협상종료']
|
||||
const MAX_ROUNDS = 5
|
||||
|
||||
// 긴장도 구간 → 응대 페르소나 (엔진 프리셋과 동일한 3구간)
|
||||
const PERSONA_ZONE: Record<string, number> = {
|
||||
@@ -20,10 +20,13 @@ function flowIndex(step: string): number {
|
||||
return i >= 0 ? i : 0
|
||||
}
|
||||
|
||||
function Panel({ title, children }: { title: string; children: React.ReactNode }) {
|
||||
function Panel({ title, right, children }: { title: string; right?: React.ReactNode; children: React.ReactNode }) {
|
||||
return (
|
||||
<section className="rounded-box bg-base-100 p-5">
|
||||
<h2 className="text-[13px] font-semibold text-base-content/55">{title}</h2>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<h2 className="text-[13px] font-semibold text-base-content/55">{title}</h2>
|
||||
{right}
|
||||
</div>
|
||||
<div className="mt-3">{children}</div>
|
||||
</section>
|
||||
)
|
||||
@@ -49,65 +52,27 @@ function StepCircle({ state }: { state: 'done' | 'current' | 'todo' }) {
|
||||
}
|
||||
|
||||
export function Dashboard({
|
||||
demoCase, nego, meta, priceTrail, started, finalPrice,
|
||||
demoCase, nego, meta, rounds, started,
|
||||
}: {
|
||||
demoCase: DemoCase | null
|
||||
nego: NegoState
|
||||
meta: ChatMetadata | null
|
||||
priceTrail: number[]
|
||||
rounds: Round[]
|
||||
started: boolean
|
||||
finalPrice: number | null
|
||||
}) {
|
||||
const fi = started ? flowIndex(nego.step) : -1
|
||||
const tension = meta?.tension ?? null
|
||||
const indicator = meta?.indicator_value ?? null
|
||||
const zone = meta?.persona != null ? PERSONA_ZONE[meta.persona] ?? null : 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 ?? 0
|
||||
const savedPct = demoCase && 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-4 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
|
||||
<Panel title={demoCase ? priceLabel : '가격'}>
|
||||
{demoCase ? (
|
||||
<>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<p className="num text-[28px] font-bold tracking-tight">
|
||||
{priceValue.toLocaleString()}
|
||||
<span className="ml-0.5 text-lg font-semibold text-base-content/55">원</span>
|
||||
</p>
|
||||
{savedPct != null && (
|
||||
<span className="num rounded-full bg-primary/10 px-2 py-0.5 text-[13px] font-semibold text-primary">
|
||||
기존가 대비 −{savedPct}%
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-2">
|
||||
<PriceChart demoCase={demoCase} priceTrail={series} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<p className="text-[13px] leading-relaxed text-base-content/55">
|
||||
시나리오를 선택하면 기존 공급가와 제안가 추이가 표시됩니다.
|
||||
</p>
|
||||
)}
|
||||
</Panel>
|
||||
|
||||
<Panel title="협상 진행">
|
||||
<ol className="flex flex-col">
|
||||
{FLOW.map((s, i) => {
|
||||
const state = i < fi ? 'done' : i === fi ? 'current' : 'todo'
|
||||
return (
|
||||
<li key={s} className="flex gap-3">
|
||||
<li key={s} className={`flex gap-3 ${i === FLOW.length - 1 ? '' : ''}`}>
|
||||
<div className="flex flex-col items-center">
|
||||
<StepCircle state={state} />
|
||||
{i < FLOW.length - 1 && (
|
||||
@@ -115,7 +80,7 @@ export function Dashboard({
|
||||
)}
|
||||
</div>
|
||||
<span
|
||||
className={`pb-4 text-[13px] leading-5 ${
|
||||
className={`text-[13px] leading-5 ${i < FLOW.length - 1 ? 'pb-4' : ''} ${
|
||||
state === 'current'
|
||||
? 'font-bold text-primary'
|
||||
: state === 'done'
|
||||
@@ -129,10 +94,46 @@ export function Dashboard({
|
||||
)
|
||||
})}
|
||||
</ol>
|
||||
<div className="mt-1 flex items-center justify-between border-t border-base-300/60 pt-3 text-[15px]">
|
||||
<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="가격 라운드"
|
||||
right={<span className="num text-[13px] font-semibold text-base-content/70">{rounds.length} / {MAX_ROUNDS}</span>}
|
||||
>
|
||||
{rounds.length === 0 ? (
|
||||
<p className="text-[13px] leading-relaxed text-base-content/55">
|
||||
가격 협상에서 제안할 때마다 제안가와 엔진이 응수한 협상 카드가
|
||||
여기에 기록됩니다.
|
||||
</p>
|
||||
) : (
|
||||
<ol className="flex flex-col gap-2.5">
|
||||
{rounds.map((r, i) => {
|
||||
const pct = demoCase
|
||||
? Math.round(((demoCase.item_price - r.price) / demoCase.item_price) * 1000) / 10
|
||||
: null
|
||||
return (
|
||||
<li key={i} className="flex items-center gap-2.5">
|
||||
<span className="num flex size-5 shrink-0 items-center justify-center rounded-full bg-base-200 text-[11px] font-bold text-base-content/60">
|
||||
{i + 1}
|
||||
</span>
|
||||
<span className="num min-w-0 flex-1 truncate text-[14px] font-semibold">
|
||||
{r.price.toLocaleString()}원
|
||||
</span>
|
||||
{pct != null && (
|
||||
<span className={`num text-xs font-medium ${pct >= 0 ? 'text-primary' : 'text-base-content/45'}`}>
|
||||
{pct >= 0 ? `−${pct}%` : `+${Math.abs(pct)}%`}
|
||||
</span>
|
||||
)}
|
||||
{r.card && (
|
||||
<span className="num shrink-0 rounded-full bg-primary/10 px-1.5 py-px font-mono text-[11px] font-semibold text-primary">
|
||||
{r.card}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ol>
|
||||
)}
|
||||
</Panel>
|
||||
|
||||
<Panel title="엔진 판단">
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import type { DemoCase } from '../content/cases'
|
||||
import { PriceChart } from './PriceChart'
|
||||
|
||||
export function PricePanel({
|
||||
demoCase, priceTrail, finalPrice,
|
||||
}: {
|
||||
demoCase: DemoCase | null
|
||||
priceTrail: number[]
|
||||
finalPrice: number | 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 ?? 0
|
||||
const savedPct = demoCase && current != null && current < demoCase.item_price
|
||||
? Math.round(((demoCase.item_price - current) / demoCase.item_price) * 1000) / 10
|
||||
: null
|
||||
|
||||
return (
|
||||
<section className="rounded-box bg-base-100 p-5">
|
||||
<h2 className="text-[13px] font-semibold text-base-content/55">{demoCase ? priceLabel : '가격'}</h2>
|
||||
<div className="mt-3">
|
||||
{demoCase ? (
|
||||
<>
|
||||
<div className="flex flex-wrap items-baseline gap-2">
|
||||
<p className="num text-[28px] font-bold tracking-tight">
|
||||
{priceValue.toLocaleString()}
|
||||
<span className="ml-0.5 text-lg font-semibold text-base-content/55">원</span>
|
||||
</p>
|
||||
{savedPct != null && (
|
||||
<span className="num rounded-full bg-primary/10 px-2 py-0.5 text-[13px] font-semibold text-primary">
|
||||
기존가 대비 −{savedPct}%
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-2">
|
||||
<PriceChart demoCase={demoCase} priceTrail={series} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<p className="text-[13px] leading-relaxed text-base-content/55">
|
||||
시나리오를 선택하면 기존 공급가와 제안가 추이가 표시됩니다.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user