feat: vault management — remove vault from list and restore Getting Started
Add ability to remove vaults from the app list without deleting files on disk, and restore the bundled Getting Started demo vault when needed. Changes: - Rust: add hidden_defaults field to VaultList for tracking removed default vaults - useVaultSwitcher: add removeVault() and restoreGettingStarted() with auto-switch - useCommandRegistry: add 'Remove Vault from List' and 'Restore Getting Started Vault' commands - StatusBar: add X button per vault item in vault menu dropdown - 25 new tests covering removal, restore, edge cases, and command palette Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import type { VaultOption } from '../components/StatusBar'
|
||||
export interface PersistedVaultList {
|
||||
vaults: Array<{ label: string; path: string }>
|
||||
active_vault: string | null
|
||||
hidden_defaults: string[]
|
||||
}
|
||||
|
||||
function tauriCall<T>(command: string, args: Record<string, unknown>): Promise<T> {
|
||||
@@ -20,17 +21,18 @@ async function checkAvailability(v: { label: string; path: string }): Promise<Va
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadVaultList(): Promise<{ vaults: VaultOption[]; activeVault: string | null }> {
|
||||
export async function loadVaultList(): Promise<{ vaults: VaultOption[]; activeVault: string | null; hiddenDefaults: string[] }> {
|
||||
const data = await tauriCall<PersistedVaultList>('load_vault_list', {})
|
||||
const persisted = data?.vaults ?? []
|
||||
const checked = await Promise.all(persisted.map(checkAvailability))
|
||||
return { vaults: checked, activeVault: data?.active_vault ?? null }
|
||||
return { vaults: checked, activeVault: data?.active_vault ?? null, hiddenDefaults: data?.hidden_defaults ?? [] }
|
||||
}
|
||||
|
||||
export function saveVaultList(vaults: VaultOption[], activeVault: string): Promise<void> {
|
||||
export function saveVaultList(vaults: VaultOption[], activeVault: string, hiddenDefaults: string[] = []): Promise<void> {
|
||||
const list: PersistedVaultList = {
|
||||
vaults: vaults.map(v => ({ label: v.label, path: v.path })),
|
||||
active_vault: activeVault,
|
||||
hidden_defaults: hiddenDefaults,
|
||||
}
|
||||
return tauriCall('save_vault_list', { list })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user