aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-23 21:29:26 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-23 21:29:26 +0100
commitd303f2e3415237e1a519db21ad4e089c2ba7e9f9 (patch)
tree5d562dcaf7bb9c83c1930c7d7cf1b2c9de75e15b /packages/main/src/stores
parentbuild: Enable asar (diff)
downloadsophie-d303f2e3415237e1a519db21ad4e089c2ba7e9f9.tar.gz
sophie-d303f2e3415237e1a519db21ad4e089c2ba7e9f9.tar.zst
sophie-d303f2e3415237e1a519db21ad4e089c2ba7e9f9.zip
feat: Add BrowserView and synchronize its position
Diffstat (limited to 'packages/main/src/stores')
-rw-r--r--packages/main/src/stores/RootStore.ts22
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
21import { Instance, types } from 'mobx-state-tree'; 21import { applySnapshot, Instance, types } from 'mobx-state-tree';
22import { sharedStore } from '@sophie/shared'; 22import {
23 BrowserViewBounds,
24 emptySharedStore,
25 PaletteMode,
26 sharedStore,
27} from '@sophie/shared';
23 28
24export const rootStore = types.model('RootStore', { 29export 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
32export interface RootStore extends Instance<typeof rootStore> {} 40export interface RootStore extends Instance<typeof rootStore> {}
41
42export function createRootStore(): RootStore {
43 return rootStore.create({
44 shared: emptySharedStore,
45 });
46}