Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Improv: Color code notifications in updates #1450

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ function Updates(props) {
.reverse()
.map(function (activity, index) {
activity.update = activity.update.replace('\n', '<br/>');
activity.update = activity.update.replace(
new RegExp('\\b' + 'recovery' + '\\b'),
"<span style='color:#28a745'> recovery </span>"
);
activity.update = activity.update.replace(
new RegExp('\\b' + 'recoveries' + '\\b'),
"<span style='color:#28a745'> recoveries </span>"
);
activity.update = activity.update.replace(
new RegExp('\\b' + 'new cases' + '\\b'),
"<span style='color:#dc3545'> new cases </span>"
);
activity.update = activity.update.replace(
new RegExp('\\b' + 'new case' + '\\b'),
"<span style='color:#dc3545'> new case </span>"
);

const activityDate = new Date(activity.timestamp * 1000);
const addHeader = () => {
currentDate = activityDate;
Expand Down