From 0480d523e37818e162998433c2f2f2a50307eeee Mon Sep 17 00:00:00 2001 From: Novattz Date: Sat, 28 Mar 2026 15:07:50 +0100 Subject: [PATCH] stuff --- src/App.tsx | 5 + src/components/common/index.ts | 4 +- src/components/dialogs/index.ts | 9 +- src/components/games/GameItem.tsx | 25 ++++- src/components/games/GameList.tsx | 6 +- src/contexts/AppContext.tsx | 24 +++++ src/contexts/AppProvider.tsx | 159 +++++++++++++++++++++++++++++- src/types/Config.ts | 2 + 8 files changed, 225 insertions(+), 9 deletions(-) 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 && ( +