ISSUE-017 - Improvements to a number of things.
* Moved FullScreenContainer in WorkspacesRoute to make scrolling much better. Seriously, 100% works better. * Simplified dimensions state actions to a shared one. * Abandoned the noisy and useless "AnimatedBG" type. * Added workspace dimensions state (I'll need this later to prevent off-screen dragging). * Placed OverlayDisplay component in PreviewWindow, where it makes more sense. I'll still allow it to roam around outside of it, though. * Renamed "menu" dimensions to "mainMenu". * Improved initNewOverlayItem action to support setting visible. * Correct handling of showing the OverlayItemContainer. * Simplified the initial position of a new OverlayItem to a simple initial value instead of setting it in the middle of provided dimensions. * Made PreviewWindow `position: relative` to allow absolute positioning of OverlayItem from it. * Added importHelpers to tsconfig because VSCode was complaining about it.
This commit is contained in:
1 parent
506491eed9
commit
61b60b9819
16 files changed
+113
-76
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { RootState } from "../../types/state";
|
||||
|
||||
export const menuDimensionsSelector = (state: RootState) =>
|
||||
state.pageDimensions.menu;
|
||||
export const mainMenuDimensionsSelector = (state: RootState) =>
|
||||
state.pageDimensions.mainMenu;
|
||||
export const appDimensionsSelector = (state: RootState) =>
|
||||
state.pageDimensions.app;
|
||||
export const workspaceDimensionsSelector = (state: RootState) =>
|
||||
state.pageDimensions.workspace;
|
||||
@@ -1,29 +1,27 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
import { RootState, MenuDimensions, AppDimensions } from "../../types/state";
|
||||
import { RootState, Dimensions } from "../../types/state";
|
||||
|
||||
const initialState: RootState["pageDimensions"] = {
|
||||
menu: {
|
||||
height: 0,
|
||||
},
|
||||
app: {
|
||||
height: 0,
|
||||
width: 0,
|
||||
},
|
||||
mainMenu: { height: 0, width: 0 },
|
||||
app: { height: 0, width: 0 },
|
||||
workspace: { height: 0, width: 0 },
|
||||
};
|
||||
|
||||
type SetDimensionsAction = {
|
||||
name: "mainMenu" | "app" | "workspace",
|
||||
dimensions: Dimensions,
|
||||
};
|
||||
|
||||
export const pageDimensionsSlice = createSlice({
|
||||
name: "pageDimensions",
|
||||
initialState,
|
||||
reducers: {
|
||||
setMenuDimensions: (state, action: PayloadAction<MenuDimensions>) => {
|
||||
state.menu = action.payload;
|
||||
},
|
||||
setAppDimensions: (state, action: PayloadAction<AppDimensions>) => {
|
||||
state.app = action.payload;
|
||||
setDimensions: (state, action: PayloadAction<SetDimensionsAction>) => {
|
||||
state[action.payload.name] = action.payload.dimensions;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setMenuDimensions, setAppDimensions } = pageDimensionsSlice.actions;
|
||||
export const { setDimensions } = pageDimensionsSlice.actions;
|
||||
export default pageDimensionsSlice.reducer;
|
||||
Reference in new issue
Block a user