diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-09-02 11:51:46 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-09-02 11:51:46 -0500 |
commit | 6835caa7609259a64ba0aa2c9ddb34b7d5eb7793 (patch) | |
tree | 7b467ac75f59c39699e098b6dba55e3ab291b083 /src/state/models | |
parent | 8de3b066ebb7cd420051670b446d520adca6cb23 (diff) | |
download | voidsky-6835caa7609259a64ba0aa2c9ddb34b7d5eb7793.tar.zst |
Add more robust modals controller
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/root-store.ts | 2 | ||||
-rw-r--r-- | src/state/models/shell.ts | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 0dab41675..47213f9d1 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -8,11 +8,13 @@ import {createContext, useContext} from 'react' import {isObj, hasProp} from '../lib/type-guards' import {SessionModel} from './session' import {NavigationModel} from './navigation' +import {ShellModel} from './shell' import {MeModel} from './me' export class RootStoreModel { session = new SessionModel() nav = new NavigationModel() + shell = new ShellModel() me = new MeModel(this) constructor(public api: AdxClient) { diff --git a/src/state/models/shell.ts b/src/state/models/shell.ts new file mode 100644 index 000000000..6755393cd --- /dev/null +++ b/src/state/models/shell.ts @@ -0,0 +1,28 @@ +import {makeAutoObservable} from 'mobx' + +export class LinkActionsModel { + name = 'link-actions' + + constructor(public href: string, public title: string) { + makeAutoObservable(this) + } +} + +export class ShellModel { + isModalActive = false + activeModal: LinkActionsModel | undefined + + constructor() { + makeAutoObservable(this) + } + + openModal(modal: LinkActionsModel) { + this.isModalActive = true + this.activeModal = modal + } + + closeModal() { + this.isModalActive = false + this.activeModal = undefined + } +} |