Skip to content

Commit

Permalink
show toast on game delete
Browse files Browse the repository at this point in the history
  • Loading branch information
eanders-ms committed Sep 19, 2023
1 parent 986ff51 commit 6bf5655
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kiosk/src/Components/DeletionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppStateContext } from "../State/AppStateContext";
import * as Storage from "../Services/LocalStorage";
import { removeGame } from "../Transforms/removeGame";
import { gamepadManager } from "../Services/GamepadManager";
import { postNotification } from "../Transforms/postNotification";

interface IProps {
active: (p: boolean) => void;
Expand All @@ -22,9 +23,14 @@ const DeletionModal: React.FC<IProps> = ({ active, changeFocus }) => {
const userAddedGames = Storage.getAddedGames();
const gameId = kiosk.selectedGameId;
if (gameId && gameId in userAddedGames) {
const name = userAddedGames[gameId].name;
userAddedGames[gameId].deleted = true;
Storage.setAddedGames(userAddedGames);
removeGame(gameId);
postNotification({
message: `${name} deleted`,
duration: 5000,
});
}
};

Expand Down

0 comments on commit 6bf5655

Please sign in to comment.