Skip to content

[Tech] Refactor main action on click for play buttons into a shared module #944

@BrettCleary

Description

@BrettCleary

Currently the play button in the quests page only calls window.api.launch which isn't at feature parity with our other play buttons on the game card and on the game page which handle cases like if the game is already running, if it's uninstalled, showing the web3 onboarding modal before launching, etc.

I also noticed that we have this logic duplicated in both places
Game Page: https://github.com/HyperPlay-Gaming/hyperplay-desktop-client/blob/3664857b299cf911[…]b9ac7a3302a89e4647/src/frontend/screens/Game/GamePage/index.tsx
Game Card: https://github.com/HyperPlay-Gaming/hyperplay-desktop-client/blob/3664857b299cf911[…]4647/src/frontend/screens/Library/components/GameCard/index.tsx

I think this state and functionality should ideally live in the library state mobx class https://github.com/HyperPlay-Gaming/hyperplay-desktop-client/blob/main/src/frontend/state/libraryState.ts and we should have functions mainActionOnClick and getMainActionText so we can easily add action buttons in the app and share the core logic across the 3 buttons we have.

We could add an to src\frontend\App.tsx too which will handle showing the install dialog too based on a library state flag since I noticed that InstallModal is imported and conditionally rendered on every page where it is needed right now. it is also present in the global context but I think it would be better to handle this state with mobx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions