feat(notes): liens internes, onglet Réseau, living blocks et consentement IA
Rend les liens entre notes visibles et persistants (sync NoteLink au save, auto-save, graphe réseau rafraîchi), ajoute living blocks, Memory Echo, recherche globale, consentement IA explicite et consolide les prototypes design en architectural-grid. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
44
memento-note/context/search-modal-context.tsx
Normal file
44
memento-note/context/search-modal-context.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
'use client'
|
||||
|
||||
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react'
|
||||
import { SearchModal } from '@/components/search-modal'
|
||||
|
||||
interface SearchModalContextValue {
|
||||
open: () => void
|
||||
close: () => void
|
||||
}
|
||||
|
||||
const SearchModalContext = createContext<SearchModalContextValue>({
|
||||
open: () => {},
|
||||
close: () => {},
|
||||
})
|
||||
|
||||
export function useSearchModal() {
|
||||
return useContext(SearchModalContext)
|
||||
}
|
||||
|
||||
export function SearchModalProvider({ children }: { children: ReactNode }) {
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
const open = () => setIsOpen(true)
|
||||
const close = () => setIsOpen(false)
|
||||
|
||||
// Global keyboard shortcut: Ctrl+K or Cmd+K
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
|
||||
e.preventDefault()
|
||||
setIsOpen(prev => !prev)
|
||||
}
|
||||
}
|
||||
window.addEventListener('keydown', handleKeyDown)
|
||||
return () => window.removeEventListener('keydown', handleKeyDown)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<SearchModalContext.Provider value={{ open, close }}>
|
||||
{children}
|
||||
<SearchModal isOpen={isOpen} onClose={close} />
|
||||
</SearchModalContext.Provider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user