Add success toast after file conversion

This commit is contained in:
thefoxcost 2025-11-28 12:36:34 -08:00
parent a9de9dba70
commit c32d447a07
2 changed files with 10 additions and 1 deletions

View File

@ -15,7 +15,7 @@
"@inlang/paraglide-js": "^2.5.0", "@inlang/paraglide-js": "^2.5.0",
"@poppanator/sveltekit-svg": "^5.0.1", "@poppanator/sveltekit-svg": "^5.0.1",
"@sveltejs/adapter-static": "^3.0.10", "@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.49.0", "@sveltejs/kit": "^2.49.0",
"@sveltejs/vite-plugin-svelte": "^4.0.4", "@sveltejs/vite-plugin-svelte": "^4.0.4",
"@types/eslint": "^9.6.1", "@types/eslint": "^9.6.1",
"@types/sanitize-html": "^2.16.0", "@types/sanitize-html": "^2.16.0",

View File

@ -112,6 +112,7 @@ export class VertFile {
? await this.convertZip(converter) ? await this.convertZip(converter)
: await converter.convert(this, this.to, ...args); : await converter.convert(this, this.to, ...args);
this.result = res; this.result = res;
this.toastSuccess();
} catch (err) { } catch (err) {
if (!this.cancelled) this.toastErr(err); if (!this.cancelled) this.toastErr(err);
this.result = null; this.result = null;
@ -120,6 +121,14 @@ export class VertFile {
return res; return res;
} }
private toastSuccess() {
ToastManager.add({
type: "success",
message: `${this.file.name} converted to ${this.to.toUpperCase()} and ready to download`,
});
}
private async convertZip(converter: Converter): Promise<VertFile> { private async convertZip(converter: Converter): Promise<VertFile> {
const { extractZip, createZip } = await import("$lib/util/zip"); const { extractZip, createZip } = await import("$lib/util/zip");
const { default: PQueue } = await import("p-queue"); const { default: PQueue } = await import("p-queue");