"use client" import * as React from "react" import { Button } from "@/components/ui/button" import { Trash, CopyPlus, Plus } from "lucide-react" import { type Table } from "@tanstack/react-table" import type { PQList } from "./pq-lists-columns" // import { PqListForm } from "./add-pq-list-dialog" interface PQListsToolbarActionsProps { table: Table; onAddClick: () => void; onCopyClick: () => void; onToggleActive: (rows: PQList[], newIsDeleted: boolean) => void; } export function PQListsToolbarActions({ table, onAddClick, onCopyClick, onToggleActive, }: PQListsToolbarActionsProps) { const selected = table.getFilteredSelectedRowModel().rows.map(r => r.original); const allActive = selected.length > 0 && selected.every(item => !item.isDeleted); const allDeleted = selected.length > 0 && selected.every(item => item.isDeleted); let toggleLabel = ""; let newState: boolean | undefined; if (selected.length > 0) { if (allActive) { toggleLabel = "비활성화"; newState = true; } else if (allDeleted) { toggleLabel = "활성화"; newState = false; } } return (
{selected.length > 0 && (allActive || allDeleted) && newState !== undefined && ( )}
); }