All files / src/lib/electron/dialog confirmDeleteAsset.ts

83.33% Statements 5/6
100% Branches 0/0
0% Functions 0/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x 1x 1x   1x                               1x  
import { dialog } from "electron";
import { Asset, AssetType, assetPath } from "shared/lib/helpers/assets";
import l10n from "shared/lib/lang/l10n";
 
const confirmDeleteAsset = (assetType: AssetType, asset: Asset): boolean => {
  return (
    dialog.showMessageBoxSync({
      type: "info",
      buttons: [l10n("DIALOG_DELETE"), l10n("DIALOG_CANCEL")],
      defaultId: 0,
      cancelId: 1,
      title: l10n("DIALOG_DELETE_ASSET", { filename: asset.filename }),
      message: l10n("DIALOG_DELETE_ASSET", { filename: asset.filename }),
      detail: l10n("DIALOG_DELETE_ASSET_DESCRIPTION", {
        filename: assetPath(assetType, asset),
      }),
    }) === 0
  );
};
 
export default confirmDeleteAsset;