redirect to home page when removing custom game from library

This commit is contained in:
Moyasee
2025-09-19 19:48:05 +03:00
parent ea792d0409
commit 9ce1c40b21
3 changed files with 11 additions and 4 deletions

View File

@@ -178,6 +178,7 @@ export default function GameDetails() {
onClose={() => {
setShowGameOptionsModal(false);
}}
onNavigateHome={() => navigate("/")}
/>
)}

View File

@@ -177,10 +177,9 @@ export function EditGameModal({
setIsUpdating(true);
try {
const updatedGame =
isCustomGame(game)
? await updateCustomGame(game)
: await updateNonCustomGame(game as LibraryGame);
const updatedGame = isCustomGame(game)
? await updateCustomGame(game)
: await updateNonCustomGame(game as LibraryGame);
showSuccessToast(t("edit_custom_game_modal_success"));
onGameUpdated(updatedGame);

View File

@@ -18,12 +18,14 @@ export interface GameOptionsModalProps {
visible: boolean;
game: LibraryGame;
onClose: () => void;
onNavigateHome?: () => void;
}
export function GameOptionsModal({
visible,
game,
onClose,
onNavigateHome,
}: Readonly<GameOptionsModalProps>) {
const { t } = useTranslation("game_details");
@@ -90,6 +92,11 @@ export function GameOptionsModal({
await removeGameFromLibrary(game.shop, game.objectId);
updateGame();
onClose();
// Redirect to home page if it's a custom game
if (game.shop === "custom" && onNavigateHome) {
onNavigateHome();
}
};
const handleChangeExecutableLocation = async () => {