From 0fc7bd79854ed5b43bb02eaf7fe8ebe2880b743a Mon Sep 17 00:00:00 2001
From: shuaiplus <2327005759@qq.com>
Date: Mon, 23 Mar 2026 08:32:43 +0800
Subject: [PATCH] feat: implement unarchive functionality for selected ciphers
with state management
---
webapp/src/components/ConfirmDialog.tsx | 3 ---
webapp/src/components/VaultPage.tsx | 23 ++++++++++++++++++++++-
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/webapp/src/components/ConfirmDialog.tsx b/webapp/src/components/ConfirmDialog.tsx
index da12b60..3bc02f2 100644
--- a/webapp/src/components/ConfirmDialog.tsx
+++ b/webapp/src/components/ConfirmDialog.tsx
@@ -1,5 +1,4 @@
import type { ComponentChildren } from 'preact';
-import { Check, X } from 'lucide-preact';
import { t } from '@/lib/i18n';
interface ConfirmDialogProps {
@@ -39,7 +38,6 @@ export default function ConfirmDialog(props: ConfirmDialogProps) {
className={`btn ${props.danger ? 'btn-danger' : 'btn-primary'} dialog-btn`}
disabled={props.confirmDisabled}
>
-
{props.confirmText || t('txt_yes')}
{!props.hideCancel && (
@@ -52,7 +50,6 @@ export default function ConfirmDialog(props: ConfirmDialogProps) {
props.onCancel();
}}
>
-
{props.cancelText || t('txt_no')}
)}
diff --git a/webapp/src/components/VaultPage.tsx b/webapp/src/components/VaultPage.tsx
index 7947a2b..8479a28 100644
--- a/webapp/src/components/VaultPage.tsx
+++ b/webapp/src/components/VaultPage.tsx
@@ -700,6 +700,27 @@ function folderName(id: string | null | undefined): string {
}
}
+ async function handleUnarchiveSelected(cipher: Cipher): Promise {
+ setBusy(true);
+ try {
+ await props.onUnarchive(cipher);
+ if (sidebarFilter.kind === 'archive') {
+ const remaining = filteredCiphers.filter((item) => item.id !== cipher.id);
+ setSelectedMap((prev) => {
+ const next = { ...prev };
+ delete next[cipher.id];
+ return next;
+ });
+ setSelectedCipherId(remaining[0]?.id || '');
+ if (isMobileLayout && remaining.length === 0) {
+ setMobilePanel('list');
+ }
+ }
+ } finally {
+ setBusy(false);
+ }
+ }
+
async function confirmBulkArchive(): Promise {
const ids = Object.entries(selectedMap)
.filter(([, selected]) => selected)
@@ -906,7 +927,7 @@ function folderName(id: string | null | undefined): string {
onStartEdit={startEdit}
onDelete={setPendingDelete}
onArchive={(cipher) => setPendingArchive(cipher)}
- onUnarchive={props.onUnarchive}
+ onUnarchive={(cipher) => void handleUnarchiveSelected(cipher)}
/>
)}