47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
import { Check } from 'lucide-react'
|
|
import { cn } from '@/lib'
|
|
import { useChatStore } from '@/features/chat/stores/useChatStore'
|
|
import { STEPS } from '@/features/chat/lib/negoSteps'
|
|
|
|
// 모바일 전용: 협상절차를 채팅 상단에 가로 스텝바로 항상 표시한다. (데스크톱은 우측 패널 사용)
|
|
export function MobileStepBar() {
|
|
const chats = useChatStore((s) => s.messages)
|
|
const currentStep = chats[chats.length - 1]?.display_step || STEPS[0].name
|
|
const idx = Math.max(
|
|
0,
|
|
STEPS.findIndex((s) => s.name === currentStep),
|
|
)
|
|
|
|
return (
|
|
<div className="shrink-0 border-b border-border bg-white px-4 py-2.5 lg:hidden">
|
|
<div className="flex items-center">
|
|
{STEPS.map((step, i) => {
|
|
const done = i < idx
|
|
const current = i === idx
|
|
return (
|
|
<div key={step.name} className={cn('flex items-center', i < STEPS.length - 1 && 'flex-1')}>
|
|
<div
|
|
className={cn(
|
|
'flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-bold transition-colors',
|
|
done && 'bg-success text-white',
|
|
current && 'bg-brand-600 text-white ring-4 ring-brand-light',
|
|
!done && !current && 'border border-border bg-white text-neutral-50',
|
|
)}
|
|
>
|
|
{done ? <Check className="size-3" strokeWidth={3} /> : i + 1}
|
|
</div>
|
|
{i < STEPS.length - 1 && (
|
|
<div className={cn('mx-1 h-0.5 flex-1 rounded-full', i < idx ? 'bg-success' : 'bg-neutral-20')} />
|
|
)}
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
<p className="mt-1.5 truncate text-[11px] font-bold text-brand-600">
|
|
{idx + 1}. {STEPS[idx].name}
|
|
<span className="ml-1 font-normal text-neutral-50">{STEPS[idx].desc}</span>
|
|
</p>
|
|
</div>
|
|
)
|
|
}
|