Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BrettCleary opened this issue Jul 16, 2024 · 0 comments

Comments

@BrettCleary
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant