Skip to content

Commit

Permalink
Merge pull request #626 from hydralauncher/feat/show-toast-after-crea…
Browse files Browse the repository at this point in the history
…te-shortcut

feat: show toast after create shortcut
  • Loading branch information
zamitto authored Jun 22, 2024
2 parents 1b2b8c8 + f219634 commit 9bef234
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
"danger_zone_section_description": "Remove this game from your library or the files downloaded by Hydra",
"download_in_progress": "Download in progress",
"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": {
"title": "Activate Hydra",
Expand Down
4 changes: 3 additions & 1 deletion src/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@
"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_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": {
"title": "Ativação",
Expand Down
12 changes: 10 additions & 2 deletions src/renderer/src/pages/game-details/modals/game-options-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Game } from "@types";
import * as styles from "./game-options-modal.css";
import { gameDetailsContext } from "@renderer/context";
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";

export interface GameOptionsModalProps {
Expand All @@ -21,6 +21,8 @@ export function GameOptionsModal({
}: GameOptionsModalProps) {
const { t } = useTranslation("game_details");

const { showSuccessToast, showErrorToast } = useToast();

const { updateGame, setShowRepacksModal, selectGameExecutable } =
useContext(gameDetailsContext);

Expand Down Expand Up @@ -61,7 +63,13 @@ export function GameOptionsModal({
};

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 () => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/theme.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const vars = createGlobalTheme(":root", {
small: "12px",
},
zIndex: {
toast: "2",
toast: "5",
bottomPanel: "3",
titleBar: "4",
backdrop: "4",
Expand Down

0 comments on commit 9bef234

Please sign in to comment.