Added Window states to session context

This commit is contained in:
Dustin Brett 2021-03-27 23:17:42 -07:00
parent 3769180309
commit ab51ff9f86
2 changed files with 19 additions and 3 deletions

View File

@ -1,14 +1,28 @@
import type { Size } from 'hooks/useResizable';
import { useState } from 'react';
import type { Position } from 'react-rnd';
type WindowState = {
positon: Position;
size: Size;
};
type WindowStates = {
[id: string]: WindowState;
};
export type SessionContextState = {
themeName: string;
setThemeName: React.Dispatch<React.SetStateAction<string>>;
setWindowStates: React.Dispatch<React.SetStateAction<WindowStates>>;
themeName: string;
windowStates: WindowStates;
};
const useSessionContextState = (): SessionContextState => {
const [themeName, setThemeName] = useState('');
const [windowStates, setWindowStates] = useState<WindowStates>({});
return { themeName, setThemeName };
return { setThemeName, setWindowStates, themeName, windowStates };
};
export default useSessionContextState;

View File

@ -16,6 +16,8 @@ export const initialProcessContextState: ProcessContextState = {
};
export const initialSessionContextState: SessionContextState = {
setThemeName: () => undefined,
setWindowStates: () => undefined,
themeName: '',
setThemeName: () => undefined
windowStates: {}
};