Skip to content

Commit

Permalink
feat: health rating color in email (#8943)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Dec 9, 2024
1 parent 3a0cddc commit 23bdf03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/services/email-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ test('Can send productivity report email', async () => {
expect(content.html.includes(`Productivity Report`)).toBe(true);
expect(content.html.includes(`localhost/insights`)).toBe(true);
expect(content.html.includes(`localhost/profile`)).toBe(true);
expect(content.html.includes(`#b0d182`)).toBe(true);
expect(content.text.includes(`localhost/insights`)).toBe(true);
expect(content.text.includes(`localhost/profile`)).toBe(true);
});
Expand Down
10 changes: 10 additions & 0 deletions src/lib/services/email-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,16 @@ export class EmailService {
userEmail,
...metrics,
unleashUrl: this.config.server.unleashUrl,
healthColor() {
const healthRating = this.health;
const healthColor =
healthRating >= 0 && healthRating <= 24
? '#d93644'
: healthRating >= 25 && healthRating <= 74
? '#ffc46f'
: '#b0d182';
return healthColor;
},
};

const template = 'productivity-report';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="shaded"
style="margin: 0;padding: 36px 8px;background: #f0f0f5;border-width: 3px;border-color: #ffffff;border-style: solid;">
<div style="padding-top: 12px;">
<span style="color: #1a4049;">{{health}}%</span><br>
<span style="color: {{healthColor}};">{{health}}%</span><br>
<span style="font-size: 16px; color: #888;">your instance health</span>
</div>
</div>
Expand Down

0 comments on commit 23bdf03

Please sign in to comment.