A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import { GameInfo, Runner } from 'common/types'
import { create } from 'zustand'
import { confirmStoreStatus } from './StoreStatusWarning'
interface InstallGameModalState {
isOpen: boolean
appName?: string
runner?: Runner
gameInfo: GameInfo | null
action?: 'install' | 'import'
}
export const useInstallGameModal = create<InstallGameModalState>()(() => ({
isOpen: false,
gameInfo: null,
action: 'install'
}))
interface OpenInstallGameModalParams {
appName: string
runner: Runner
gameInfo: GameInfo | null
action?: 'install' | 'import'
}
export const openInstallGameModal = async ({
appName,
runner,
gameInfo,
action = 'install'
}: OpenInstallGameModalParams) => {
// Imports skip the abandoned warning
if (action === 'install' && !(await confirmStoreStatus(gameInfo))) return
useInstallGameModal.setState({
isOpen: true,
appName,
runner,
gameInfo,
action
})
}
export const closeInstallGameModal = () => {
useInstallGameModal.setState({
isOpen: false
})
}