diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index a5fc335..87c16d7 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -30,7 +30,7 @@ interface Scratch { } const MEILISEARCH_ENDPOINT = 'https://meili.site.quack-lab.dev/'; -const MEILISEARCH_API_KEY = 'F46V628fnzK85P376Q95n7987Z95M2MG673ea325982tD9v7236ix8XH54Xx26q6'; +const MEILISEARCH_API_KEY = '31qXgGbQ3lT4DYHQ0TOKpMzh7wcigs7agHyxP5Fz6T6D61xsvNr24uO8ifndKOfM'; const NOTE_INDEX = 'notes'; const SCRATCH_INDEX = 'scratch'; const SETTINGS_INDEX = 'settings'; @@ -633,9 +633,7 @@ const Index = () => { if (e.ctrlKey && e.key === 'f') { e.preventDefault(); setIsSearchOpen(true); - setTimeout(() => { - searchInputRef.current?.focus(); - }, 100); + searchInputRef.current?.focus(); } else if (e.key === 'Escape') { e.preventDefault(); // Save current note if it has content @@ -654,7 +652,7 @@ const Index = () => { try { const win = await Window.getCurrent(); await win.close(); - + } catch (error) { console.error('Failed to close window:', error); } @@ -674,15 +672,6 @@ const Index = () => { }; }, [currentNote, previousNote, scratchPad, isPreviousNoteModified]); - // Focus search input when dialog opens - useEffect(() => { - if (isSearchOpen) { - setTimeout(() => { - searchInputRef.current?.focus(); - }, 100); - } - }, [isSearchOpen]); - // Auto-save functions const handleCurrentNoteBlur = () => { if (currentNote.trim()) { @@ -810,7 +799,7 @@ const Index = () => { const initializeIndexes = async () => { try { // Initialize notes index - if (!await indexExists(NOTE_INDEX)) { + if (!(await indexExists(NOTE_INDEX))) { await fetch(`${MEILISEARCH_ENDPOINT}/indexes`, { method: 'POST', headers: { @@ -854,7 +843,7 @@ const Index = () => { }); // Initialize scratch index - if (!await indexExists(SCRATCH_INDEX)) { + if (!(await indexExists(SCRATCH_INDEX))) { await fetch(`${MEILISEARCH_ENDPOINT}/indexes`, { method: 'POST', headers: { @@ -888,7 +877,7 @@ const Index = () => { }); // Initialize settings index - if (!await indexExists(SETTINGS_INDEX)) { + if (!(await indexExists(SETTINGS_INDEX))) { await fetch(`${MEILISEARCH_ENDPOINT}/indexes`, { method: 'POST', headers: { @@ -1095,7 +1084,6 @@ const Index = () => { setCurrentNote(e.target.value); }} onBlur={handleCurrentNoteBlur} - autoFocus className={`h-[calc(100%-2rem)] border-0 resize-none focus:ring-0 text-slate-200 bg-transparent ${getTextClass('2xl')}`} placeholder="Start writing your thoughts..." />