aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/RootStore.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/stores/RootStore.ts')
-rw-r--r--packages/main/src/stores/RootStore.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/packages/main/src/stores/RootStore.ts b/packages/main/src/stores/RootStore.ts
index c09cd4a..31e2b71 100644
--- a/packages/main/src/stores/RootStore.ts
+++ b/packages/main/src/stores/RootStore.ts
@@ -22,25 +22,30 @@ import { applySnapshot, Instance, types } from 'mobx-state-tree';
22import { 22import {
23 BrowserViewBounds, 23 BrowserViewBounds,
24 emptySharedStore, 24 emptySharedStore,
25 PaletteMode,
26 sharedStore,
27} from '@sophie/shared'; 25} from '@sophie/shared';
28 26
27import type { Config } from './Config';
28import { sharedStore } from './SharedStore';
29
29export const rootStore = types.model('RootStore', { 30export const rootStore = types.model('RootStore', {
30 browserViewBounds: types.model("BrowserViewBoundsStore", { 31 browserViewBounds: types.model('BrowserViewBounds', {
31 x: 0, 32 x: 0,
32 y: 0, 33 y: 0,
33 width: 0, 34 width: 0,
34 height: 0, 35 height: 0,
35 }), 36 }),
36 shared: sharedStore, 37 shared: sharedStore,
37}).actions((self) => ({ 38}).views((self) => ({
38 setBrowserViewBounds(bounds: BrowserViewBounds) { 39 get config(): Config {
39 applySnapshot(self.browserViewBounds, bounds); 40 return self.shared.config;
40 }, 41 },
41 setPaletteMode(mode: PaletteMode) { 42})).actions((self) => ({
42 self.shared.shouldUseDarkColors = mode === 'dark'; 43 setBrowserViewBounds(bounds: BrowserViewBounds): void {
44 applySnapshot(self.browserViewBounds, bounds);
43 }, 45 },
46 setShouldUseDarkColors(shouldUseDarkColors: boolean): void {
47 self.shared.shouldUseDarkColors = shouldUseDarkColors;
48 }
44})); 49}));
45 50
46export interface RootStore extends Instance<typeof rootStore> {} 51export interface RootStore extends Instance<typeof rootStore> {}