diff --git a/package.json b/package.json index 9da4a81..6f5eeaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.4.154", + "version": "6.4.155", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.15.5", diff --git a/src/lib/components/ui/torrentclient/library/table.svelte b/src/lib/components/ui/torrentclient/library/table.svelte index 6299435..ce0941d 100644 --- a/src/lib/components/ui/torrentclient/library/table.svelte +++ b/src/lib/components/ui/torrentclient/library/table.svelte @@ -13,6 +13,7 @@ import { goto } from '$app/navigation' import { FolderSync, Trash } from '$lib/components/icons/animated' + import * as Dialog from '$lib/components/ui/dialog' import { Input } from '$lib/components/ui/input' import * as Table from '$lib/components/ui/table' import { client } from '$lib/modules/anilist' @@ -115,11 +116,11 @@ const { selectedDataIds, someRowsSelected } = pluginStates.select function getSelected () { - return Object.keys($selectedDataIds).map(id => $lib[id as unknown as number]?.hash).filter(e => e) as string[] + return Object.keys($selectedDataIds).map(id => $lib[id as unknown as number]).filter(e => e) as LibraryEntry[] } function rescanTorrents () { - toast.promise(native.rescanTorrents(getSelected()), { + toast.promise(native.rescanTorrents(getSelected().map(e => e.hash)), { loading: 'Rescanning torrents...', success: 'Rescan complete', error: e => { @@ -129,11 +130,12 @@ description: 'This may take a VERY long while depending on the number of torrents.' }) } + function deleteTorrents () { toast.promise( - native.deleteTorrents(getSelected()) + native.deleteTorrents(getSelected().map(e => e.hash)) .then(() => server.updateLibrary() - .then(() => pluginStates.select.allPageRowsSelected.set(false)) + .then(() => pluginStates.select.selectedDataIds.clear()) ), { loading: 'Deleting torrents...', success: 'Torrents deleted', @@ -160,9 +162,36 @@ - + + + + + + + Are you absolutely sure? + + You are about to permanently delete {$someRowsSelected ? Object.keys($selectedDataIds).length : '0'} torrent(s) from your library. This action cannot be undone. + +
    + {#each getSelected() as entry (entry.hash)} +
  • {entry.name}
  • + {/each} +
+
+ + + + + + + + +
+
{Object.keys($selectedDataIds).length} of {$rows.length} row(s) selected.