[feat] negodata/front: 프론트 초기 구축 (Vite+React, orval API 클라이언트, 견적/상품/협력사 페이지)
- 라우팅 react-router v7, 서버상태 TanStack Query - orval 자동 생성 API 클라이언트(src/api/generated) - 견적/상품/협력사/견적설정 페이지, shadcn UI, 토큰(tokens.css) - 실행: 루트 docker compose (front :3001), README 그에 맞게 정리 - AI Studio 스캐폴드 잔재 제거(metadata.json, 중복 DESIGN_TOKENS.md), 타이틀 NegoData, vite.config 죽은코드 제거 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a6731dcb07
commit
87524bf6e8
288 files changed
+26363
-1
No files matched your search
@@ -0,0 +1,119 @@
|
||||
import { Edit3, Trash2 } from 'lucide-react';
|
||||
import { DataTable } from '@/components/ui/data-table';
|
||||
import type { NegotiationCard } from '../types';
|
||||
|
||||
type CardTableProps = {
|
||||
data: NegotiationCard[];
|
||||
onEdit: (card: NegotiationCard) => void;
|
||||
onDelete: (id: string, title: string) => void;
|
||||
};
|
||||
|
||||
export function CardTable({ data, onEdit, onDelete }: CardTableProps) {
|
||||
return (
|
||||
<DataTable
|
||||
data={data}
|
||||
rowKey={(card) => card.id}
|
||||
onRowClick={onEdit}
|
||||
empty="데이터가 없습니다."
|
||||
columns={[
|
||||
{
|
||||
header: '구분',
|
||||
headClassName: 'w-24',
|
||||
cell: (card) =>
|
||||
card.isWildcard ? (
|
||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-rose-50 text-rose-700 dark:bg-rose-950/20 dark:text-rose-400 border border-rose-200/40">
|
||||
와일드카드
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-blue-50 text-blue-700 dark:bg-blue-950/20 dark:text-blue-400 border border-blue-200/40">
|
||||
협상카드
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
header: '카드번호',
|
||||
headClassName: 'w-28',
|
||||
cellClassName: 'font-mono font-semibold text-foreground',
|
||||
cell: (card) => card.code,
|
||||
},
|
||||
{
|
||||
header: '카드이름',
|
||||
headClassName: 'w-52',
|
||||
cell: (card) => (
|
||||
<>
|
||||
<div className="font-semibold text-foreground text-sm">{card.title}</div>
|
||||
{card.memo && (
|
||||
<div className="text-[10px] text-muted-foreground font-mono mt-0.5 max-w-[200px] truncate">
|
||||
{card.memo}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
header: '스크립트',
|
||||
cellClassName: 'font-mono text-muted-foreground',
|
||||
cell: (card) => (
|
||||
<div className="line-clamp-2 bg-muted/20 p-2.5 rounded border border-border/30 text-[11px] leading-relaxed">
|
||||
{card.scriptPreview}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
header: '사용 조건 (와일드 전용)',
|
||||
headClassName: 'w-40',
|
||||
cellClassName: 'font-mono text-xs font-semibold text-rose-600 dark:text-rose-400',
|
||||
cell: (card) => (card.isWildcard ? card.triggerCondition || '조건 없음' : '-'),
|
||||
},
|
||||
{
|
||||
header: '상태',
|
||||
align: 'center',
|
||||
headClassName: 'w-24',
|
||||
cell: (card) =>
|
||||
card.isWildcard ? (
|
||||
<span
|
||||
className={`inline-flex items-center px-2 py-0.5 text-[10px] font-semibold rounded-full border ${
|
||||
card.status === 'ACTIVE'
|
||||
? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/20 dark:text-emerald-400 border-emerald-300/40'
|
||||
: 'bg-amber-50 text-amber-700 dark:bg-amber-950/20 dark:text-amber-400 border-amber-300/45'
|
||||
}`}
|
||||
>
|
||||
{card.status === 'ACTIVE' ? '협상적용 가능' : '적용 대기(수동)'}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground font-mono font-medium opacity-65">-</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
header: '관리',
|
||||
align: 'center',
|
||||
headClassName: 'w-24',
|
||||
cell: (card) => (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onEdit(card);
|
||||
}}
|
||||
className="p-1.5 text-foreground hover:bg-muted rounded cursor-pointer transition-colors"
|
||||
title="수정"
|
||||
>
|
||||
<Edit3 size={14} />
|
||||
</button>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(card.id, card.title);
|
||||
}}
|
||||
className="p-1.5 text-muted-foreground hover:bg-red-50 hover:text-red-500 rounded cursor-pointer transition-colors"
|
||||
title="삭제"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user