mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 12:20:20 +01:00
Added Window states to session context
This commit is contained in:
parent
3769180309
commit
ab51ff9f86
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ export const initialProcessContextState: ProcessContextState = {
|
|||
};
|
||||
|
||||
export const initialSessionContextState: SessionContextState = {
|
||||
setThemeName: () => undefined,
|
||||
setWindowStates: () => undefined,
|
||||
themeName: '',
|
||||
setThemeName: () => undefined
|
||||
windowStates: {}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user