blob: 26755aee48e0527454eb2f59c410696ebc34b06e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
"use client";
import * as React from "react";
import { Button } from "@/components/ui/button";
import { Download, Trash2 } from "lucide-react";
import { toast } from "sonner";
import type { Table } from "@tanstack/react-table";
interface ComplianceResponsesToolbarActionsProps<TData> {
table: Table<TData>;
}
export function ComplianceResponsesToolbarActions<TData>({
table,
}: ComplianceResponsesToolbarActionsProps<TData>) {
const selectedRows = table.getFilteredSelectedRowModel().rows;
const handleDeleteSelected = async () => {
if (selectedRows.length === 0) {
toast.error("삭제할 응답을 선택해주세요.");
return;
}
// TODO: 선택된 응답들 삭제 기능 구현
console.log("Delete selected responses:", selectedRows.map(row => row.original));
toast.success(`${selectedRows.length}개의 응답이 삭제되었습니다.`);
// 페이지 새로고침으로 데이터 업데이트
window.location.reload();
};
const handleExport = () => {
if (selectedRows.length === 0) {
toast.error("내보낼 응답을 선택해주세요.");
return;
}
// TODO: 선택된 응답들 내보내기 기능 구현
console.log("Export selected responses:", selectedRows.map(row => row.original));
toast.success(`${selectedRows.length}개의 응답이 내보내졌습니다.`);
};
return (
<div className="flex items-center gap-2">
{selectedRows.length > 0 && (
<>
<Button
variant="outline"
size="sm"
onClick={handleExport}
className="h-8"
>
<Download className="mr-2 h-4 w-4" />
내보내기 ({selectedRows.length})
</Button>
<Button
variant="destructive"
size="sm"
onClick={handleDeleteSelected}
className="h-8"
>
<Trash2 className="mr-2 h-4 w-4" />
Delete ({selectedRows.length})
</Button>
</>
)}
</div>
);
}
|