refactor: remove tab bar — single note open at a time
Replace the multi-tab model with single-note navigation. One note is open at a time; clicking any note (sidebar, wikilink, relationship) replaces the current note in the editor. Back/Forward history still works via Cmd+[/]. Removed: TabBar component, useClosedTabHistory, tab reorder/close/ reopen logic, Cmd+W/Cmd+Shift+T shortcuts, Close Tab and Reopen Closed Tab menu items, tabLayout utility, and all related tests. Simplified: useTabManagement (single-note), useAppNavigation (no tab lookup), useKeyboardNavigation (note nav only), useNoteCreation (no close-tab cleanup), useDeleteActions (deselect instead of close tab), Editor (no TabBar render), Rust menu (removed 2 menu items). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -213,14 +213,11 @@ describe('useNoteCreation hook', () => {
|
||||
const setToastMessage = vi.fn()
|
||||
const openTabWithContent = vi.fn()
|
||||
const handleSelectNote = vi.fn()
|
||||
const handleCloseTab = vi.fn()
|
||||
const handleCloseTabRef = { current: vi.fn() }
|
||||
|
||||
const makeConfig = (entries: VaultEntry[] = []): NoteCreationConfig => ({
|
||||
addEntry, removeEntry, entries, setToastMessage, vaultPath: '/test/vault',
|
||||
})
|
||||
|
||||
const tabDeps = { openTabWithContent, handleSelectNote, handleCloseTab, handleCloseTabRef }
|
||||
const tabDeps = { openTabWithContent, handleSelectNote }
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
@@ -316,16 +313,4 @@ describe('useNoteCreation hook', () => {
|
||||
expect(setToastMessage).toHaveBeenCalledWith('Failed to create note — disk write error')
|
||||
})
|
||||
|
||||
it('handleCloseTabWithCleanup removes unsaved entry', () => {
|
||||
const clearUnsaved = vi.fn()
|
||||
const unsavedPaths = new Set(['/test/vault/untitled-note.md'])
|
||||
const config = makeConfig()
|
||||
config.clearUnsaved = clearUnsaved
|
||||
config.unsavedPaths = unsavedPaths
|
||||
const { result } = renderHook(() => useNoteCreation(config, tabDeps))
|
||||
act(() => { result.current.handleCloseTabWithCleanup('/test/vault/untitled-note.md') })
|
||||
expect(removeEntry).toHaveBeenCalledWith('/test/vault/untitled-note.md')
|
||||
expect(clearUnsaved).toHaveBeenCalledWith('/test/vault/untitled-note.md')
|
||||
expect(handleCloseTab).toHaveBeenCalledWith('/test/vault/untitled-note.md')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user