[fix] negodata/front: 세션상태 라벨을 SHARED_ENUMS.md 5-state로 정렬

- SESSION_STATUS_LABEL 옛 3-state(1협상중·2협상종료·3협상거부) → 정본 5-state
  (1협상생성·2협상중·3협상완료·4미참여·5협상거부, 서버 /v1/enums·백엔드 SessionStatus 미러)
- 코드→라벨 단일 진입점 sessionStatusLabel() 추가, 드로어 인라인 매핑 제거
- '협상종료' 표기 → '협상완료'(DONE) 통일, ChatSession status 유니온 정렬

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mina Choi 2026-06-18 18:43:20 +09:00
parent 4f0e4c29ce
commit 06c2481fe7
3 changed files with 17 additions and 5 deletions

View File

@ -29,6 +29,7 @@ import {
normalizeQuotationStatus,
buildBidSummary,
mapServerSessionView,
sessionStatusLabel,
mapServerCardView,
} from '../types';
@ -459,7 +460,7 @@ export function QuotationDetailDrawer({
<TableCell className="p-3 text-center">
<span
className={`inline-flex px-2 py-0.5 rounded-full text-[10px] font-bold ${
sess.status === '협상료' || sess.status === 'COMPLETED'
sess.status === '협상료' || sess.status === 'COMPLETED'
? 'bg-blue-100 text-blue-800 dark:bg-blue-950/20 dark:text-blue-300'
: sess.status === '협상거부' || sess.status === 'REJECTED'
? 'bg-red-100 text-red-800 dark:bg-red-950/20 dark:text-red-300'
@ -561,7 +562,7 @@ export function QuotationDetailDrawer({
{serverSessions.map((sd) => {
const isSelected = sd.session_id === effectiveSessionId;
const name = partners.find((p) => p.id === sd.supplier_id)?.name || sd.supplier_id;
const statusLabel = sd.status === 2 ? '협상종료' : sd.status === 3 ? '협상거부' : '협상중';
const statusLabel = sessionStatusLabel(sd.status);
return (
<button
key={sd.session_id}
@ -576,7 +577,7 @@ export function QuotationDetailDrawer({
className={`text-[9px] font-bold px-1.5 py-0.5 rounded ${
statusLabel === '협상거부'
? 'bg-rose-100 text-rose-800 dark:bg-rose-950/30 dark:text-rose-300'
: statusLabel === '협상료'
: statusLabel === '협상료'
? 'bg-blue-100 text-blue-800 dark:bg-blue-950/30 dark:text-blue-300'
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950/30 dark:text-emerald-300'
}`}

View File

@ -259,7 +259,18 @@ export function buildSessions(
// ── 서버 연동 매퍼(negotiation.sessions / chats / 사용 카드) ──────────────
const SESSION_STATUS_LABEL: Record<number, string> = { 1: '협상중', 2: '협상종료', 3: '협상거부' };
// 세션상태 코드→라벨. 서버 /v1/enums(session_status) · SHARED_ENUMS.md 5-state 와 동일해야 한다.
// (정본은 서버 enum — 여기 값은 그걸 미러링한 것이며 드리프트 시 서버 기준으로 맞춘다.)
export const SESSION_STATUS_LABEL: Record<number, string> = {
1: '협상생성',
2: '협상중',
3: '협상완료',
4: '미참여',
5: '협상거부',
};
// 코드→라벨 단일 진입점. 미정의 코드는 코드 문자열 그대로.
export const sessionStatusLabel = (code?: number | null): string =>
(code != null ? SESSION_STATUS_LABEL[code] : undefined) ?? String(code ?? '');
const DELIVERY_TYPE_LABEL: Record<number, string> = { 1: '협력사배송', 2: '지정택배배송', 3: '픽업배송' };
// ISO 문자열 → 'YYYY-MM-DD HH:mm'. 빈 값/파싱 실패는 '-'.

View File

@ -285,7 +285,7 @@ export interface ChatMessage {
export interface ChatSession {
id: string; // matches supplier_id (or supplier.supplier_id)
partnerName: string;
status: 'NEGOTIATING' | 'COMPLETED' | 'REJECTED' | '협상생성' | '협상중' | '협상료' | '미참여' | '협상거부';
status: 'NEGOTIATING' | 'COMPLETED' | 'REJECTED' | '협상생성' | '협상중' | '협상료' | '미참여' | '협상거부';
currentBid: number;
bidTime: string;
messages: ChatMessage[];