Skip to content

Commit

Permalink
feat: added message when quitting without save
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed Apr 16, 2023
1 parent 4641900 commit a333828
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/Titlebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { onMount } from "svelte";
import { exit } from "@tauri-apps/api/process";
import { WindowController } from "../lib/controllers/WindowController";
import { canSave } from "../Stores";
import { dialog } from "@tauri-apps/api";
export let title: string;
Expand All @@ -21,7 +23,15 @@
close.addEventListener("click", async () => {
console.log(title);
if (title == "Steam Art Manager") {
await exit(0);
if ($canSave) {
const shouldQuit = await dialog.confirm("You have unsaved changes, are you sure you want to quit?", {
title: "Unsaved Changes!",
type: "warning"
});
if (shouldQuit) await exit(0);
} else {
await exit(0);
}
} else if (title == "Settings") {
await WindowController.closeSettingsWindow();
}
Expand Down

0 comments on commit a333828

Please sign in to comment.