Files
pipeline/frontend/lib/registry/pop-components/pop-card-list-v2/PopCardListV2Preview.tsx
T
SeongHyun Kim 461ff6dbf7 refactor: POP 디자인 감사 + WYSIWYG 정렬 + MES/장바구니 분리 + 장바구니 코드 제거
POP 컴포넌트 전반의 디자인 일관성을 확보하고, 디자이너-뷰어 간 WYSIWYG를
달성하며, MES 공정흐름 컴포넌트에서 장바구니 코드를 완전 분리한다.
[POP 디자인 종합 감사]
- PopRenderer 고스트 보더 제거 (border-2 bg-white -> 투명 래퍼)
- 하드코딩 배경색 -> CSS 변수 hsl(var(--background))
- 빈 상태 메시지 border-dashed bg-muted/30 제거
- 콘텐츠 컴포넌트만 선택적 보더 (rounded-lg border-border/40 bg-card)
[뷰어-디자이너 WYSIWYG 통일]
- PopRenderer 행 높이: 디자이너/뷰어 모두 고정 24px (minmax 제거)
- page.tsx mx-auto + maxWidth 제거 -> 뷰어 전체 폭 채움
- pop-icon 셀 내 스케일링 (maxWidth/maxHeight 100% + aspectRatio)
- pop-icon 라벨 표시 + 배경 투명/아이콘 색상 설정 UI 추가
- pop-profile 반응형, pop-button 오버플로 클리핑
[마키(흐르는 텍스트) 추가]
- pop-text에 marquee 옵션 (marqueeSpeed, marqueeIcon 설정)
- CSS animation + paddingRight 100vw 연속 스크롤
[컴포넌트 이름 명확화]
- pop-card-list-v2: "카드 목록 V2" -> "MES 공정흐름"
- pop-card-list: "카드 목록" -> "장바구니 목록"
[MES 공정흐름에서 장바구니 코드 완전 제거]
- PopCardListV2Component: useCartSync, parseCartRow, isCartListMode,
  selectedKeys, cartRef, cart 이벤트 3개, fetchCartData,
  handleDeleteItem/UpdateQuantity/CartAdd/Cancel/Delete 제거 (~250줄)
- cell-renderers: CartButtonCell, DynamicLucideIcon, ShoppingCart 제거 (~50줄)
- PopCardListV2Config: cart-button 셀 편집 UI 제거
- index.tsx: cart_updated/cart_save_completed/selected_items/
  cart_save_trigger/confirm_trigger 이벤트 메타 제거
- migrate.ts: cartAction/cartListMode 마이그레이션 제거
- types.ts: PopCardListV2Config cartAction/cartListMode 필드,
  CardCellDefinitionV2 cart 4필드, CardCellType "cart-button" 제거
- pop-card-list(장바구니 목록)의 타입/훅은 그대로 유지
- 매 Phase마다 tsc --noEmit 검증, 신규 에러 0건
2026-03-20 16:31:25 +09:00

105 lines
4.0 KiB
TypeScript

"use client";
/**
* pop-card-list-v2 디자인 모드 미리보기
*
* 디자이너 캔버스에서 표시되는 미리보기.
* CSS Grid 기반 셀 배치를 시각적으로 보여준다.
*/
import React from "react";
import { LayoutGrid, Package } from "lucide-react";
import type { PopCardListV2Config } from "../types";
import { CARD_SCROLL_DIRECTION_LABELS, CARD_SIZE_LABELS } from "../types";
interface PopCardListV2PreviewProps {
config?: PopCardListV2Config;
}
export function PopCardListV2PreviewComponent({ config }: PopCardListV2PreviewProps) {
const scrollDirection = config?.scrollDirection || "vertical";
const cardSize = config?.cardSize || "medium";
const dataSource = config?.dataSource;
const cardGrid = config?.cardGrid;
const hasTable = !!dataSource?.tableName;
const cellCount = cardGrid?.cells?.length || 0;
return (
<div className="flex h-full w-full flex-col bg-muted/30 p-3">
<div className="mb-2 flex items-center justify-between">
<div className="flex items-center gap-2 text-muted-foreground">
<LayoutGrid className="h-4 w-4" />
<span className="text-xs font-medium">MES </span>
</div>
<div className="flex gap-1">
<span className="rounded bg-primary/10 px-1.5 py-0.5 text-[9px] text-primary">
{CARD_SCROLL_DIRECTION_LABELS[scrollDirection]}
</span>
<span className="rounded bg-secondary px-1.5 py-0.5 text-[9px] text-secondary-foreground">
{CARD_SIZE_LABELS[cardSize]}
</span>
</div>
</div>
{!hasTable ? (
<div className="flex flex-1 items-center justify-center">
<div className="text-center">
<Package className="mx-auto mb-2 h-8 w-8 text-muted-foreground/50" />
<p className="text-xs text-muted-foreground"> </p>
</div>
</div>
) : (
<>
<div className="mb-2 text-center">
<span className="rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground">
{dataSource!.tableName}
</span>
<span className="ml-1 text-[10px] text-muted-foreground/60">
({cellCount})
</span>
</div>
<div className="flex flex-1 flex-col gap-2">
{[0, 1].map((cardIdx) => (
<div key={cardIdx} className="rounded-md border bg-card p-2">
{cellCount === 0 ? (
<div className="flex h-12 items-center justify-center">
<span className="text-[10px] text-muted-foreground"> </span>
</div>
) : (
<div
style={{
display: "grid",
gridTemplateColumns: cardGrid!.colWidths?.length
? cardGrid!.colWidths.map((w) => w || "1fr").join(" ")
: `repeat(${cardGrid!.cols || 1}, 1fr)`,
gridTemplateRows: `repeat(${cardGrid!.rows || 1}, minmax(16px, auto))`,
gap: "2px",
}}
>
{cardGrid!.cells.map((cell) => (
<div
key={cell.id}
className="rounded border border-dashed border-border/50 bg-muted/20 px-1 py-0.5"
style={{
gridColumn: `${cell.col} / span ${cell.colSpan || 1}`,
gridRow: `${cell.row} / span ${cell.rowSpan || 1}`,
}}
>
<span className="text-[8px] text-muted-foreground">
{cell.type}
{cell.columnName ? `: ${cell.columnName}` : ""}
</span>
</div>
))}
</div>
)}
</div>
))}
</div>
</>
)}
</div>
);
}