feat: Implement layout persistence for card positions and rotation, loading from and saving to the database.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user