diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 20:33:53 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 20:33:53 +0100 |
commit | d85f09cbed5f3d2501f791e689011ae127df1cbb (patch) | |
tree | 0ed5be55dd5d3dec1d51eb60e7ff229274030a57 /packages/main/src/stores | |
parent | build: Disable single-run eslint-typescript (diff) | |
download | sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.tar.gz sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.tar.zst sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.zip |
build: Add prettier
eslint will also enforce prettier rules, so there is no need to call
prettier separately in CI.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/stores')
-rw-r--r-- | packages/main/src/stores/MainStore.ts | 46 | ||||
-rw-r--r-- | packages/main/src/stores/SharedStore.ts | 5 |
2 files changed, 30 insertions, 21 deletions
diff --git a/packages/main/src/stores/MainStore.ts b/packages/main/src/stores/MainStore.ts index 7b26c52..eaf5b3c 100644 --- a/packages/main/src/stores/MainStore.ts +++ b/packages/main/src/stores/MainStore.ts | |||
@@ -24,26 +24,32 @@ import { applySnapshot, Instance, types } from 'mobx-state-tree'; | |||
24 | import type { Config } from './Config.js'; | 24 | import type { Config } from './Config.js'; |
25 | import { sharedStore } from './SharedStore'; | 25 | import { sharedStore } from './SharedStore'; |
26 | 26 | ||
27 | export const mainStore = types.model('MainStore', { | 27 | export const mainStore = types |
28 | browserViewBounds: types.optional(types.model('BrowserViewBounds', { | 28 | .model('MainStore', { |
29 | x: 0, | 29 | browserViewBounds: types.optional( |
30 | y: 0, | 30 | types.model('BrowserViewBounds', { |
31 | width: 0, | 31 | x: 0, |
32 | height: 0, | 32 | y: 0, |
33 | }), {}), | 33 | width: 0, |
34 | shared: types.optional(sharedStore, {}), | 34 | height: 0, |
35 | }).views((self) => ({ | 35 | }), |
36 | get config(): Config { | 36 | {}, |
37 | return self.shared.config; | 37 | ), |
38 | }, | 38 | shared: types.optional(sharedStore, {}), |
39 | })).actions((self) => ({ | 39 | }) |
40 | setBrowserViewBounds(bounds: BrowserViewBounds): void { | 40 | .views((self) => ({ |
41 | applySnapshot(self.browserViewBounds, bounds); | 41 | get config(): Config { |
42 | }, | 42 | return self.shared.config; |
43 | setShouldUseDarkColors(shouldUseDarkColors: boolean): void { | 43 | }, |
44 | self.shared.shouldUseDarkColors = shouldUseDarkColors; | 44 | })) |
45 | }, | 45 | .actions((self) => ({ |
46 | })); | 46 | setBrowserViewBounds(bounds: BrowserViewBounds): void { |
47 | applySnapshot(self.browserViewBounds, bounds); | ||
48 | }, | ||
49 | setShouldUseDarkColors(shouldUseDarkColors: boolean): void { | ||
50 | self.shared.shouldUseDarkColors = shouldUseDarkColors; | ||
51 | }, | ||
52 | })); | ||
47 | 53 | ||
48 | export interface MainStore extends Instance<typeof mainStore> {} | 54 | export interface MainStore extends Instance<typeof mainStore> {} |
49 | 55 | ||
diff --git a/packages/main/src/stores/SharedStore.ts b/packages/main/src/stores/SharedStore.ts index c023fc7..73245cd 100644 --- a/packages/main/src/stores/SharedStore.ts +++ b/packages/main/src/stores/SharedStore.ts | |||
@@ -23,7 +23,10 @@ import { Instance, types } from 'mobx-state-tree'; | |||
23 | 23 | ||
24 | import { config } from './Config'; | 24 | import { config } from './Config'; |
25 | 25 | ||
26 | export type { SharedStoreSnapshotIn, SharedStoreSnapshotOut } from '@sophie/shared'; | 26 | export type { |
27 | SharedStoreSnapshotIn, | ||
28 | SharedStoreSnapshotOut, | ||
29 | } from '@sophie/shared'; | ||
27 | 30 | ||
28 | export const sharedStore = originalSharedStore.props({ | 31 | export const sharedStore = originalSharedStore.props({ |
29 | config: types.optional(config, {}), | 32 | config: types.optional(config, {}), |