2026-02-22 18:42:33 +01:00
|
|
|
import { useState, useCallback } from 'react'
|
2026-04-04 02:50:49 +02:00
|
|
|
import type { ViewDefinition } from '../types'
|
2026-02-22 18:42:33 +01:00
|
|
|
|
|
|
|
|
export function useDialogs() {
|
|
|
|
|
const [showCreateTypeDialog, setShowCreateTypeDialog] = useState(false)
|
|
|
|
|
const [showQuickOpen, setShowQuickOpen] = useState(false)
|
2026-02-25 13:31:19 +01:00
|
|
|
const [showCommandPalette, setShowCommandPalette] = useState(false)
|
2026-02-22 18:42:33 +01:00
|
|
|
const [showAIChat, setShowAIChat] = useState(false)
|
|
|
|
|
const [showSettings, setShowSettings] = useState(false)
|
2026-04-12 17:08:07 +02:00
|
|
|
const [showCloneVault, setShowCloneVault] = useState(false)
|
feat: full-text search with qmd backend and SearchPanel UI (Cmd+Shift+F) (#64)
* feat: add search backend (qmd CLI) and design file
- Add search.rs: qmd integration for keyword (BM25), semantic (vsearch),
and hybrid search modes via CLI JSON output
- Register search_vault Tauri command in lib.rs
- Design file with 3 frames: empty, results, no-results states
- Fix pre-existing test failures: install @tauri-apps/plugin-opener,
add mock in test setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add SearchPanel UI with Cmd+Shift+F shortcut
- SearchPanel component: full-text search overlay with keyword/semantic
mode toggle, debounced search (200ms), arrow key navigation, result
count + elapsed time display, note type badges from vault entries
- Cmd+Shift+F shortcut registered in useAppKeyboard
- Mock search_vault handler in mock-tauri for browser dev mode
- SearchResult/SearchResponse types in types.ts
- Tests: 15 new tests for SearchPanel + 2 for keyboard shortcut
- scrollIntoView mock in test setup for jsdom compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: correct SearchPanel imports for Tauri/browser dual-mode
Use invoke from @tauri-apps/api/core and mockInvoke from mock-tauri
with a searchCall wrapper, fixing the TypeScript build error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: make test_detect_collection_fallback robust when qmd not installed
* fix: reset localStorage between App tests to prevent view mode state leak
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:09:50 +01:00
|
|
|
const [showSearch, setShowSearch] = useState(false)
|
2026-03-03 02:27:42 +01:00
|
|
|
const [showConflictResolver, setShowConflictResolver] = useState(false)
|
2026-04-02 20:54:06 +02:00
|
|
|
const [showCreateViewDialog, setShowCreateViewDialog] = useState(false)
|
2026-05-12 19:33:53 +02:00
|
|
|
const [editingView, setEditingView] = useState<{ filename: string; definition: ViewDefinition; rootPath?: string } | null>(null)
|
2026-02-22 18:42:33 +01:00
|
|
|
|
|
|
|
|
const openCreateType = useCallback(() => setShowCreateTypeDialog(true), [])
|
|
|
|
|
const closeCreateType = useCallback(() => setShowCreateTypeDialog(false), [])
|
|
|
|
|
const openQuickOpen = useCallback(() => setShowQuickOpen(true), [])
|
|
|
|
|
const closeQuickOpen = useCallback(() => setShowQuickOpen(false), [])
|
2026-02-25 13:31:19 +01:00
|
|
|
const openCommandPalette = useCallback(() => setShowCommandPalette(true), [])
|
|
|
|
|
const closeCommandPalette = useCallback(() => setShowCommandPalette(false), [])
|
2026-02-22 18:42:33 +01:00
|
|
|
const openSettings = useCallback(() => setShowSettings(true), [])
|
|
|
|
|
const closeSettings = useCallback(() => setShowSettings(false), [])
|
2026-04-12 17:08:07 +02:00
|
|
|
const openCloneVault = useCallback(() => setShowCloneVault(true), [])
|
|
|
|
|
const closeCloneVault = useCallback(() => setShowCloneVault(false), [])
|
2026-02-22 18:42:33 +01:00
|
|
|
const toggleAIChat = useCallback(() => setShowAIChat((c) => !c), [])
|
feat: full-text search with qmd backend and SearchPanel UI (Cmd+Shift+F) (#64)
* feat: add search backend (qmd CLI) and design file
- Add search.rs: qmd integration for keyword (BM25), semantic (vsearch),
and hybrid search modes via CLI JSON output
- Register search_vault Tauri command in lib.rs
- Design file with 3 frames: empty, results, no-results states
- Fix pre-existing test failures: install @tauri-apps/plugin-opener,
add mock in test setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add SearchPanel UI with Cmd+Shift+F shortcut
- SearchPanel component: full-text search overlay with keyword/semantic
mode toggle, debounced search (200ms), arrow key navigation, result
count + elapsed time display, note type badges from vault entries
- Cmd+Shift+F shortcut registered in useAppKeyboard
- Mock search_vault handler in mock-tauri for browser dev mode
- SearchResult/SearchResponse types in types.ts
- Tests: 15 new tests for SearchPanel + 2 for keyboard shortcut
- scrollIntoView mock in test setup for jsdom compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: correct SearchPanel imports for Tauri/browser dual-mode
Use invoke from @tauri-apps/api/core and mockInvoke from mock-tauri
with a searchCall wrapper, fixing the TypeScript build error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: make test_detect_collection_fallback robust when qmd not installed
* fix: reset localStorage between App tests to prevent view mode state leak
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:09:50 +01:00
|
|
|
const openSearch = useCallback(() => setShowSearch(true), [])
|
|
|
|
|
const closeSearch = useCallback(() => setShowSearch(false), [])
|
2026-03-03 02:27:42 +01:00
|
|
|
const openConflictResolver = useCallback(() => setShowConflictResolver(true), [])
|
|
|
|
|
const closeConflictResolver = useCallback(() => setShowConflictResolver(false), [])
|
2026-04-04 02:50:49 +02:00
|
|
|
const openCreateView = useCallback(() => { setEditingView(null); setShowCreateViewDialog(true) }, [])
|
|
|
|
|
const closeCreateView = useCallback(() => { setShowCreateViewDialog(false); setEditingView(null) }, [])
|
2026-05-12 19:33:53 +02:00
|
|
|
const openEditView = useCallback((filename: string, definition: ViewDefinition, rootPath?: string) => {
|
|
|
|
|
setEditingView({ filename, definition, rootPath })
|
2026-04-04 02:50:49 +02:00
|
|
|
setShowCreateViewDialog(true)
|
|
|
|
|
}, [])
|
2026-02-22 18:42:33 +01:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
showCreateTypeDialog, openCreateType, closeCreateType,
|
|
|
|
|
showQuickOpen, openQuickOpen, closeQuickOpen,
|
2026-02-25 13:31:19 +01:00
|
|
|
showCommandPalette, openCommandPalette, closeCommandPalette,
|
2026-02-22 18:42:33 +01:00
|
|
|
showAIChat, toggleAIChat,
|
|
|
|
|
showSettings, openSettings, closeSettings,
|
2026-04-12 17:08:07 +02:00
|
|
|
showCloneVault, openCloneVault, closeCloneVault,
|
feat: full-text search with qmd backend and SearchPanel UI (Cmd+Shift+F) (#64)
* feat: add search backend (qmd CLI) and design file
- Add search.rs: qmd integration for keyword (BM25), semantic (vsearch),
and hybrid search modes via CLI JSON output
- Register search_vault Tauri command in lib.rs
- Design file with 3 frames: empty, results, no-results states
- Fix pre-existing test failures: install @tauri-apps/plugin-opener,
add mock in test setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add SearchPanel UI with Cmd+Shift+F shortcut
- SearchPanel component: full-text search overlay with keyword/semantic
mode toggle, debounced search (200ms), arrow key navigation, result
count + elapsed time display, note type badges from vault entries
- Cmd+Shift+F shortcut registered in useAppKeyboard
- Mock search_vault handler in mock-tauri for browser dev mode
- SearchResult/SearchResponse types in types.ts
- Tests: 15 new tests for SearchPanel + 2 for keyboard shortcut
- scrollIntoView mock in test setup for jsdom compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: correct SearchPanel imports for Tauri/browser dual-mode
Use invoke from @tauri-apps/api/core and mockInvoke from mock-tauri
with a searchCall wrapper, fixing the TypeScript build error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: make test_detect_collection_fallback robust when qmd not installed
* fix: reset localStorage between App tests to prevent view mode state leak
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:09:50 +01:00
|
|
|
showSearch, openSearch, closeSearch,
|
2026-03-03 02:27:42 +01:00
|
|
|
showConflictResolver, openConflictResolver, closeConflictResolver,
|
2026-04-04 02:50:49 +02:00
|
|
|
showCreateViewDialog, openCreateView, closeCreateView, editingView, openEditView,
|
2026-02-22 18:42:33 +01:00
|
|
|
}
|
|
|
|
|
}
|