-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor populating the attributes of GameSelectionScreen pre-mount
Extract any logic out of the component, only setting the attributes by calling helper methods. Clean up unnecessary code and attempt to simplify the implementation. Refs TS-1138
- Loading branch information
Showing
4 changed files
with
38 additions
and
34 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import GameManager from "../model/game/GameManager"; | ||
import ManagerSettings from "../r2mm/manager/ManagerSettings"; | ||
|
||
|
||
/** | ||
* Return default game selection needed to skip the game selection screen. | ||
*/ | ||
export const getDefaults = (settings: ManagerSettings) => { | ||
const globals = settings.getContext().global; | ||
const defaultGame = GameManager.findByFolderName(globals.defaultGame); | ||
const platforms = defaultGame ? defaultGame.storePlatformMetadata : []; | ||
const defaultPlat = platforms.find(x => x.storePlatform === globals.defaultStore); | ||
|
||
return { | ||
defaultGame, | ||
defaultPlatform: defaultPlat ? defaultPlat.storePlatform : undefined | ||
}; | ||
} |