[chore] negodata: enum 주석 영문값 보강 + 견적상태 3종 정리 + 대시보드 정비

- enum DDL 주석에 영문값 보강(status/role/delivery/usage_type/qt_type/supplier_type)
- 견적상태 3종(생성/진행중/마감)으로 정리(ON_HOLD 제거), 배송 PARTNER→SUPPLIER
- 대시보드 손질, 관련 테스트·negosium 견적유형 주석 동반

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 4.8 committed 2026-06-30 17:25:38 +09:00
1 parent 615167ad41
commit f19c6f57ea
36 files changed
+758 -247

No files matched your search

@@ -0,0 +1,72 @@
import type { ElementType, ReactNode } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Typography } from '@/components/ui/typography';
import { cn } from '@/lib/utils';
import { TONE_CHIP, type Tone } from '../tones';
// 대시보드 액션 위젯 공용 셸: 컬러 아이콘칩·제목·total 배지·빈상태. 본문(행 목록)은 children 으로 받는다.
export function ActionWidget({
title,
icon: Icon,
tone,
total,
empty,
emptyText = '처리할 항목 없음',
children,
}: {
title: string;
icon: ElementType;
tone: Tone;
total: number;
empty: boolean;
emptyText?: string;
children: ReactNode;
}) {
return (
<Card className="gap-3 py-4">
<CardContent className="space-y-2.5 px-4">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<span className={cn('flex size-7 items-center justify-center rounded-lg', TONE_CHIP[tone])}>
<Icon size={15} />
</span>
<Typography variant="h4" className="text-base">
{title}
</Typography>
</div>
<Badge variant="secondary">{total}</Badge>
</div>
{empty ? (
<Typography variant="muted">{emptyText}</Typography>
) : (
<div className="-mx-1.5 space-y-0.5">{children}</div>
)}
</CardContent>
</Card>
);
}
// 위젯 안의 클릭 가능한 행(견적 1건 → 상세 딥링크). 우측 슬롯에 D-n·미발송 배지 등을 건다.
export function ActionRow({
name,
right,
onClick,
}: {
name?: string;
right?: ReactNode;
onClick: () => void;
}) {
return (
<button
type="button"
onClick={onClick}
className="flex w-full cursor-pointer items-center justify-between gap-2 rounded-md px-1.5 py-1.5 text-left transition-colors hover:bg-muted/60"
>
<Typography variant="small" className="truncate">
{name || '(이름 없음)'}
</Typography>
{right}
</button>
);
}
@@ -0,0 +1,29 @@
import { HelpCircle } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Typography } from '@/components/ui/typography';
import { useAuth } from '@/features/auth/useAuth';
// 대시보드 상단 환영 배너. 제품 소개는 온보딩(이용안내 모달)이 맡고, 여기선 누구의/어느 회사 대시보드인지만 보여준다.
// 배지=현재 로그인 회사, 제목=사용자 이름 인사. 목업의 그라데이션 대신 primary 틴트 패널로 절제.
export function DashboardHero({ onOpenGuide }: { onOpenGuide: () => void }) {
const { user } = useAuth();
const name = user?.name?.trim();
const company = user?.company?.trim();
return (
<div className="flex flex-col gap-4 rounded-xl border border-primary/20 bg-primary/5 p-6 md:flex-row md:items-center md:justify-between">
<div className="space-y-2">
{company && <Badge>{company}</Badge>}
<Typography variant="h2">{name ? `${name}님, 환영합니다` : '환영합니다'}</Typography>
<Typography variant="muted" className="max-w-2xl">
견적 생성부터 초청메일·협상·마감·낙찰까지, 지금 처리할 일을 아래에서 한눈에 봅니다.
</Typography>
</div>
<Button variant="outline" onClick={onOpenGuide} className="shrink-0">
<HelpCircle />
이용안내
</Button>
</div>
);
}
@@ -0,0 +1,28 @@
import { Clock } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import type { DashboardActionList } from '@/api/generated/model/dashboardActionList';
import { ActionWidget, ActionRow } from './ActionWidget';
import { fmtDeadline } from '../fmt';
// 마감 임박: 견적명 + 우측에 마감 D-n.
export function DeadlineWidget({
data,
onOpen,
}: {
data?: DashboardActionList;
onOpen: (qtId: string) => void;
}) {
const items = data?.items ?? [];
return (
<ActionWidget title="마감 임박" icon={Clock} tone="amber" total={data?.total ?? 0} empty={items.length === 0}>
{items.map((it) => (
<ActionRow
key={it.qt_id}
name={it.name}
onClick={() => onOpen(it.qt_id)}
right={<Badge variant="outline">{fmtDeadline(it.end_time)}</Badge>}
/>
))}
</ActionWidget>
);
}
@@ -0,0 +1,27 @@
import { Mail } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import type { DashboardEmailUnsent } from '@/api/generated/model/dashboardEmailUnsent';
import { ActionWidget, ActionRow } from './ActionWidget';
// 메일 미발송: 견적 단위로 묶고 우측에 미발송 협력사 수. 발송 전엔 협상이 시작 안 되므로 미발송 수는 destructive 배지.
export function EmailUnsentWidget({
data,
onOpen,
}: {
data?: DashboardEmailUnsent;
onOpen: (qtId: string) => void;
}) {
const items = data?.quotations ?? [];
return (
<ActionWidget title="메일 미발송" icon={Mail} tone="rose" total={data?.total ?? 0} empty={items.length === 0}>
{items.map((it) => (
<ActionRow
key={it.qt_id}
name={it.name}
onClick={() => onOpen(it.qt_id)}
right={<Badge variant="destructive">미발송 {it.unsent_count ?? 0}곳</Badge>}
/>
))}
</ActionWidget>
);
}
@@ -0,0 +1,39 @@
import type { ElementType } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import { Typography } from '@/components/ui/typography';
import { cn } from '@/lib/utils';
import { TONE_CHIP, type Tone } from '../tones';
// 대시보드 KPI 숫자 타일. 컬러 아이콘칩 + 값 + 라벨. warn 지표는 값이 0보다 클 때만 숫자를 destructive 로 강조한다.
export function KpiTile({
label,
value,
icon: Icon,
tone,
alertWhenPositive,
}: {
label: string;
value: number;
icon: ElementType;
tone: Tone;
alertWhenPositive?: boolean;
}) {
const alert = !!alertWhenPositive && value > 0;
return (
<Card className="gap-0 py-0">
<CardContent className="flex items-center gap-3 px-4 py-3.5">
<div className={cn('flex size-9 shrink-0 items-center justify-center rounded-lg', TONE_CHIP[tone])}>
<Icon size={18} />
</div>
<div className="min-w-0 space-y-0.5">
<Typography variant="h3" className={cn('leading-none', alert && 'text-destructive')}>
{value}
</Typography>
<Typography variant="caption" className="block truncate">
{label}
</Typography>
</div>
</CardContent>
</Card>
);
}
@@ -0,0 +1,64 @@
import { ChevronRight } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Typography } from '@/components/ui/typography';
import { cn } from '@/lib/utils';
import { STEPS, ACTOR_CLASS } from '@/features/onboarding/steps';
// 견적 생성~낙찰 6단계 흐름을 가로 스텝퍼로 한눈에. 단계 정의는 온보딩 모달과 steps.ts 에서 공유한다.
// 3단계(초청메일)는 수동 발송이 필수라 destructive 톤으로 강조.
export function LifecycleStepper() {
return (
<Card>
<CardContent className="space-y-3 px-6">
<div className="space-y-1">
<Typography variant="h3">협상은 이렇게 진행됩니다</Typography>
<Typography variant="muted">
견적 생성부터 낙찰까지 6단계로 흐릅니다. 3단계 초청메일을 직접 보내야 협상이 시작됩니다.
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6">
{STEPS.map((step) => {
const Icon = step.icon;
return (
<div key={step.num} className="relative">
<div
className={cn(
'flex h-full flex-col gap-2 rounded-lg border p-3',
step.highlight ? 'border-destructive/50 bg-destructive/5' : 'border-border bg-card',
)}
>
<div className="flex items-center justify-between">
<Badge variant={step.highlight ? 'destructive' : 'secondary'}>{`0${step.num}`}</Badge>
<Typography as="span" variant="caption" className={ACTOR_CLASS[step.actorType]}>
[{step.actor}]
</Typography>
</div>
<Icon
size={18}
className={step.highlight ? 'text-destructive' : 'text-muted-foreground'}
/>
<Typography variant="small" className={cn('font-semibold', step.highlight && 'text-destructive')}>
{step.title}
</Typography>
<Typography variant="caption" className="leading-snug">
{step.short}
</Typography>
</div>
{/* 큰 화면에서 단계 사이 화살표 */}
{step.num < STEPS.length && (
<ChevronRight
size={14}
className="absolute top-1/2 -right-2.5 hidden -translate-y-1/2 text-muted-foreground/50 lg:block"
/>
)}
</div>
);
})}
</div>
</CardContent>
</Card>
);
}
@@ -0,0 +1,37 @@
import type { ElementType } from 'react';
import type { DashboardActionList } from '@/api/generated/model/dashboardActionList';
import { ActionWidget, ActionRow } from './ActionWidget';
import type { Tone } from '../tones';
// 동가 / 결렬: 견적명만 나열(수동 확인 대상). 제목·아이콘·톤은 호출부에서 지정.
export function RefWidget({
title,
icon,
tone,
data,
onOpen,
emptyText,
}: {
title: string;
icon: ElementType;
tone: Tone;
data?: DashboardActionList;
onOpen: (qtId: string) => void;
emptyText?: string;
}) {
const items = data?.items ?? [];
return (
<ActionWidget
title={title}
icon={icon}
tone={tone}
total={data?.total ?? 0}
empty={items.length === 0}
emptyText={emptyText}
>
{items.map((it) => (
<ActionRow key={it.qt_id} name={it.name} onClick={() => onOpen(it.qt_id)} />
))}
</ActionWidget>
);
}
@@ -0,0 +1,109 @@
import { Award, RefreshCw } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Typography } from '@/components/ui/typography';
import { cn } from '@/lib/utils';
import { TONE_CHIP, type Tone } from '../tones';
// 낙찰 판정 결과가 어떻게 보이는지 보여주는 예시(정적). 실제 동가·결렬 현황은 위 스코프 위젯에서 다룬다.
// 데모 수치(금액·절감률)는 설명용이며 실데이터가 아니다.
interface ResultRow {
label: string;
value: string;
}
interface ResultCase {
tone: Tone;
tag: string;
qtNo: string;
title: string;
rows: ResultRow[];
outcome: string;
}
const CASES: ResultCase[] = [
{
tone: 'amber',
tag: '동가 → 차수 재생성',
qtNo: 'QT-20260611-A',
title: 'MRO 안전화 일괄 조달 (1차수 마감)',
rows: [
{ label: '최저 투찰가', value: '42,000원' },
{ label: '동가 투찰사', value: '2개사' },
],
outcome: '최저가가 같은 2개사가 나와 2차수 협상이 자동 재생성·발송되었습니다.',
},
{
tone: 'emerald',
tag: '단독 최저 낙찰',
qtNo: 'QT-20260608-F',
title: '오피스 소모품 조달',
rows: [
{ label: '목표가', value: '500,000원' },
{ label: '최종 낙찰가', value: '415,000원' },
{ label: '낙찰자', value: '단독 최저 투찰사' },
],
outcome: '단독 최저가 투찰사로 낙찰되어 결과가 알림함으로 통지되었습니다.',
},
];
export function ResultExamples() {
return (
<Card>
<CardContent className="space-y-3 px-6">
<div className="flex items-center gap-2">
<Typography variant="h3">낙찰 결과는 이렇게 정리됩니다</Typography>
<Badge variant="outline">예시</Badge>
</div>
<div className="grid gap-3 md:grid-cols-2">
{CASES.map((c) => (
<ResultCaseCard key={c.qtNo} data={c} />
))}
</div>
</CardContent>
</Card>
);
}
function ResultCaseCard({ data }: { data: ResultCase }) {
const Icon = data.tone === 'emerald' ? Award : RefreshCw;
return (
<div className="space-y-3 rounded-xl border border-border p-4">
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-2">
<span className={cn('flex size-7 items-center justify-center rounded-lg', TONE_CHIP[data.tone])}>
<Icon size={15} />
</span>
<Typography as="span" variant="small" className="font-semibold">
{data.tag}
</Typography>
</div>
<Typography as="span" variant="mono" className="normal-case">
{data.qtNo}
</Typography>
</div>
<Typography variant="small" className="font-semibold">
{data.title}
</Typography>
<div className="space-y-1 rounded-lg bg-muted/40 p-3">
{data.rows.map((r) => (
<div key={r.label} className="flex items-center justify-between gap-2">
<Typography as="span" variant="caption">
{r.label}
</Typography>
<Typography as="span" variant="small" className="font-semibold">
{r.value}
</Typography>
</div>
))}
</div>
<Typography variant="caption" className="block leading-relaxed">
{data.outcome}
</Typography>
</div>
);
}
@@ -0,0 +1,42 @@
import { Activity, CalendarPlus, Award, Ban } from 'lucide-react';
import { Typography } from '@/components/ui/typography';
import type { DashboardScope } from '@/api/generated/model/dashboardScope';
import { KpiTile } from './KpiTile';
import { DeadlineWidget } from './DeadlineWidget';
import { EmailUnsentWidget } from './EmailUnsentWidget';
import { RefWidget } from './RefWidget';
// 스코프 1개(회사 전체 / 내 견적) 블록: 라벨 + 요약 KPI + 액션 위젯.
// KPI = 리스트 없는 순수 지표만.
// 위젯 = 관리자가 직접 처리해야 하는 것만.
export function ScopeSection({
label,
scope,
onOpen,
}: {
label: string;
scope?: DashboardScope;
onOpen: (qtId: string) => void;
}) {
const s = scope ?? {};
return (
<div className="space-y-3">
<div className="flex items-center gap-2">
<span className="h-4 w-1 rounded bg-primary" />
<Typography variant="h3">{label}</Typography>
</div>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
<KpiTile label="진행중" value={s.in_progress ?? 0} icon={Activity} tone="blue" />
<KpiTile label="이번 달 생성" value={s.this_month ?? 0} icon={CalendarPlus} tone="purple" />
<KpiTile label="누적 낙찰" value={s.awarded?.total ?? 0} icon={Award} tone="emerald" />
</div>
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
<DeadlineWidget data={s.deadline_soon} onOpen={onOpen} />
<EmailUnsentWidget data={s.email_unsent} onOpen={onOpen} />
<RefWidget title="결렬 (선정자 없이 마감)" icon={Ban} tone="rose" data={s.ruptured} onOpen={onOpen} />
</div>
</div>
);
}
@@ -0,0 +1,136 @@
import { useNavigate } from 'react-router';
import { CheckCircle2, Circle, AlertTriangle } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Typography } from '@/components/ui/typography';
import { cn } from '@/lib/utils';
// 시작하기 체크리스트 — 신규 유저 온보딩 예시(정적). 항목 진행 수치는 데모용 고정값이고,
// 버튼만 실제 등록 페이지로 이동시킨다. 실데이터 연동(상품/협력사/카드 카운트) 전까지 예시로 둔다.
type ItemStatus = 'done' | 'warn' | 'todo';
interface ChecklistItem {
status: ItemStatus;
title: string;
desc: string;
meta?: string; // 우측 완료 배지 텍스트
actionLabel?: string;
to?: string;
}
const ITEMS: ChecklistItem[] = [
{
status: 'done',
title: '상품 등록 완료',
desc: '자동 가격협상에 부칠 품목을 등록했습니다.',
meta: '12개',
},
{
status: 'done',
title: '협력사 등록 완료',
desc: '투찰에 참여할 공급 협력사를 등록했습니다.',
meta: '5개사',
},
{
status: 'warn',
title: '협력사 담당자 이메일 누락',
desc: '이메일이 없으면 초청메일을 보낼 수 없어 협상이 시작되지 않습니다.',
actionLabel: '이메일 채우기',
to: '/partners',
},
{
status: 'todo',
title: '첫 견적 만들기',
desc: '상품·협력사를 묶어 목표가를 정하고 자동협상을 시작합니다.',
actionLabel: '견적 생성',
to: '/quotation',
},
];
const DONE = ITEMS.filter((i) => i.status === 'done').length;
export function StartChecklist() {
const navigate = useNavigate();
return (
<Card>
<CardContent className="space-y-4 px-6">
<div className="flex items-start justify-between gap-3">
<div className="space-y-1">
<div className="flex items-center gap-2">
<Typography variant="h3">시작하기 체크리스트</Typography>
<Badge variant="outline">예시</Badge>
</div>
<Typography variant="muted">필수 준비를 끝내야 첫 자동협상을 시작할 수 있습니다.</Typography>
</div>
<Typography as="span" variant="small" className="shrink-0 font-semibold">
{DONE} / {ITEMS.length} 완료
</Typography>
</div>
{/* 진행률 바 */}
<div className="h-2 w-full overflow-hidden rounded-full bg-muted">
<div
className="h-full rounded-full bg-primary transition-all"
style={{ width: `${(DONE / ITEMS.length) * 100}%` }}
/>
</div>
<div className="space-y-2.5">
{ITEMS.map((item) => (
<ChecklistRow key={item.title} item={item} onAction={() => item.to && navigate(item.to)} />
))}
</div>
</CardContent>
</Card>
);
}
function ChecklistRow({ item, onAction }: { item: ChecklistItem; onAction: () => void }) {
const warn = item.status === 'warn';
return (
<div
className={cn(
'flex flex-col gap-2 rounded-lg border p-3.5 sm:flex-row sm:items-center sm:justify-between',
warn ? 'border-destructive/40 bg-destructive/5' : 'border-border bg-muted/30',
)}
>
<div className="flex items-start gap-3">
<StatusIcon status={item.status} />
<div className="space-y-0.5">
<Typography
variant="small"
className={cn('font-semibold', item.status === 'done' && 'line-through decoration-muted-foreground/50')}
>
{item.title}
</Typography>
<Typography variant="caption" className="block">
{item.desc}
</Typography>
</div>
</div>
{item.meta ? (
<Badge variant="secondary" className="self-start sm:self-center">
{item.meta}
</Badge>
) : item.actionLabel ? (
<Button
size="sm"
variant={warn ? 'destructive' : 'default'}
onClick={onAction}
className="self-start sm:self-center"
>
{item.actionLabel}
</Button>
) : null}
</div>
);
}
function StatusIcon({ status }: { status: ItemStatus }) {
if (status === 'done') return <CheckCircle2 size={18} className="mt-0.5 shrink-0 text-emerald-600 dark:text-emerald-400" />;
if (status === 'warn') return <AlertTriangle size={18} className="mt-0.5 shrink-0 text-destructive" />;
return <Circle size={18} className="mt-0.5 shrink-0 text-muted-foreground" />;
}