diff options
Diffstat (limited to 'packages/main/src/stores/Profile.ts')
-rw-r--r-- | packages/main/src/stores/Profile.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/main/src/stores/Profile.ts b/packages/main/src/stores/Profile.ts index eaf23c4..5f77fe4 100644 --- a/packages/main/src/stores/Profile.ts +++ b/packages/main/src/stores/Profile.ts | |||
@@ -24,7 +24,6 @@ import { | |||
24 | } from '@sophie/shared'; | 24 | } from '@sophie/shared'; |
25 | import { getSnapshot, Instance } from 'mobx-state-tree'; | 25 | import { getSnapshot, Instance } from 'mobx-state-tree'; |
26 | 26 | ||
27 | import SettingsWithId from '../utils/SettingsWithId'; | ||
28 | import generateId from '../utils/generateId'; | 27 | import generateId from '../utils/generateId'; |
29 | 28 | ||
30 | export interface ProfileConfig extends ProfileSettingsSnapshotIn { | 29 | export interface ProfileConfig extends ProfileSettingsSnapshotIn { |
@@ -40,17 +39,16 @@ export const profile = originalProfile.views((self) => ({ | |||
40 | 39 | ||
41 | export interface Profile extends Instance<typeof profile> {} | 40 | export interface Profile extends Instance<typeof profile> {} |
42 | 41 | ||
43 | export type ProfileSettingsSnapshotWithId = | 42 | export type ProfileSettingsSnapshotWithId = [string, ProfileSettingsSnapshotIn]; |
44 | SettingsWithId<ProfileSettingsSnapshotIn>; | ||
45 | 43 | ||
46 | export function addMissingProfileIds( | 44 | export function addMissingProfileIds( |
47 | profileConfigs: ProfileConfig[] | undefined, | 45 | profileConfigs: ProfileConfig[] | undefined, |
48 | ): ProfileSettingsSnapshotWithId[] { | 46 | ): ProfileSettingsSnapshotWithId[] { |
49 | return (profileConfigs ?? []).map((profileConfig) => { | 47 | return (profileConfigs ?? []).map((profileConfig) => { |
50 | const { id, ...settings } = profileConfig; | 48 | const { id, ...settings } = profileConfig; |
51 | return { | 49 | return [ |
52 | id: typeof id === 'undefined' ? generateId(settings.name) : id, | 50 | typeof id === 'undefined' ? generateId(settings.name) : id, |
53 | settings, | 51 | settings, |
54 | }; | 52 | ]; |
55 | }); | 53 | }); |
56 | } | 54 | } |