2.9.9.1
Percentage bars on panel
This commit is contained in:
+29
-19
@@ -587,25 +587,35 @@ export function UTCIForecast() {
|
||||
Why It Feels
|
||||
${currentCat && html`<span class="insight-thermal-cat" style=${{ background: currentCat.bg, color: currentCat.fg }}>${currentCat.label}</span>`}
|
||||
</div>
|
||||
${[
|
||||
{ label: 'Sun and sky', icon: '☀', value: whyFeelsLike.sunAndSky },
|
||||
{ label: 'Wind', icon: '🌬', value: whyFeelsLike.wind },
|
||||
{ label: 'Humidity', icon: '💧', value: whyFeelsLike.humidity },
|
||||
...(whyFeelsLike.environment !== 0 ? [
|
||||
{ label: UTCI_ENVIRONMENTS[utciEnv]?.label ?? 'Environment', icon: '🌍', value: whyFeelsLike.environment }
|
||||
] : []),
|
||||
...(whyFeelsLike.precipitation !== 0 ? [
|
||||
{ label: 'Precipitation', icon: '🌧', value: whyFeelsLike.precipitation }
|
||||
] : []),
|
||||
].map(({ label, icon, value }) => html`
|
||||
<div class="insight-row" key=${label}>
|
||||
<span class="insight-icon">${icon}</span>
|
||||
<span class="insight-label">${label}</span>
|
||||
<span class=${`insight-delta ${value >= 0 ? 'delta-pos' : 'delta-neg'}`}>
|
||||
${value >= 0 ? '+' : ''}${value.toFixed(1)}°
|
||||
</span>
|
||||
</div>
|
||||
`)}
|
||||
${(() => {
|
||||
const _wflItems = [
|
||||
{ label: 'Sun and sky', icon: '☀', value: whyFeelsLike.sunAndSky },
|
||||
{ label: 'Wind', icon: '🌬', value: whyFeelsLike.wind },
|
||||
{ label: 'Humidity', icon: '💧', value: whyFeelsLike.humidity },
|
||||
...(whyFeelsLike.environment !== 0 ? [
|
||||
{ label: UTCI_ENVIRONMENTS[utciEnv]?.label ?? 'Environment', icon: '🌍', value: whyFeelsLike.environment }
|
||||
] : []),
|
||||
...(whyFeelsLike.precipitation !== 0 ? [
|
||||
{ label: 'Precipitation', icon: '🌧', value: whyFeelsLike.precipitation }
|
||||
] : []),
|
||||
];
|
||||
const _wflMax = Math.max(..._wflItems.map(i => Math.abs(i.value)), 0.1);
|
||||
return _wflItems.map(({ label, icon, value }) => html`
|
||||
<div class="insight-row" key=${label}>
|
||||
<span class="insight-icon">${icon}</span>
|
||||
<span class="insight-label">
|
||||
${label}
|
||||
<span class="insight-bar-track">
|
||||
<span class=${'insight-bar ' + (value >= 0 ? 'bar-pos' : 'bar-neg')}
|
||||
style=${{ width: `${Math.round(Math.abs(value) / _wflMax * 100)}%` }}></span>
|
||||
</span>
|
||||
</span>
|
||||
<span class=${`insight-delta ${value >= 0 ? 'delta-pos' : 'delta-neg'}`}>
|
||||
${value >= 0 ? '+' : ''}${value.toFixed(1)}°
|
||||
</span>
|
||||
</div>
|
||||
`);
|
||||
})()}
|
||||
</div>`}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user