ISSUE-017 - Overlay state is streamlined.
Total change to workspaces. Now an object instead of a list. Utilizing workspace overlays list - prototype currently colors the mock item. Reset overlay on workspace change. Improved combined dragging/transition element behavior.
This commit is contained in:
1 parent
a6a5eb7751
commit
861d702a27
11 files changed
+177
-150
No files matched your search
@@ -1,9 +1,13 @@
|
||||
import { useEffect } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Center } from "@bedrock-layout/center";
|
||||
import { Stack } from "@bedrock-layout/stack";
|
||||
|
||||
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||
import { setWorkspaceId } from "../../../features/workspace/workspaceSlice";
|
||||
import { overlayToolSelector } from "../../../features/overlayTool/overlayToolSelector";
|
||||
import { newWorkspace } from "../../../features/overlayTool/overlayToolSlice";
|
||||
|
||||
import { PreviewWindow, H2, ControlsContainer } from "./styles";
|
||||
import { WorkspaceControls } from "./WorkspaceControls";
|
||||
@@ -15,6 +19,24 @@ import { workspaceObject } from "../workspaces";
|
||||
export const Workspace = () => {
|
||||
const { workspaceId } = useParams();
|
||||
const { animatedBG } = useSelector(workspaceSelector);
|
||||
const { currentWorkspaceId: overlayWorkspaceId } = useSelector(overlayToolSelector);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
if (workspaceId == null) return;
|
||||
|
||||
// Update workspace store for ID.
|
||||
dispatch(setWorkspaceId(workspaceId));
|
||||
|
||||
// Switching Workspace means we need to init a newWorkspace for Overlay tool.
|
||||
if (overlayWorkspaceId !== workspaceId) {
|
||||
dispatch(newWorkspace({
|
||||
overlayIds: workspaceObject[workspaceId].overlayIds,
|
||||
workspaceId: workspaceId,
|
||||
}));
|
||||
}
|
||||
}, [workspaceId]);
|
||||
|
||||
return (
|
||||
<Stack
|
||||
gutter="lg"
|
||||
@@ -22,7 +44,7 @@ export const Workspace = () => {
|
||||
maxWidth="80%"
|
||||
centerChildren
|
||||
>
|
||||
<H2>{workspaceId ? workspaceObject[workspaceId] : "Unknown"}</H2>
|
||||
<H2>{workspaceId ? workspaceObject[workspaceId].name : "Unknown"}</H2>
|
||||
<PreviewWindow height={600} width={800} animatedBG={animatedBG}>
|
||||
<MockupBlock
|
||||
color="#415bad"
|
||||
|
||||
Reference in new issue
Block a user