fix(ui): перенести таблицу сетевых фильтров на ReUI v9

This commit is contained in:
Denozordec committed 2026-09-14 08:43:08 +07:00
1 parent d47f7ab162
commit 45530cdb99
3 files changed
+55 -11

No files matched your search

+12 -11
View File
@@ -1,23 +1,22 @@
"use client"
import { useMemo, useState } from "react"
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import {
type ColumnDef,
getCoreRowModel,
getSortedRowModel,
useReactTable,
} from "@tanstack/react-table-v8"
useTable,
} from "@tanstack/react-table"
import type { FilterRule, GreTunnel, Server } from "@/lib/data"
import { Flag } from "@/components/flag"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { DataGridShell } from "@/components/data-grids/shared/legacy-data-grid-shell"
import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell"
import {
DATA_GRID_CELL_PAD,
DATA_GRID_CELL_PAD_FIRST,
DATA_GRID_CELL_PAD_LAST,
} from "@/components/data-grids/shared/legacy-data-grid-layout"
import { DataGridSortHeader } from "@/components/data-grids/shared/legacy-data-grid-sort-header"
} from "@/components/data-grids/shared/data-grid-layout"
import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header"
import { EmptyState } from "@/components/empty-state"
import {
AlertCircleIcon,
@@ -210,7 +209,7 @@ function FiltersDataGrid({
onMoveUp,
onMoveDown,
}: FiltersDataGridProps) {
const columns = useMemo<ColumnDef<FilterRule>[]>(
const columns = useMemo<ColumnDef<DataGridFeatures, FilterRule>[]>(
() => [
{
id: "priority",
@@ -242,6 +241,7 @@ function FiltersDataGrid({
<button
type="button"
onClick={() => onMoveUp(row.original.id)}
aria-label={`Поднять правило ${row.original.community}`}
disabled={row.index === 0}
className="text-muted-foreground/50 hover:text-foreground disabled:opacity-20"
>
@@ -250,6 +250,7 @@ function FiltersDataGrid({
<button
type="button"
onClick={() => onMoveDown(row.original.id)}
aria-label={`Опустить правило ${row.original.community}`}
disabled={isLast}
className="text-muted-foreground/50 hover:text-foreground disabled:opacity-20"
>
@@ -349,11 +350,11 @@ function FiltersDataGrid({
],
)
const table = useReactTable({
const table = useTable({
features: dataGridFeatures,
manualPagination: true,
data: rules,
columns,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
getRowId: (row) => row.id,
})