feat: show toast after create shortcut

This commit is contained in:
Zamitto 2024-06-22 01:14:02 -03:00
parent 8fad9b05e6
commit 37b9eca0e1
3 changed files with 16 additions and 4 deletions

View file

@ -119,7 +119,9 @@
"danger_zone_section_description": "Remove this game from your library or the files downloaded by Hydra", "danger_zone_section_description": "Remove this game from your library or the files downloaded by Hydra",
"download_in_progress": "Download in progress", "download_in_progress": "Download in progress",
"download_paused": "Download paused", "download_paused": "Download paused",
"last_downloaded_option": "Last downloaded option" "last_downloaded_option": "Last downloaded option",
"create_shortcut_success": "Shortcut created successfully",
"create_shortcut_error": "Error creating shortcut"
}, },
"activation": { "activation": {
"title": "Activate Hydra", "title": "Activate Hydra",

View file

@ -116,7 +116,9 @@
"danger_zone_section_description": "Remova o jogo da sua biblioteca ou os arquivos que foram baixados pelo Hydra", "danger_zone_section_description": "Remova o jogo da sua biblioteca ou os arquivos que foram baixados pelo Hydra",
"download_in_progress": "Download em andamento", "download_in_progress": "Download em andamento",
"download_paused": "Download pausado", "download_paused": "Download pausado",
"last_downloaded_option": "Última opção baixada" "last_downloaded_option": "Última opção baixada",
"create_shortcut_success": "Atalho criado com sucesso",
"create_shortcut_error": "Erro ao criar atalho"
}, },
"activation": { "activation": {
"title": "Ativação", "title": "Ativação",

View file

@ -5,7 +5,7 @@ import type { Game } from "@types";
import * as styles from "./game-options-modal.css"; import * as styles from "./game-options-modal.css";
import { gameDetailsContext } from "@renderer/context"; import { gameDetailsContext } from "@renderer/context";
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal"; import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
import { useDownload } from "@renderer/hooks"; import { useDownload, useToast } from "@renderer/hooks";
import { RemoveGameFromLibraryModal } from "./remove-from-library-modal"; import { RemoveGameFromLibraryModal } from "./remove-from-library-modal";
export interface GameOptionsModalProps { export interface GameOptionsModalProps {
@ -21,6 +21,8 @@ export function GameOptionsModal({
}: GameOptionsModalProps) { }: GameOptionsModalProps) {
const { t } = useTranslation("game_details"); const { t } = useTranslation("game_details");
const { showSuccessToast, showErrorToast } = useToast();
const { updateGame, setShowRepacksModal, selectGameExecutable } = const { updateGame, setShowRepacksModal, selectGameExecutable } =
useContext(gameDetailsContext); useContext(gameDetailsContext);
@ -61,7 +63,13 @@ export function GameOptionsModal({
}; };
const handleCreateShortcut = async () => { const handleCreateShortcut = async () => {
await window.electron.createGameShortcut(game.id); window.electron.createGameShortcut(game.id).then((success) => {
if (success) {
showSuccessToast(t("create_shortcut_success"));
} else {
showErrorToast(t("create_shortcut_error"));
}
});
}; };
const handleOpenDownloadFolder = async () => { const handleOpenDownloadFolder = async () => {