Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: health rating color in email #8943

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading