mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 15:55:55 +02:00
Vault picker: remove a vault from the Recent list (#93); fix Tasks view showing "All Notes" as the mobile header title
This commit is contained in:
@@ -20,6 +20,10 @@ export async function openVault(path: string): Promise<void> {
|
||||
return invoke("open_vault", { path });
|
||||
}
|
||||
|
||||
export async function removeVault(path: string): Promise<void> {
|
||||
return invoke("remove_vault", { path });
|
||||
}
|
||||
|
||||
export async function getAppConfig(): Promise<AppConfig> {
|
||||
return invoke("get_app_config");
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@
|
||||
{#if $mobileView === 'sidebar'}
|
||||
HelixNotes
|
||||
{:else}
|
||||
{#if $viewMode === 'notebook'}{$activeNotebook?.name ?? 'Notebook'}{:else if $viewMode === 'tag'}#{$activeTag}{:else if $viewMode === 'quickaccess'}Quick Access{:else if $viewMode === 'daily'}Daily Notes{:else if $viewMode === 'trash'}Trash{:else}All Notes{/if}
|
||||
{#if $viewMode === 'notebook'}{$activeNotebook?.name ?? 'Notebook'}{:else if $viewMode === 'tag'}#{$activeTag}{:else if $viewMode === 'quickaccess'}Quick Access{:else if $viewMode === 'daily'}Daily Notes{:else if $viewMode === 'tasks'}Tasks{:else if $viewMode === 'trash'}Trash{:else}All Notes{/if}
|
||||
{/if}
|
||||
</span>
|
||||
{#if $globalUpdateAvailable && $mobileView === 'sidebar'}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
import { documentDir } from '@tauri-apps/api/path';
|
||||
import { openVault, getAppConfig } from '$lib/api';
|
||||
import { openVault, removeVault, getAppConfig } from '$lib/api';
|
||||
import { appConfig, vaultReady } from '$lib/stores/app';
|
||||
import { isAndroid, isIOS, isMobile } from '$lib/platform';
|
||||
import type { VaultConfig } from '$lib/types';
|
||||
@@ -107,6 +107,15 @@
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function forgetVault(path: string) {
|
||||
try {
|
||||
await removeVault(path);
|
||||
$appConfig = await getAppConfig();
|
||||
} catch (e) {
|
||||
error = String(e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
@@ -205,10 +214,18 @@
|
||||
<div class="recent">
|
||||
<span class="recent-label">Recent</span>
|
||||
{#each recentVaults as vault}
|
||||
<button class="vault-item" onclick={() => openSelectedVault(vault.path)}>
|
||||
<span class="vault-name">{vault.name}</span>
|
||||
<span class="vault-path">{vault.path}</span>
|
||||
</button>
|
||||
<div class="vault-row">
|
||||
<button class="vault-item" onclick={() => openSelectedVault(vault.path)}>
|
||||
<span class="vault-name">{vault.name}</span>
|
||||
<span class="vault-path">{vault.path}</span>
|
||||
</button>
|
||||
<button class="vault-remove" title="Remove from list" aria-label="Remove from list" onclick={() => forgetVault(vault.path)}>
|
||||
<svg width="12" height="12" viewBox="0 0 10 10">
|
||||
<line x1="1.5" y1="1.5" x2="8.5" y2="8.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" />
|
||||
<line x1="8.5" y1="1.5" x2="1.5" y2="8.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -389,6 +406,48 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.vault-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.vault-row .vault-item {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.vault-remove {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 36px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
color: var(--text-tertiary);
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s, background 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
.vault-row:hover .vault-remove,
|
||||
.vault-remove:focus-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.vault-remove:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.vault-picker.mobile .vault-remove {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.vault-name-input {
|
||||
margin-bottom: 20px;
|
||||
text-align: left;
|
||||
|
||||
Reference in New Issue
Block a user