diff --git a/src/App.tsx b/src/App.tsx index 2e03e69..ca09e08 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -64,6 +64,8 @@ function App() { handleSettingsOpen, handleSettingsClose, handleSmokeAPISettingsOpen, + handleOpenRating, + reportingEnabled, showToast, unlockerSelectionDialog, handleSelectCreamLinux, @@ -143,6 +145,8 @@ function App() { onAction={handleGameAction} onEdit={handleGameEdit} onSmokeAPISettings={handleSmokeAPISettingsOpen} + onRate={handleOpenRating} + reportingEnabled={reportingEnabled} /> )} @@ -190,6 +194,7 @@ function App() { {/* Unlocker Selection Dialog */} Promise onEdit?: (gameId: string) => void onSmokeAPISettings?: (gameId: string) => void + onRate?: (gameId: string) => void + reportingEnabled?: boolean // When false/undefined, rate button is not rendered at all. } /** * Individual game card component * Displays game information and action buttons */ -const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps) => { +const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings, onRate, reportingEnabled }: GameItemProps) => { const [imageUrl, setImageUrl] = useState(null) const [isLoading, setIsLoading] = useState(true) const [hasError, setHasError] = useState(false) @@ -93,6 +95,13 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps) } } + // Rating handler + const handleRate = () => { + if (onRate && (game.cream_installed || game.smoke_installed)) { + onRate(game.id) + } + } + // Determine background image const backgroundImage = !isLoading && imageUrl @@ -179,6 +188,20 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps) )} + {/* Rate button */} + {(game.cream_installed || game.smoke_installed) && onRate && reportingEnabled && ( +