aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/src/stores/SharedStoreBase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared/src/stores/SharedStoreBase.ts')
-rw-r--r--packages/shared/src/stores/SharedStoreBase.ts39
1 files changed, 29 insertions, 10 deletions
diff --git a/packages/shared/src/stores/SharedStoreBase.ts b/packages/shared/src/stores/SharedStoreBase.ts
index bd71cea..e4b3a38 100644
--- a/packages/shared/src/stores/SharedStoreBase.ts
+++ b/packages/shared/src/stores/SharedStoreBase.ts
@@ -39,16 +39,35 @@ export function defineSharedStoreModel<
39 TP extends IAnyModelType, 39 TP extends IAnyModelType,
40 TS extends IAnyModelType, 40 TS extends IAnyModelType,
41>(globalSettings: TG, profile: TP, service: TS) { 41>(globalSettings: TG, profile: TP, service: TS) {
42 return types.model('SharedStore', { 42 return types
43 settings: types.optional(globalSettings, {}), 43 .model('SharedStore', {
44 profilesById: types.map(profile), 44 settings: types.optional(globalSettings, {}),
45 profiles: types.array(types.reference(profile)), 45 profilesById: types.map(profile),
46 servicesById: types.map(service), 46 profiles: types.array(types.reference(profile)),
47 services: types.array(types.reference(service)), 47 servicesById: types.map(service),
48 shouldUseDarkColors: false, 48 services: types.array(types.reference(service)),
49 language: FALLBACK_LOCALE, 49 shouldUseDarkColors: false,
50 writingDirection: types.optional(WritingDirection, 'ltr'), 50 language: FALLBACK_LOCALE,
51 }); 51 writingDirection: types.optional(WritingDirection, 'ltr'),
52 })
53 .views((self) => ({
54 get alwaysShowLocationBar(): boolean {
55 const settings = self.settings as GlobalSettingsBase;
56 const selectedService = settings.selectedService as
57 | ServiceBase
58 | undefined;
59 return selectedService?.alwaysShowLocationBar ?? false;
60 },
61 }))
62 .views((self) => ({
63 get locationBarVisible(): boolean {
64 const settings = self.settings as GlobalSettingsBase;
65 return settings.showLocationBar || self.alwaysShowLocationBar;
66 },
67 get canToggleLocationBar(): boolean {
68 return !self.alwaysShowLocationBar;
69 },
70 }));
52} 71}
53 72
54const SharedStoreBase = /* @__PURE__ */ (() => 73const SharedStoreBase = /* @__PURE__ */ (() =>