Skip to content

Commit 40f7933

Browse files
committed
Merge branch 'main' into 1067-mom-rendering
2 parents be0c90a + fbd5289 commit 40f7933

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/js/techreport/summaryCards.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ class SummaryCard {
7373
});
7474
}
7575

76-
if(latestChange && latestChange.string) {
76+
if(latestChange && latestChange.string && latestChange.perc) {
7777
const changeSlot = card.querySelector('[data-slot="change"]');
7878
const changeMeaning = changeSlot?.dataset?.meaning;
7979

8080
if(changeSlot) {
8181
changeSlot.textContent = latestChange.string;
8282
const styling = UIUtils.getChangeStatus(latestChange.perc, changeMeaning);
83-
changeSlot.className = `monthchange ${styling.color} ${styling.direction}`;
83+
changeSlot.className = `monthchange ${styling?.color} ${styling?.direction}`;
8484
}
8585
}
8686
}

src/js/techreport/table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function updateTable(id, config, appConfig, apps, data) {
194194
}
195195

196196
if(column.styling) {
197-
wrapper.className = `monthchange ${styling.color} ${styling.direction}`;
197+
wrapper.className = `monthchange ${column?.styling?.color} ${column?.styling?.direction}`;
198198
}
199199

200200
// Add cell to the row

src/js/techreport/timeseries.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Timeseries {
175175
const styling = UIUtils.getChangeStatus(latestMoM, changeMeaning);
176176
const monthChange = document.createElement('span');
177177
monthChange.textContent = latestMoMStr;
178-
monthChange.className = `monthchange ${styling.color} ${styling.direction}`;
178+
monthChange.className = `monthchange ${styling?.color} ${styling?.direction}`;
179179
itemWrapper.appendChild(monthChange);
180180
}
181181

@@ -250,7 +250,7 @@ class Timeseries {
250250
const styling = UIUtils.getChangeStatus(latestMoM, changeMeaning);
251251
const monthChange = document.createElement('span');
252252
monthChange.textContent = latestMoMStr;
253-
monthChange.className = `monthchange ${styling.color} ${styling.direction}`;
253+
monthChange.className = `monthchange ${styling?.color} ${styling?.direction}`;
254254
card.appendChild(monthChange);
255255
}
256256
}

src/js/techreport/utils/ui.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ const updateReportComponents = (sections, data) => {
3535
}
3636

3737
const getChangeStatus = (percentage, meaning) => {
38-
if(percentage === 0) {
39-
return {
40-
direction: 'equal',
41-
color: 'neutral'
42-
}
43-
}
44-
4538
if(percentage > 0) {
4639
const color = meaning === 'inverted' ? 'bad' : 'good';
4740
return {
@@ -57,6 +50,11 @@ const getChangeStatus = (percentage, meaning) => {
5750
color: color,
5851
}
5952
}
53+
54+
return {
55+
direction: 'equal',
56+
color: 'neutral'
57+
}
6058
}
6159

6260
export const UIUtils = {

0 commit comments

Comments
 (0)