fix: remove onRowClick conflict with rowExpansion, clean up imports
This commit is contained in:
3 files changed
+1
-11
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 471 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 459 KiB |
@@ -3,20 +3,17 @@
|
|||||||
import "../widgets-common.css";
|
import "../widgets-common.css";
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
import { useCallback, useMemo, useRef, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Avatar,
|
Avatar,
|
||||||
Badge,
|
Badge,
|
||||||
Box,
|
Box,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
|
||||||
Group,
|
Group,
|
||||||
Menu,
|
Menu,
|
||||||
Portal,
|
Portal,
|
||||||
Progress,
|
Progress,
|
||||||
ScrollArea,
|
|
||||||
SegmentedControl,
|
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -24,8 +21,6 @@ import {
|
|||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import {
|
import {
|
||||||
IconChevronDown,
|
|
||||||
IconChevronRight,
|
|
||||||
IconCopy,
|
IconCopy,
|
||||||
IconDownload,
|
IconDownload,
|
||||||
IconFilter,
|
IconFilter,
|
||||||
@@ -36,7 +31,6 @@ import {
|
|||||||
IconTrash,
|
IconTrash,
|
||||||
IconTrashX,
|
IconTrashX,
|
||||||
IconUpload,
|
IconUpload,
|
||||||
IconX,
|
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
@@ -415,9 +409,6 @@ export default function DownloadClientsWidget({
|
|||||||
|
|
||||||
const closeContextMenu = useCallback(() => setContextMenu(null), []);
|
const closeContextMenu = useCallback(() => setContextMenu(null), []);
|
||||||
|
|
||||||
const toggleExpand = useCallback((id: string) => {
|
|
||||||
setExpandedIds((prev) => prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const totalSpeed = clients.reduce((sum, c) => sum + (c.status?.rates.down ?? 0), 0);
|
const totalSpeed = clients.reduce((sum, c) => sum + (c.status?.rates.down ?? 0), 0);
|
||||||
const totalUpSpeed = clients.reduce((sum, c) => sum + (c.status?.rates.up ?? 0), 0);
|
const totalUpSpeed = clients.reduce((sum, c) => sum + (c.status?.rates.up ?? 0), 0);
|
||||||
@@ -461,7 +452,6 @@ export default function DownloadClientsWidget({
|
|||||||
height="100%"
|
height="100%"
|
||||||
className="downloads-table"
|
className="downloads-table"
|
||||||
onRowContextMenu={isEditMode ? undefined : handleContextMenu}
|
onRowContextMenu={isEditMode ? undefined : handleContextMenu}
|
||||||
onRowClick={isEditMode ? undefined : ({ record }) => toggleExpand(record.id)}
|
|
||||||
rowExpansion={{
|
rowExpansion={{
|
||||||
allowMultiple: true,
|
allowMultiple: true,
|
||||||
expanded: { recordIds: expandedIds, onRecordIdsChange: setExpandedIds },
|
expanded: { recordIds: expandedIds, onRecordIdsChange: setExpandedIds },
|
||||||
|
|||||||
Reference in new issue
Block a user