SpotifyElectron
SpotifyElectron copied to clipboard
Improve Player component selection depending on selected architecture.
Description
Improve the selection of the Player Component depending on the selected architecture
Context
In file theres a variable that controls which Music Player component the app has to load
export const songArchitecture: SongArchitecture =
SongArchitecture.STREAMING_ARCHITECTURE;
In the theres an if statement hardcoded that chooses between 2 components depending on the architecture selected. The goal is to improve this component selection using something like a Map object thats matches a variable with the component. Im open to different approaches if theres a better/cleaner solution.
How to do it
Use some type of mapping or association that prevents the hardcoded if statement.
Testing
Make a test in a new file called ArchitectureSelection.test.tsx that:
- Loads global.ts with architecture STREAMING_ARCHITECTURE and check if the associated component is loaded
- Same with FILE_ARCHITECTURE