-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0ae77c
commit 31b2611
Showing
14 changed files
with
73 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { State } from './state'; | ||
import type Store from '@doombox/lib/store/store'; | ||
|
||
import produce from 'immer'; | ||
|
||
import { App } from './route'; | ||
|
||
const createEntity = <T extends object, K extends keyof T>(arr: T[], k: K): Map<T[K], T> => | ||
new Map(arr.map(x => [x[k], x])); | ||
|
||
export default async (store: Store<State>) => { | ||
const [ | ||
thumbs, | ||
user, | ||
cache, | ||
theme, | ||
playlists, | ||
library | ||
] = await Promise.all([ | ||
window.ipc.os.image(), | ||
window.ipc.user.get(), | ||
window.ipc.cache.get(), | ||
window.ipc.theme.get(), | ||
window.ipc.playlist.get(), | ||
window.ipc.library.select() | ||
]); | ||
|
||
store.set(produce(draft => { | ||
draft.dir.thumbs = thumbs; | ||
draft.user = user; | ||
draft.player.muted = cache.player.muted; | ||
draft.player.volume = cache.player.volume; | ||
draft.theme = theme; | ||
draft.entities.playlist = createEntity(playlists, '_id'); | ||
draft.entities.song = createEntity(library.songs, '_id'); | ||
draft.entities.album = createEntity(library.albums, '_id'); | ||
draft.entities.label = createEntity(library.labels, '_id'); | ||
draft.route.app = App.Home; | ||
})); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters