This commit is contained in:
debu-2 2026-10-15 02:00:01 +05:30
parent 29d867438c
commit 94cd48d1ac

View file

@ -186,6 +186,16 @@ export function WhatsAppBroadcastPage() {
const mediaHeader = ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(selectedTemplate?.header_format || '')
const savedSample = Boolean(selectedTemplate?.sample_stored)
const headerLabel = selectedTemplate?.header_format === 'VIDEO' ? 'video' : selectedTemplate?.header_format === 'DOCUMENT' ? 'document' : 'image'
function downloadSampleCsv() {
const blob = new Blob(['phone_number\n'], { type: 'text/csv;charset=utf-8' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = 'whatsapp-broadcast-sample.csv'
link.click()
URL.revokeObjectURL(url)
}
const selectedJob = jobs.find((job) => job.id === selectedJobId) || null
async function startCsv() {
@ -346,6 +356,7 @@ export function WhatsAppBroadcastPage() {
onChange={(event) => setCsvFile(event.target.files?.[0] || null)}
/>
</label>
<button className="text-button" type="button" onClick={downloadSampleCsv}>Download a blank sample CSV</button>
<button className="secondary-button" type="button" disabled={csvBusy || !accountId || !csvFile} onClick={() => void startCsv()}>
{csvBusy ? <Loader2 size={16} className="wa-spin" /> : null}
{csvFile ? `Start ${csvFile.name}` : 'Start CSV broadcast'}