17 lines
690 B
TypeScript
17 lines
690 B
TypeScript
import { APP_CONFIG } from "../app/config.js";
|
|
import { comfyConfirm } from "../app/dialogs.js";
|
|
import { t } from "../app/i18n.js";
|
|
|
|
export async function confirmDeletion(count: number, label?: string): Promise<boolean> {
|
|
if (!APP_CONFIG.DELETE_CONFIRMATION) return true;
|
|
const message =
|
|
count > 1
|
|
? t("dialog.deleteSelectedFiles", "Delete {count} selected files?", { count })
|
|
: t("dialog.deleteSingleFile", 'Delete "{label}"?', {
|
|
label: String(label || t("label.thisFile", "this file")),
|
|
});
|
|
return Boolean(
|
|
await comfyConfirm(message, t("dialog.confirmDeleteTitle", "Majoor: Confirm delete")),
|
|
);
|
|
}
|