feat(blender): implement advanced blender features and fixes

This commit addresses several issues and implements new features for the Seed Blender based on user feedback.

- **Flexible QR Scanning**: `QRScanner` is now content-agnostic. `SeedBlender` detects QR content type (Plain Text, Krux, SeedPGP) and triggers the appropriate workflow.
- **Per-Row Decryption**: Replaces the global security panel with a per-row password input for encrypted mnemonics, allowing multiple different encrypted seeds to be used.
- **Data Loss Warning**: Implements a confirmation dialog that warns the user if they try to switch tabs with unsaved data in the blender, preventing accidental data loss.
- **Final Mnemonic Actions**: Adds 'Transfer to Backup' and 'Export as QR' buttons to the final mnemonic display, allowing the user to utilize the generated seed.
- **Refactors `SeedBlender` state management** around a `MnemonicEntry` interface for robustness and clarity.
This commit is contained in:
LC mac
2026-02-04 12:54:17 +08:00
parent b918d88a47
commit c2aeb4ce83
4 changed files with 325 additions and 439 deletions

View File

@@ -26,7 +26,7 @@ interface HeaderProps {
events: ClipboardEvent[];
onOpenClipboardModal: () => void;
activeTab: 'backup' | 'restore' | 'seedblender';
setActiveTab: (tab: 'backup' | 'restore' | 'seedblender') => void;
onRequestTabChange: (tab: 'backup' | 'restore' | 'seedblender') => void;
encryptedMnemonicCache: any;
handleLockAndClear: () => void;
appVersion: string;
@@ -42,7 +42,7 @@ const Header: React.FC<HeaderProps> = ({
events,
onOpenClipboardModal,
activeTab,
setActiveTab,
onRequestTabChange,
encryptedMnemonicCache,
handleLockAndClear,
appVersion,
@@ -91,19 +91,19 @@ const Header: React.FC<HeaderProps> = ({
)}
<button
className={`px-4 py-2 rounded-lg ${activeTab === 'backup' ? 'bg-teal-500 hover:bg-teal-600' : 'bg-slate-700 hover:bg-slate-600'}`}
onClick={() => setActiveTab('backup')}
onClick={() => onRequestTabChange('backup')}
>
Backup
</button>
<button
className={`px-4 py-2 rounded-lg ${activeTab === 'restore' ? 'bg-teal-500 hover:bg-teal-600' : 'bg-slate-700 hover:bg-slate-600'}`}
onClick={() => setActiveTab('restore')}
onClick={() => onRequestTabChange('restore')}
>
Restore
</button>
<button
className={`px-4 py-2 rounded-lg ${activeTab === 'seedblender' ? 'bg-teal-500 hover:bg-teal-600' : 'bg-slate-700 hover:bg-slate-600'}`}
onClick={() => setActiveTab('seedblender')}
onClick={() => onRequestTabChange('seedblender')}
>
Seed Blender
</button>