diff --git a/backend/src/email/templates/dataset-ready.ts b/backend/src/email/templates/dataset-ready.ts index dacd886..928eae3 100644 --- a/backend/src/email/templates/dataset-ready.ts +++ b/backend/src/email/templates/dataset-ready.ts @@ -17,9 +17,10 @@ interface DatasetReadyParams { export function datasetReadyTemplate(params: DatasetReadyParams): EmailTemplate { const safeName = escapeHtml(params.datasetName); const safeUrl = escapeAttr(params.datasetUrl); + const formattedRowCount = params.rowCount.toLocaleString(); const rowLabel = params.rowCount === 1 ? "row" : "rows"; - const subject = `Your "${params.datasetName}" dataset is ready`; + const subject = `BigSet: "${sanitizeSubjectText(params.datasetName)}" is ready`; const html = ` @@ -29,52 +30,72 @@ export function datasetReadyTemplate(params: DatasetReadyParams): EmailTemplate ${escapeHtml(subject)} - - + +
+ ${safeName} has ${formattedRowCount} ${rowLabel} ready to inspect and export. +
+
-
- +
+ - - -
- BigSet + + + + + + +
BigSet} + Dataset ready +
-

- Your dataset is ready +

+

+ Fresh rows are ready

- + + + + - - - - -
+

+ BigSet finished populating your dataset. Open it to review the table, spot-check sources, or export the rows. +

+
+ + + + -
+

Dataset

+

${safeName}

+
-

${safeName}

-

${params.rowCount.toLocaleString()} ${rowLabel} generated

+
+ + + + + +
Rows generated${formattedRowCount}
-

- Your dataset has been populated. Open it to view, query, or export the rows. -

-
- - Open Dataset + + + Open dataset
- BigSet · Live, queryable datasets by TinyFish + + BigSet by TinyFish - live, queryable datasets from the web.
@@ -85,15 +106,16 @@ export function datasetReadyTemplate(params: DatasetReadyParams): EmailTemplate `; const text = [ - "Your dataset is ready", + "BigSet dataset ready", "", `${params.datasetName}`, - `${params.rowCount.toLocaleString()} ${rowLabel} generated`, + `${formattedRowCount} ${rowLabel} generated`, + "", + "Open it to review the table, spot-check sources, or export the rows.", "", `Open dataset: ${params.datasetUrl}`, "", - "—", - "BigSet · Live, queryable datasets by TinyFish", + "BigSet by TinyFish", ].join("\n"); return { subject, html, text }; @@ -116,3 +138,7 @@ function escapeAttr(s: string): string { // URIs and we control the URL anyway, but be defensive. return s.replace(/[&<>"']/g, (c) => HTML_ESCAPES[c]); } + +function sanitizeSubjectText(s: string): string { + return s.replace(/[\r\n]+/g, " ").trim(); +}