"use client" import * as React from "react" import { type Table } from "@tanstack/react-table" import { Edit, Trash2, ArrowUpDown, Download, Copy, Wand2, X } from "lucide-react" import { Button } from "@/components/ui/button" import { Separator } from "@/components/ui/separator" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip" import { type GtcClauseTreeView } from "@/db/schema/gtc" import { DeleteGtcClausesDialog } from "./delete-gtc-clauses-dialog" interface GtcClausesTableFloatingBarProps { table: Table } export function GtcClausesTableFloatingBar({ table }: GtcClausesTableFloatingBarProps) { const selectedRows = table.getSelectedRowModel().rows const selectedCount = selectedRows.length const [showDeleteDialog, setShowDeleteDialog] = React.useState(false) if (selectedCount === 0) return null const selectedClauses = selectedRows.map(row => row.original) const handleClearSelection = () => { table.toggleAllRowsSelected(false) } const handleBulkEdit = () => { console.log("Bulk edit:", selectedClauses) } const handleReorder = () => { console.log("Reorder:", selectedClauses) } const handleExport = () => { console.log("Export:", selectedClauses) } const handleDuplicate = () => { console.log("Duplicate:", selectedClauses) } const handleGenerateVariables = () => { console.log("Generate variables:", selectedClauses) } const canReorder = selectedClauses.every(clause => clause.parentId === selectedClauses[0].parentId ) const hasVariablesMissing = selectedClauses.some(clause => !clause.hasAllVariableNames ) return (
{/* 선택된 항목 수 */}
{selectedCount}개 선택됨
{/* 액션 버튼들 */}
{/* 일괄 수정 */}

선택한 조항들을 일괄 수정

{/* 순서 변경 (같은 부모의 조항들만) */} {canReorder && (

선택한 조항들의 순서 변경

)} {/* 복제 */}

선택한 조항들을 복제

{/* 변수명 생성 (변수가 없는 조항이 있을 때만) */} {hasVariablesMissing && (

선택한 조항들의 PDFTron 변수명 생성

)} {/* 내보내기 */}

선택한 조항들을 Excel로 내보내기

{/* 삭제 버튼 */}

선택한 조항들을 삭제

{/* 선택 해제 버튼 */}

선택 해제

{/* 삭제 다이얼로그 */} { table.toggleAllRowsSelected(false) setShowDeleteDialog(false) }} />
) }