Files
test/src/features/pageDimensions/pageDimensionsSlice.ts
T
Kyle Geib 61b60b9819 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.
2022-01-11 19:12:21 -05:00

28 lines
754 B
TypeScript

import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { RootState, Dimensions } from "../../types/state";
const initialState: RootState["pageDimensions"] = {
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: {
setDimensions: (state, action: PayloadAction<SetDimensionsAction>) => {
state[action.payload.name] = action.payload.dimensions;
},
},
});
export const { setDimensions } = pageDimensionsSlice.actions;
export default pageDimensionsSlice.reducer;