fix(ui): подтверждать удаление правил Filters
This commit is contained in:
1 parent
8412ba9bbe
commit
c4011cfaff
6 files changed
+154
-19
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useMemo, useState } from "react"
|
||||
import { useMemo } from "react"
|
||||
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
|
||||
import {
|
||||
type ColumnDef,
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header"
|
||||
import { EmptyState } from "@/components/empty-state"
|
||||
import {
|
||||
AlertCircleIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
PencilIcon,
|
||||
@@ -152,7 +151,6 @@ function FilterRowActions({
|
||||
onEdit: () => void
|
||||
onDelete: () => void
|
||||
}) {
|
||||
const [confirmDel, setConfirmDel] = useState(false)
|
||||
return (
|
||||
<div className="flex items-center gap-0.5 justify-end opacity-0 transition-opacity group-hover/row:opacity-100 focus-within:opacity-100">
|
||||
<Button
|
||||
@@ -167,19 +165,11 @@ function FilterRowActions({
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className={cn(
|
||||
"size-7 p-0 transition-colors",
|
||||
confirmDel
|
||||
? "text-destructive bg-destructive/10 hover:bg-destructive/20"
|
||||
: "text-muted-foreground hover:text-destructive",
|
||||
)}
|
||||
onClick={() => {
|
||||
if (!confirmDel) setConfirmDel(true)
|
||||
else onDelete()
|
||||
}}
|
||||
onBlur={() => setConfirmDel(false)}
|
||||
className="size-7 p-0 text-muted-foreground hover:text-destructive"
|
||||
onClick={onDelete}
|
||||
aria-label="Удалить правило"
|
||||
>
|
||||
{confirmDel ? <AlertCircleIcon className="size-3.5" /> : <TrashIcon className="size-3.5" />}
|
||||
<TrashIcon className="size-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user