Staging indicator for donation receipts

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
yash-signal 2025-07-07 12:24:04 -05:00 committed by GitHub
parent 6b41d1f891
commit b04d3a9c7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ import type { DonationReceipt } from '../types/Donations';
import type { LocalizerType } from '../types/Util';
import { strictAssert } from './assert';
import { getDateTimeFormatter } from './formatTimestamp';
import { isStagingServer } from './isStagingServer';
const SCALING_FACTOR = 4.17;
@ -319,6 +320,27 @@ export async function generateDonationReceiptBlob(
});
canvas.add(footer);
// Add staging indicator if in staging environment
if (isStagingServer()) {
strictAssert(footer.height != null, 'Footer height must be defined');
currentY += footer.height + 100 * SCALING_FACTOR;
const stagingText = new fabric.Text(
'NOT A REAL RECEIPT / FOR TESTING ONLY',
{
left: width / 2,
top: currentY,
fontFamily,
fontSize: 24 * SCALING_FACTOR,
fontWeight: 'bold',
fill: '#7C3AED',
originX: 'center',
textAlign: 'center',
}
);
canvas.add(stagingText);
}
canvas.renderAll();
// Convert canvas to PNG blob