Simplify the Travel Forecast screen
Some checks are pending
build-docker / Build Image (push) Waiting to run
Some checks are pending
build-docker / Build Image (push) Waiting to run
This commit is contained in:
parent
e24ce39c69
commit
536936f65f
2 changed files with 2 additions and 19 deletions
|
|
@ -2,7 +2,6 @@
|
||||||
import STATUS from './status.mjs';
|
import STATUS from './status.mjs';
|
||||||
import { safePromiseAll } from './utils/fetch.mjs';
|
import { safePromiseAll } from './utils/fetch.mjs';
|
||||||
import { getSmallIconFromWmoCode } from './icons.mjs';
|
import { getSmallIconFromWmoCode } from './icons.mjs';
|
||||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
|
||||||
import WeatherDisplay from './weatherdisplay.mjs';
|
import WeatherDisplay from './weatherdisplay.mjs';
|
||||||
import { registerDisplay } from './navigation.mjs';
|
import { registerDisplay } from './navigation.mjs';
|
||||||
import calculateScrollTiming from './utils/scroll-timing.mjs';
|
import calculateScrollTiming from './utils/scroll-timing.mjs';
|
||||||
|
|
@ -145,11 +144,6 @@ class TravelForecast extends WeatherDisplay {
|
||||||
// list of cities. The second canvas is copied into the standard canvas to create the scroll
|
// list of cities. The second canvas is copied into the standard canvas to create the scroll
|
||||||
super.drawCanvas();
|
super.drawCanvas();
|
||||||
|
|
||||||
// set up variables
|
|
||||||
const cities = this.data;
|
|
||||||
|
|
||||||
this.elem.querySelector('.header .title.dual .bottom').innerHTML = `For ${getTravelCitiesDayName(cities)}`;
|
|
||||||
|
|
||||||
this.finishDraw();
|
this.finishDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,16 +301,5 @@ const getTravelDisplayHeight = (elem) => {
|
||||||
return Math.max(0, main.offsetHeight - (header?.offsetHeight ?? 0));
|
return Math.max(0, main.offsetHeight - (header?.offsetHeight ?? 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
// effectively returns early on the first found date
|
|
||||||
const getTravelCitiesDayName = (cities) => cities.reduce((dayName, city) => {
|
|
||||||
if (city && dayName === '') {
|
|
||||||
// today or tomorrow
|
|
||||||
const day = DateTime.local().plus({ days: (city.today) ? 0 : 1 });
|
|
||||||
// return the day
|
|
||||||
return day.toLocaleString({ weekday: 'long' });
|
|
||||||
}
|
|
||||||
return dayName;
|
|
||||||
}, '');
|
|
||||||
|
|
||||||
// register display, not active by default
|
// register display, not active by default
|
||||||
registerDisplay(new TravelForecast(5, 'travel', false));
|
registerDisplay(new TravelForecast(5, 'travel', false));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<%- include('header.ejs', {titleDual: {top: 'Travel Forecast', bottom: 'For '} , hasTime: true }) %>
|
<%- include('header.ejs', {title:'Travel Forecast', hasTime: true}) %>
|
||||||
<div class="main has-scroll travel">
|
<div class="main has-scroll travel">
|
||||||
<div class="column-headers">
|
<div class="column-headers">
|
||||||
<div class="temp low">LOW</div>
|
<div class="temp low">LOW</div>
|
||||||
|
|
@ -12,4 +12,4 @@
|
||||||
<div class="temp high"></div>
|
<div class="temp high"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue