mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
feat: refactor unarchive handling to support bulk unarchive and update prop types
This commit is contained in:
@@ -703,19 +703,12 @@ function folderName(id: string | null | undefined): string {
|
|||||||
async function handleUnarchiveSelected(cipher: Cipher): Promise<void> {
|
async function handleUnarchiveSelected(cipher: Cipher): Promise<void> {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
try {
|
try {
|
||||||
await props.onUnarchive(cipher);
|
await props.onBulkUnarchive([cipher.id]);
|
||||||
if (sidebarFilter.kind === 'archive') {
|
setSelectedMap((prev) => {
|
||||||
const remaining = filteredCiphers.filter((item) => item.id !== cipher.id);
|
const next = { ...prev };
|
||||||
setSelectedMap((prev) => {
|
delete next[cipher.id];
|
||||||
const next = { ...prev };
|
return next;
|
||||||
delete next[cipher.id];
|
});
|
||||||
return next;
|
|
||||||
});
|
|
||||||
setSelectedCipherId(remaining[0]?.id || '');
|
|
||||||
if (isMobileLayout && remaining.length === 0) {
|
|
||||||
setMobilePanel('list');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ interface VaultDetailViewProps {
|
|||||||
onDownloadAttachment: (cipher: Cipher, attachmentId: string) => void;
|
onDownloadAttachment: (cipher: Cipher, attachmentId: string) => void;
|
||||||
onStartEdit: () => void;
|
onStartEdit: () => void;
|
||||||
onDelete: (cipher: Cipher) => void;
|
onDelete: (cipher: Cipher) => void;
|
||||||
onArchive: (cipher: Cipher) => Promise<void>;
|
onArchive: (cipher: Cipher) => void | Promise<void>;
|
||||||
onUnarchive: (cipher: Cipher) => Promise<void>;
|
onUnarchive: (cipher: Cipher) => void | Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function VaultDetailView(props: VaultDetailViewProps) {
|
export default function VaultDetailView(props: VaultDetailViewProps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user