regional forecast/observation title close #11

This commit is contained in:
Matt Walsh
2022-08-04 20:12:44 -05:00
parent d34b0ca224
commit 902818d7a0
7 changed files with 16 additions and 6 deletions

View File

@@ -343,17 +343,24 @@ class RegionalForecast extends WeatherDisplay {
draw.triangle(this.context, 'rgb(28, 10, 87)', 500, 30, 450, 90, 500, 90);
// draw the appropriate title
const titleTop = this.elem.querySelector('.title.dual .top');
const titleBottom = this.elem.querySelector('.title.dual .bottom');
if (this.screenIndex === 0) {
titleTop.innerHTML = 'Regional';
titleBottom.innerHTML = 'Observations';
draw.titleText(this.context, 'Regional', 'Observations');
} else {
const forecastDate = DateTime.fromISO(data[0][this.screenIndex].time);
// get the name of the day
const dayName = forecastDate.toLocaleString({ weekday: 'long' });
titleTop.innerHTML = 'Forecast for';
// draw the title
if (data[0][this.screenIndex].daytime) {
titleBottom.innerHTML = dayName;
draw.titleText(this.context, 'Forecast for', dayName);
} else {
titleBottom.innerHTML = `${dayName} Night`;
draw.titleText(this.context, 'Forecast for', `${dayName} Night`);
}
}