Skip to content

Commit 93cc6d2

Browse files
committed
feat: add fair zero message
1 parent 53482ae commit 93cc6d2

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

website/js/fair-distribution.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,25 @@
274274
grid-template-columns: 1fr;
275275
}
276276
}
277+
278+
.fair-prediction-wrapper {
279+
display: flex;
280+
justify-content: center;
281+
margin-bottom: 18px;
282+
}
283+
284+
.fair-prediction-banner {
285+
width: 80%;
286+
background: rgba(255, 209, 102, 0.12);
287+
border: 1px solid rgba(255, 209, 102, 0.55);
288+
color: #ffd166;
289+
padding: 14px 18px;
290+
border-radius: 12px;
291+
text-align: center;
292+
font-size: 14px;
293+
font-weight: 700;
294+
line-height: 1.45;
295+
}
277296
`;
278297

279298
document.head.appendChild(style);
@@ -735,6 +754,10 @@
735754
function renderCountryCard(country, data, maxActual, maxFair) {
736755
const fairUnavailable = data.factor === null;
737756

757+
const allFairZero =
758+
!fairUnavailable &&
759+
medalOrder.every(medal => (data.fair[medal] || 0) === 0);
760+
738761
return `
739762
<div class="fair-country-card">
740763
<div class="fair-country-title">${country}</div>
@@ -743,6 +766,14 @@
743766
GDP: ${formatBig(data.gdp)}
744767
</div>
745768
769+
${allFairZero ? `
770+
<div class="fair-prediction-wrapper">
771+
<div class="fair-prediction-banner">
772+
How would you predict their performance if they had the same GDP and population as the other countries?
773+
</div>
774+
</div>
775+
` : ""}
776+
746777
<div class="fair-box">
747778
<div class="fair-box-title">Actual medals</div>
748779
${medalOrder.map(medal => {

0 commit comments

Comments
 (0)