Files
tolaria/src/hooks/useDialogs.ts
Test a093ff4631 feat: add Custom Views UI — create dialog, filter builder, sidebar integration
CreateViewDialog with FilterBuilder for constructing filter conditions
(field/operator/value rows). Wire onCreateView and onDeleteView in App.tsx
with Tauri command integration. Sidebar VIEWS section shows "+" button
for discoverability even when empty, and delete buttons on hover.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 20:54:06 +02:00

44 lines
2.4 KiB
TypeScript

import { useState, useCallback } from 'react'
export function useDialogs() {
const [showCreateTypeDialog, setShowCreateTypeDialog] = useState(false)
const [showQuickOpen, setShowQuickOpen] = useState(false)
const [showCommandPalette, setShowCommandPalette] = useState(false)
const [showAIChat, setShowAIChat] = useState(false)
const [showSettings, setShowSettings] = useState(false)
const [showGitHubVault, setShowGitHubVault] = useState(false)
const [showSearch, setShowSearch] = useState(false)
const [showConflictResolver, setShowConflictResolver] = useState(false)
const [showCreateViewDialog, setShowCreateViewDialog] = useState(false)
const openCreateType = useCallback(() => setShowCreateTypeDialog(true), [])
const closeCreateType = useCallback(() => setShowCreateTypeDialog(false), [])
const openQuickOpen = useCallback(() => setShowQuickOpen(true), [])
const closeQuickOpen = useCallback(() => setShowQuickOpen(false), [])
const openCommandPalette = useCallback(() => setShowCommandPalette(true), [])
const closeCommandPalette = useCallback(() => setShowCommandPalette(false), [])
const openSettings = useCallback(() => setShowSettings(true), [])
const closeSettings = useCallback(() => setShowSettings(false), [])
const openGitHubVault = useCallback(() => setShowGitHubVault(true), [])
const closeGitHubVault = useCallback(() => setShowGitHubVault(false), [])
const toggleAIChat = useCallback(() => setShowAIChat((c) => !c), [])
const openSearch = useCallback(() => setShowSearch(true), [])
const closeSearch = useCallback(() => setShowSearch(false), [])
const openConflictResolver = useCallback(() => setShowConflictResolver(true), [])
const closeConflictResolver = useCallback(() => setShowConflictResolver(false), [])
const openCreateView = useCallback(() => setShowCreateViewDialog(true), [])
const closeCreateView = useCallback(() => setShowCreateViewDialog(false), [])
return {
showCreateTypeDialog, openCreateType, closeCreateType,
showQuickOpen, openQuickOpen, closeQuickOpen,
showCommandPalette, openCommandPalette, closeCommandPalette,
showAIChat, toggleAIChat,
showSettings, openSettings, closeSettings,
showGitHubVault, openGitHubVault, closeGitHubVault,
showSearch, openSearch, closeSearch,
showConflictResolver, openConflictResolver, closeConflictResolver,
showCreateViewDialog, openCreateView, closeCreateView,
}
}