2025-04-28 21:14:09 -04:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import {
|
|
|
|
ColumnDef,
|
|
|
|
flexRender,
|
|
|
|
getCoreRowModel,
|
|
|
|
useReactTable,
|
|
|
|
getPaginationRowModel,
|
|
|
|
SortingState,
|
|
|
|
getSortedRowModel,
|
|
|
|
ColumnFiltersState,
|
|
|
|
getFilteredRowModel
|
|
|
|
} from "@tanstack/react-table";
|
|
|
|
|
|
|
|
import {
|
|
|
|
Table,
|
|
|
|
TableBody,
|
|
|
|
TableCell,
|
|
|
|
TableContainer,
|
|
|
|
TableHead,
|
|
|
|
TableHeader,
|
|
|
|
TableRow
|
|
|
|
} from "@/components/ui/table";
|
|
|
|
import { Button } from "@app/components/ui/button";
|
|
|
|
import { useState } from "react";
|
|
|
|
import { Input } from "@app/components/ui/input";
|
|
|
|
import { DataTablePagination } from "@app/components/DataTablePagination";
|
|
|
|
import { Plus, Search } from "lucide-react";
|
|
|
|
import { DataTable } from "@app/components/ui/data-table";
|
2025-05-06 15:01:29 +03:00
|
|
|
import { useTranslations } from "next-intl";
|
2025-04-28 21:14:09 -04:00
|
|
|
|
|
|
|
interface DataTableProps<TData, TValue> {
|
|
|
|
columns: ColumnDef<TData, TValue>[];
|
|
|
|
data: TData[];
|
|
|
|
addApiKey?: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ApiKeysDataTable<TData, TValue>({
|
|
|
|
addApiKey,
|
|
|
|
columns,
|
|
|
|
data
|
|
|
|
}: DataTableProps<TData, TValue>) {
|
2025-05-06 15:01:29 +03:00
|
|
|
|
|
|
|
const t = useTranslations();
|
2025-04-28 21:14:09 -04:00
|
|
|
return (
|
|
|
|
<DataTable
|
|
|
|
columns={columns}
|
|
|
|
data={data}
|
2025-05-06 15:01:29 +03:00
|
|
|
title={t('apiKeys')}
|
|
|
|
searchPlaceholder={t('searchApiKeys')}
|
2025-04-28 21:14:09 -04:00
|
|
|
searchColumn="name"
|
|
|
|
onAdd={addApiKey}
|
2025-05-06 15:01:29 +03:00
|
|
|
addButtonText={t('apiKeysAdd')}
|
2025-04-28 21:14:09 -04:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|