diff options
Diffstat (limited to 'packages/main/src/stores/RootStore.ts')
-rw-r--r-- | packages/main/src/stores/RootStore.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/packages/main/src/stores/RootStore.ts b/packages/main/src/stores/RootStore.ts index edc740c..9d138ce 100644 --- a/packages/main/src/stores/RootStore.ts +++ b/packages/main/src/stores/RootStore.ts | |||
@@ -18,15 +18,29 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import { Instance, types } from 'mobx-state-tree'; | 21 | import { applySnapshot, Instance, types } from 'mobx-state-tree'; |
22 | import { sharedStore } from '@sophie/shared'; | 22 | import { |
23 | BrowserViewBounds, | ||
24 | emptySharedStore, | ||
25 | PaletteMode, | ||
26 | sharedStore, | ||
27 | } from '@sophie/shared'; | ||
23 | 28 | ||
24 | export const rootStore = types.model('RootStore', { | 29 | export const rootStore = types.model('RootStore', { |
25 | shared: sharedStore, | 30 | shared: sharedStore, |
26 | }).actions((self) => ({ | 31 | }).actions((self) => ({ |
27 | buttonClick() { | 32 | setBrowserViewBounds(bounds: BrowserViewBounds) { |
28 | self.shared.clickCount += 1; | 33 | applySnapshot(self.shared.browserViewBounds, bounds); |
34 | }, | ||
35 | setPaletteMode(mode: PaletteMode) { | ||
36 | self.shared.shouldUseDarkColors = mode === 'dark'; | ||
29 | }, | 37 | }, |
30 | })); | 38 | })); |
31 | 39 | ||
32 | export interface RootStore extends Instance<typeof rootStore> {} | 40 | export interface RootStore extends Instance<typeof rootStore> {} |
41 | |||
42 | export function createRootStore(): RootStore { | ||
43 | return rootStore.create({ | ||
44 | shared: emptySharedStore, | ||
45 | }); | ||
46 | } | ||