feat: Implement layout persistence for card positions and rotation, loading from and saving to the database.

This commit is contained in:
2025-11-26 20:24:00 +01:00
parent 6157a4f571
commit 39e3ac2a87
4 changed files with 92 additions and 6 deletions
+10
View File
@@ -54,6 +54,8 @@ export interface DesktopWorkspaceProps {
onDocumentActivate?: (doc: DeskDocument, event?: unknown) => void;
onSelectionChange?: (selectedIds: Identifier[]) => void;
onDocumentTagDrop?: (docId: Identifier, tag: any) => void;
tenantId?: Identifier | null;
viewId?: string | null;
}
// Wrapper to handle hooks per card
@@ -84,6 +86,8 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
onDocumentActivate,
onSelectionChange,
onDocumentTagDrop,
tenantId,
viewId,
}) => {
const containerRef = useRef<HTMLDivElement>(null);
@@ -99,6 +103,12 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
const layoutStore = useMemo(() => new LayoutStore(), []);
const layoutRef = useRef<Map<string, LayoutCard>>(new Map());
useEffect(() => {
if (tenantId && viewId) {
layoutStore.loadLayout(String(tenantId), viewId);
}
}, [layoutStore, tenantId, viewId]);
// Selection Context
const {
selectedDocumentIds,