SpotifyElectron icon indicating copy to clipboard operation
SpotifyElectron copied to clipboard

Improve Player component selection depending on selected architecture.

Open AntonioMrtz opened this issue 2 months ago • 1 comments

Description

Improve the selection of the Player Component depending on the selected architecture

Context

In file global.ts theres a variable that controls which Music Player component the app has to load

export const songArchitecture: SongArchitecture =
    SongArchitecture.STREAMING_ARCHITECTURE;

In the Footer componnent 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

AntonioMrtz avatar Apr 25 '24 14:04 AntonioMrtz