feat(campaigns): add a delete action with a scope-aware confirmation

The dialog says what will actually be destroyed, which differs by case:
a synced MaskanX campaign is deleted on Meta too, an imported one is only
forgotten here, and a draft never reached Meta at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
AFFAANh
2026-08-03 17:33:32 +05:30
co-authored by Claude Opus 5
parent 23ce0eae5f
commit f8a9d5b250
+30
View File
@@ -59,6 +59,26 @@ export default function CampaignActions({ campaign, account, onChanged }: Props)
const isImported = campaign.origin === "imported";
// Deleting a synced campaign also deletes it on Meta, so the dialog says
// which of the two is about to happen.
const confirmDelete = () => {
Modal.confirm({
title: "Delete this campaign?",
okText: "Delete",
okButtonProps: { danger: true },
content: (
<Paragraph>
{isImported
? "MaskanX will forget this campaign. It stays in Meta, where it was created."
: campaign.meta_campaign_id
? "This deletes the campaign, ad set and ad on Meta as well. It cannot be undone."
: "This campaign was never sent to Meta, so only the MaskanX record is removed."}
</Paragraph>
),
onOk: () => run("Delete", () => api.deleteCampaign(campaign.id)),
});
};
return (
<Space size="small" wrap>
{campaign.status === "approved" && !isImported && (
@@ -105,6 +125,16 @@ export default function CampaignActions({ campaign, account, onChanged }: Props)
Stop
</Button>
)}
<Button
size="small"
danger
type="text"
loading={busy === "Delete"}
onClick={confirmDelete}
>
Delete
</Button>
</Space>
);
}