Skip to content

Commit 86689d3

Browse files
committed
feat(emails): watch email opens with the wake banner line, toned by outcome
1 parent cebd6e2 commit 86689d3

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

internal-packages/emails/emails/alert-dashboard-agent-watch.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ function formatFiredAt(firedAt: string) {
6565
return `${date.toISOString().slice(0, 16).replace("T", " ")} UTC`;
6666
}
6767

68+
/**
69+
* The chat's wake banner, in email form. Same tone mapping as the panel's
70+
* WakeBanner: a fired good-news kind is "all clear", a recurred error "needs
71+
* your attention", anything else states the fact.
72+
*/
73+
const GOOD_NEWS_KINDS = new Set([
74+
"health_recovery",
75+
"backlog_drain",
76+
"run_start",
77+
"run_finished",
78+
]);
79+
80+
function outcomeLine(kind: string): { text: string; color: string } {
81+
if (GOOD_NEWS_KINDS.has(kind)) return { text: "Watch update — all clear", color: "#A8FF53" };
82+
if (kind === "error_recurrence") {
83+
return { text: "Watch update — needs your attention", color: "#F87171" };
84+
}
85+
return { text: "Watch update — condition met", color: "#D7D9DD" };
86+
}
87+
6888
export default function Email(props: AlertDashboardAgentWatchEmailProps) {
6989
const {
7090
identity,
@@ -80,6 +100,7 @@ export default function Email(props: AlertDashboardAgentWatchEmailProps) {
80100
} = { ...previewDefaults, ...props };
81101

82102
const details = [identity, ...facts.slice(0, 3).map((fact) => `${fact.label}: ${fact.value}`)];
103+
const outcome = outcomeLine(kind);
83104

84105
return (
85106
<Html>
@@ -98,7 +119,13 @@ export default function Email(props: AlertDashboardAgentWatchEmailProps) {
98119
/>
99120
</Section>
100121
<Section>
101-
<Heading className="text-[#D7D9DD] text-[30px] font-normal leading-[35px] p-0 my-[30px] mx-0">
122+
<Text
123+
className="text-[13px] font-semibold uppercase tracking-wide mb-0 mt-[30px]"
124+
style={{ color: outcome.color }}
125+
>
126+
{outcome.text}
127+
</Text>
128+
<Heading className="text-[#D7D9DD] text-[30px] font-normal leading-[35px] p-0 mt-[8px] mb-[30px] mx-0">
102129
Your watch fired: <strong className="text-[#A8FF53]">{kind}</strong>
103130
</Heading>
104131
<Text className="text-[#D7D9DD] text-[16px] leading-[24px]">

0 commit comments

Comments
 (0)