Phase 3 implementation. Coordinate system implemented. Initial text box tool implemented.
Some checks failed
Automated Container Build / build-and-push (push) Failing after 4s
CI / Backend (Python) (push) Failing after 17s
CI / Frontend (TypeScript) (push) Failing after 4m48s

This commit is contained in:
Elijah 2026-06-12 16:30:07 -07:00
parent c159ad4f37
commit 4cb038ec78
34 changed files with 6676 additions and 130 deletions

View file

@ -1,6 +1,6 @@
import { create } from 'zustand'
import { libraryApi } from './api'
import type { DocumentMeta } from './types'
import type { DocumentMeta, DocumentUpdateRequest } from './types'
interface LibraryState {
documents: DocumentMeta[]
@ -25,6 +25,7 @@ interface LibraryState {
bulkRestore: () => Promise<void>
emptyTrash: () => Promise<void>
setSearchQuery: (query: string) => void
updateDocument: (id: string, data: DocumentUpdateRequest) => Promise<void>
}
export const useLibrary = create<LibraryState>((set, get) => ({
@ -176,5 +177,19 @@ export const useLibrary = create<LibraryState>((set, get) => ({
set({ error: err.error?.message || err.message, isLoading: false })
throw err
}
},
updateDocument: async (id: string, data: DocumentUpdateRequest) => {
set({ isLoading: true, error: null })
try {
const updatedDoc = await libraryApi.updateDocument(id, data)
set((state) => ({
documents: state.documents.map(d => d.id === id ? updatedDoc : d),
isLoading: false
}))
} catch (err: any) {
set({ error: err.error?.message || err.message, isLoading: false })
throw err
}
}
}))