mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-28 06:12:49 -05:00
add smokeapi settings dialog & styling #67
This commit is contained in:
@@ -30,6 +30,12 @@ export interface ProgressDialogState {
|
||||
instructions?: InstallationInstructions
|
||||
}
|
||||
|
||||
export interface SmokeAPISettingsDialogState {
|
||||
visible: boolean
|
||||
gamePath: string
|
||||
gameTitle: string
|
||||
}
|
||||
|
||||
// Define the context type
|
||||
export interface AppContextType {
|
||||
// Game state
|
||||
@@ -54,6 +60,11 @@ export interface AppContextType {
|
||||
handleSettingsOpen: () => void
|
||||
handleSettingsClose: () => void
|
||||
|
||||
// SmokeAPI settings
|
||||
smokeAPISettingsDialog: SmokeAPISettingsDialogState
|
||||
handleSmokeAPISettingsOpen: (gameId: string) => void
|
||||
handleSmokeAPISettingsClose: () => void
|
||||
|
||||
// Toast notifications
|
||||
showToast: (
|
||||
message: string,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useGames, useDlcManager, useGameActions, useToasts } from '@/hooks'
|
||||
import { DlcInfo } from '@/types'
|
||||
import { ActionType } from '@/components/buttons/ActionButton'
|
||||
import { ToastContainer } from '@/components/notifications'
|
||||
import { SmokeAPISettingsDialog } from '@/components/dialogs'
|
||||
|
||||
// Context provider component
|
||||
interface AppProviderProps {
|
||||
@@ -38,6 +39,17 @@ export const AppProvider = ({ children }: AppProviderProps) => {
|
||||
// Settings dialog state
|
||||
const [settingsDialog, setSettingsDialog] = useState({ visible: false })
|
||||
|
||||
// SmokeAPI settings dialog state
|
||||
const [smokeAPISettingsDialog, setSmokeAPISettingsDialog] = useState<{
|
||||
visible: boolean
|
||||
gamePath: string
|
||||
gameTitle: string
|
||||
}>({
|
||||
visible: false,
|
||||
gamePath: '',
|
||||
gameTitle: '',
|
||||
})
|
||||
|
||||
// Settings handlers
|
||||
const handleSettingsOpen = () => {
|
||||
setSettingsDialog({ visible: true })
|
||||
@@ -47,6 +59,25 @@ export const AppProvider = ({ children }: AppProviderProps) => {
|
||||
setSettingsDialog({ visible: false })
|
||||
}
|
||||
|
||||
// SmokeAPI settings handlers
|
||||
const handleSmokeAPISettingsOpen = (gameId: string) => {
|
||||
const game = games.find((g) => g.id === gameId)
|
||||
if (!game) {
|
||||
showError('Game not found')
|
||||
return
|
||||
}
|
||||
|
||||
setSmokeAPISettingsDialog({
|
||||
visible: true,
|
||||
gamePath: game.path,
|
||||
gameTitle: game.title,
|
||||
})
|
||||
}
|
||||
|
||||
const handleSmokeAPISettingsClose = () => {
|
||||
setSmokeAPISettingsDialog((prev) => ({ ...prev, visible: false }))
|
||||
}
|
||||
|
||||
// Game action handler with proper error reporting
|
||||
const handleGameAction = async (gameId: string, action: ActionType) => {
|
||||
const game = games.find((g) => g.id === gameId)
|
||||
@@ -201,6 +232,11 @@ export const AppProvider = ({ children }: AppProviderProps) => {
|
||||
handleSettingsOpen,
|
||||
handleSettingsClose,
|
||||
|
||||
// SmokeAPI Settings
|
||||
smokeAPISettingsDialog,
|
||||
handleSmokeAPISettingsOpen,
|
||||
handleSmokeAPISettingsClose,
|
||||
|
||||
// Toast notifications
|
||||
showToast,
|
||||
}
|
||||
@@ -209,6 +245,14 @@ export const AppProvider = ({ children }: AppProviderProps) => {
|
||||
<AppContext.Provider value={contextValue}>
|
||||
{children}
|
||||
<ToastContainer toasts={toasts} onDismiss={removeToast} />
|
||||
|
||||
{/* SmokeAPI Settings Dialog */}
|
||||
<SmokeAPISettingsDialog
|
||||
visible={smokeAPISettingsDialog.visible}
|
||||
onClose={handleSmokeAPISettingsClose}
|
||||
gamePath={smokeAPISettingsDialog.gamePath}
|
||||
gameTitle={smokeAPISettingsDialog.gameTitle}
|
||||
/>
|
||||
</AppContext.Provider>
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user