diff --git a/frontend/src/desktop/components/DesktopWorkspace.tsx b/frontend/src/desktop/components/DesktopWorkspace.tsx index 6b1604e..b369c7e 100644 --- a/frontend/src/desktop/components/DesktopWorkspace.tsx +++ b/frontend/src/desktop/components/DesktopWorkspace.tsx @@ -19,6 +19,8 @@ import type { Identifier } from '../../types/identifiers'; import type { DocumentsListEntry, Document } from '../../types/documents'; import { useAppState } from '../../lib/store/appState'; import { useDocumentOpen } from '../../lib/context/DocumentOpenContext'; +import { useDocumentsAssetContext } from '../../documents/context/DocumentsAssetContext'; +import { useDocumentsCommandContext } from '../../documents/context/DocumentsCommandContext'; interface DocumentSizeInfo { width: number; @@ -34,26 +36,24 @@ const computeFallbackCardSize = (_doc: Document, defaultSize: number = 200): Doc interface DesktopWorkspaceProps { entries: DocumentsListEntry[]; - ensureAssetUrl?: (...args: any[]) => Promise; - getDocumentAsset?: (...args: any[]) => unknown; onSelectionChange?: (selectedIds: Identifier[]) => void; - onDocumentTagAttach?: (docId: Identifier, tagId: Identifier) => void; - onDocumentTagDetach?: (docId: Identifier, tagId: Identifier) => void; viewId?: string | null; defaultCardSize?: number; } const DesktopWorkspaceContent: React.FC = ({ entries, - ensureAssetUrl, - getDocumentAsset, onSelectionChange, - onDocumentTagAttach, - onDocumentTagDetach, viewId, defaultCardSize = 200, }) => { const { openDocument } = useDocumentOpen(); + const { + ensureAssetUrl, + getDocumentAsset + } = useDocumentsAssetContext(); + const { tags } = useDocumentsCommandContext(); + const { tenant } = useAppState(); const tenantId = tenant?.id as Identifier; const { addPointer, removePointer } = usePointerTracking(); @@ -182,10 +182,10 @@ const DesktopWorkspaceContent: React.FC = ({ // Tag Interactions const tagInteractions = useDeskTagInteractions({ onAssignTagToDocument: (docId: string, tagId: string) => { - onDocumentTagAttach?.(docId, tagId); + tags.onAttach?.(docId, tagId); }, onRemoveTagFromDocument: (docId: string, tagId: string) => { - onDocumentTagDetach?.(docId, tagId); + tags.onDetach?.(docId, tagId); }, requestCanvasFocus: focusShell, });