aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/Service.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-27 00:17:22 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-02-08 21:43:17 +0100
commit9546dc2aa39ab096ccc723786e718a739d0bdaf9 (patch)
tree9c3afc6155cc59f6dd1235397230aaa15a5f8cec /packages/main/src/stores/Service.ts
parentrefactor: Apply shared store patches in batches (diff)
downloadsophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.tar.gz
sophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.tar.zst
sophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.zip
refactor: Coding conventions
Make sure that files have a default import with the same name as the file whenever possible to reduce surprise. Also shuffles around some file names for better legibility. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/stores/Service.ts')
-rw-r--r--packages/main/src/stores/Service.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/main/src/stores/Service.ts b/packages/main/src/stores/Service.ts
index 331805b..e70caa6 100644
--- a/packages/main/src/stores/Service.ts
+++ b/packages/main/src/stores/Service.ts
@@ -19,14 +19,14 @@
19 */ 19 */
20 20
21import type { UnreadCount } from '@sophie/service-shared'; 21import type { UnreadCount } from '@sophie/service-shared';
22import { service as originalService } from '@sophie/shared'; 22import { Service as ServiceBase } from '@sophie/shared';
23import { Instance, getSnapshot, ReferenceIdentifier } from 'mobx-state-tree'; 23import { Instance, getSnapshot, ReferenceIdentifier } from 'mobx-state-tree';
24 24
25import generateId from '../utils/generateId'; 25import generateId from '../utils/generateId';
26import overrideProps from '../utils/overrideProps'; 26import overrideProps from '../utils/overrideProps';
27 27
28import { ProfileSettingsSnapshotWithId } from './Profile'; 28import { ProfileSettingsSnapshotWithId } from './Profile';
29import { serviceSettings, ServiceSettingsSnapshotIn } from './ServiceSettings'; 29import ServiceSettings, { ServiceSettingsSnapshotIn } from './ServiceSettings';
30 30
31export interface ServiceConfig 31export interface ServiceConfig
32 extends Omit<ServiceSettingsSnapshotIn, 'profile'> { 32 extends Omit<ServiceSettingsSnapshotIn, 'profile'> {
@@ -35,8 +35,8 @@ export interface ServiceConfig
35 profile?: ReferenceIdentifier | undefined; 35 profile?: ReferenceIdentifier | undefined;
36} 36}
37 37
38export const service = overrideProps(originalService, { 38const Service = overrideProps(ServiceBase, {
39 settings: serviceSettings, 39 settings: ServiceSettings,
40}) 40})
41 .views((self) => ({ 41 .views((self) => ({
42 get config(): ServiceConfig { 42 get config(): ServiceConfig {
@@ -83,7 +83,13 @@ export const service = overrideProps(originalService, {
83 }, 83 },
84 })); 84 }));
85 85
86export interface Service extends Instance<typeof service> {} 86/*
87 eslint-disable-next-line @typescript-eslint/no-redeclare --
88 Intentionally naming the type the same as the store definition.
89*/
90interface Service extends Instance<typeof Service> {}
91
92export default Service;
87 93
88export type ServiceSettingsSnapshotWithId = [string, ServiceSettingsSnapshotIn]; 94export type ServiceSettingsSnapshotWithId = [string, ServiceSettingsSnapshotIn];
89 95