fix: resolve double-click and redownload issues

- Use `e.detail === 2` for double clicks in `DownloadTable.tsx`
- Add `user-select: none` to list items in `index.css`
- Delete existing assets before enqueueing in `redownload` action
- Remove redundant `onDoubleClick` props from `DownloadItem.tsx`
This commit is contained in:
NimBold
2026-06-25 14:01:42 +03:30
parent 8eb1a55e72
commit b4ff14805b
4 changed files with 25 additions and 47 deletions
-3
View File
@@ -13,7 +13,6 @@ interface DownloadItemProps {
setContextMenu: (menu: { x: number; y: number; id: string }) => void;
handlePause: (id: string) => void;
handleResume: (item: DownloadItemType) => void;
handleDoubleClick: (item: DownloadItemType) => void;
getCategoryIcon: (category: string) => React.ReactNode;
isSelected: boolean;
onClick: (e: React.MouseEvent, item: DownloadItemType) => void;
@@ -26,7 +25,6 @@ export const DownloadItem = React.memo<DownloadItemProps>(({
setContextMenu,
handlePause,
handleResume,
handleDoubleClick,
getCategoryIcon,
isSelected,
onClick,
@@ -90,7 +88,6 @@ export const DownloadItem = React.memo<DownloadItemProps>(({
e.preventDefault();
setContextMenu({ x: e.clientX, y: e.clientY, id: download.id });
}}
onDoubleClick={() => handleDoubleClick(download)}
>
<div className="download-file-cell">
<span className="shrink-0 text-text-muted">
+4 -1
View File
@@ -189,6 +189,10 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
? [...filteredDownloads].sort((left, right) => (left.queuePosition ?? 0) - (right.queuePosition ?? 0))
: filteredDownloads;
const handleItemClick = (e: React.MouseEvent, item: DownloadItem) => {
if (e.detail === 2) {
handleDownloadDoubleClick(item);
return;
}
if (e.metaKey || e.ctrlKey) {
const newSelected = new Set(selectedIds);
if (newSelected.has(item.id)) {
@@ -372,7 +376,6 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
setContextMenu={handleContextMenu}
handlePause={handlePause}
handleResume={handleResume}
handleDoubleClick={handleDownloadDoubleClick}
getCategoryIcon={getCategoryIcon}
isSelected={selectedIds.has(d.id)}
onClick={handleItemClick}