feat(accounts): add multi-selection and batch removal

Support Windows-style single and Ctrl/Cmd additive row selection, clear selections with Escape, and show the selected count on the removal action. Remove selected accounts behind one confirmation, strengthen the selected-row treatment, and delete the redundant global account activation switch so individual account toggles remain authoritative.
This commit is contained in:
Sucukdeluxe
2026-08-15 01:47:32 +02:00
parent 8a112747fc
commit 007235bb38
6 changed files with 156 additions and 143 deletions
+18 -21
View File
@@ -36,6 +36,24 @@ export function pruneAccountRowSelection(selectedRowKey: string | null, existing
return selectedRowKey && existingRowKeys.includes(selectedRowKey) ? selectedRowKey : null;
}
export function updateAccountRowSelection(selectedRowKeys: readonly string[], rowKey: string, additive: boolean): string[] {
if (!additive) {
return [rowKey];
}
const next = new Set(selectedRowKeys);
if (next.has(rowKey)) {
next.delete(rowKey);
} else {
next.add(rowKey);
}
return [...next];
}
export function pruneAccountRowSelections(selectedRowKeys: readonly string[], existingRowKeys: readonly string[]): string[] {
const existing = new Set(existingRowKeys);
return [...new Set(selectedRowKeys)].filter((rowKey) => existing.has(rowKey));
}
export function resolveVisibleAccountKind<T extends string>(currentKind: T | null, visibleKinds: readonly T[]): T | null {
return currentKind && visibleKinds.includes(currentKind) ? currentKind : visibleKinds[0] ?? null;
}
@@ -106,24 +124,3 @@ export function buildScopedAccountEnabledState(
: [...new Set([...currentDisabledAccountIds, accountId])]
};
}
export function buildBulkAccountEnabledState(
currentDisabledProviders: DebridProvider[],
configuredProviders: DebridProvider[],
megaAccountIds: string[],
debridLinkKeyIds: string[],
enabled: boolean
): {
disabledProviders: DebridProvider[];
megaDebridDisabledAccountIds: string[];
debridLinkDisabledKeyIds: string[];
} {
const configured = new Set(configuredProviders);
return {
disabledProviders: enabled
? currentDisabledProviders.filter((provider) => !configured.has(provider))
: [...new Set([...currentDisabledProviders, ...configuredProviders])],
megaDebridDisabledAccountIds: enabled ? [] : [...new Set(megaAccountIds)],
debridLinkDisabledKeyIds: enabled ? [] : [...new Set(debridLinkKeyIds)]
};
}