mirror of
https://github.com/SkalaraAI/skalara-core.git
synced 2025-04-09 23:20:15 -04:00
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
import { Table } from "@tanstack/react-table";
|
|
// import CreateProject from "@/components/workspace/dashboard/create-project";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Input } from "@/components/ui/input";
|
|
import { DataTableViewOptions } from "@/components/task-table/data-table-view-options";
|
|
|
|
import { priorities, statuses } from "@/components/task-table/data";
|
|
import { DataTableFacetedFilter } from "./data-table-faceted-filter";
|
|
|
|
interface DataTableToolbarProps<TData> {
|
|
table: Table<TData>;
|
|
}
|
|
|
|
export function DataTableToolbar<TData>({
|
|
table,
|
|
}: DataTableToolbarProps<TData>) {
|
|
const isFiltered = table.getState().columnFilters.length > 0;
|
|
|
|
return (
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex flex-1 items-center space-x-2">
|
|
<Input
|
|
placeholder="Filter project names..."
|
|
value={(table.getColumn("name")?.getFilterValue() as string) ?? ""}
|
|
onChange={(event) =>
|
|
table.getColumn("name")?.setFilterValue(event.target.value)
|
|
}
|
|
className="h-8 w-[150px] lg:w-[250px]"
|
|
/>
|
|
{table.getColumn("status") && (
|
|
<DataTableFacetedFilter
|
|
column={table.getColumn("status")}
|
|
title="Status"
|
|
options={statuses}
|
|
/>
|
|
)}
|
|
{table.getColumn("priority") && (
|
|
<DataTableFacetedFilter
|
|
column={table.getColumn("priority")}
|
|
title="Priority"
|
|
options={priorities}
|
|
/>
|
|
)}
|
|
{isFiltered && (
|
|
<Button
|
|
variant="ghost"
|
|
onClick={() => table.resetColumnFilters()}
|
|
className="h-8 px-2 lg:px-3"
|
|
>
|
|
Reset
|
|
<Cross2Icon className="ml-2 h-4 w-4" />
|
|
</Button>
|
|
)}
|
|
</div>
|
|
{/* <CreateProject text="Create Project" /> */}
|
|
<DataTableViewOptions table={table} />
|
|
</div>
|
|
);
|
|
}
|