Replace alert with notification utilities and refactor canvas creation

Replaces all uses of alert() with showErrorNotification or showSuccessNotification for improved user experience and consistency. Refactors canvas creation to use the createCanvas utility function across multiple files, reducing code duplication and improving maintainability. Also updates layer ID generation to use generateUUID.
This commit is contained in:
Dariusz L
2025-07-27 19:12:25 +02:00
parent 207bacc1f8
commit f36f91487f
12 changed files with 58 additions and 70 deletions

View File

@@ -1,5 +1,6 @@
import { createCanvas } from "./utils/CommonUtils.js";
import { createModuleLogger } from "./utils/LoggerUtils.js";
import { showErrorNotification } from "./utils/NotificationUtils.js";
import { webSocketManager } from "./utils/WebSocketManager.js";
const log = createModuleLogger('CanvasIO');
export class CanvasIO {
@@ -525,7 +526,7 @@ export class CanvasIO {
}
catch (error) {
log.error("Error importing latest image:", error);
alert(`Failed to import latest image: ${error.message}`);
showErrorNotification(`Failed to import latest image: ${error.message}`);
return false;
}
}
@@ -565,7 +566,7 @@ export class CanvasIO {
}
catch (error) {
log.error("Error importing latest images:", error);
alert(`Failed to import latest images: ${error.message}`);
showErrorNotification(`Failed to import latest images: ${error.message}`);
return [];
}
}