mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-22 11:39:30 -07:00
portrait latest observations #167
This commit is contained in:
@@ -39,9 +39,10 @@ class LatestObservations extends WeatherDisplay {
|
|||||||
// We start with the 7 closest stations and only fetch more if some fail,
|
// We start with the 7 closest stations and only fetch more if some fail,
|
||||||
// stopping as soon as we have 7 valid stations with data.
|
// stopping as soon as we have 7 valid stations with data.
|
||||||
const actualConditions = [];
|
const actualConditions = [];
|
||||||
let lastStation = Math.min(regionalStations.length, 7);
|
const stationLimit = this.MaximumRegionalStations * ((settings.portrait?.value) ? 2 : 1);
|
||||||
|
let lastStation = Math.min(regionalStations.length, stationLimit);
|
||||||
let firstStation = 0;
|
let firstStation = 0;
|
||||||
while (actualConditions.length < 7 && (lastStation) <= regionalStations.length) {
|
while (actualConditions.length < stationLimit && (lastStation) <= regionalStations.length) {
|
||||||
// Sequential fetching is intentional here - we want to try closest stations first
|
// Sequential fetching is intentional here - we want to try closest stations first
|
||||||
// and only fetch additional batches if needed, rather than hitting all 30 stations at once
|
// and only fetch additional batches if needed, rather than hitting all 30 stations at once
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
@@ -50,11 +51,11 @@ class LatestObservations extends WeatherDisplay {
|
|||||||
actualConditions.push(...someStations);
|
actualConditions.push(...someStations);
|
||||||
// update counters
|
// update counters
|
||||||
firstStation += lastStation;
|
firstStation += lastStation;
|
||||||
lastStation = Math.min(regionalStations.length + 1, firstStation + 7 - actualConditions.length);
|
lastStation = Math.min(regionalStations.length + 1, firstStation + stationLimit - actualConditions.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cut down to the maximum of 7
|
// cut down to the maximum that fit on the page
|
||||||
this.data = actualConditions.slice(0, this.MaximumRegionalStations);
|
this.data = actualConditions.slice(0, stationLimit);
|
||||||
|
|
||||||
// test for at least one station
|
// test for at least one station
|
||||||
if (this.data.length === 0) {
|
if (this.data.length === 0) {
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
@use 'shared/_colors'as c;
|
@use 'shared/_colors'as c;
|
||||||
@use 'shared/_utils'as u;
|
@use 'shared/_utils'as u;
|
||||||
|
@use 'shared/_positions'as p;
|
||||||
|
|
||||||
.weather-display .latest-observations {
|
.weather-display .latest-observations {
|
||||||
|
|
||||||
&.main {
|
&.main {
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
// adjust for the height of the column headers
|
||||||
|
max-height: calc(p.$standard-scroll-height - 10px);
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.portrait.enhanced & {
|
||||||
|
max-height: calc(p.$portrait-scroll-height - 20px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.column-headers {
|
.column-headers {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -91,6 +102,10 @@
|
|||||||
min-height: 338px;
|
min-height: 338px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
|
|
||||||
|
.portrait.enhanced & {
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
.observation-row {
|
.observation-row {
|
||||||
font-family: 'Star4000';
|
font-family: 'Star4000';
|
||||||
font-size: 24pt;
|
font-size: 24pt;
|
||||||
@@ -107,6 +122,13 @@
|
|||||||
white-space: pre;
|
white-space: pre;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.portrait.enhanced & {
|
||||||
|
font-family: 'Star4000 Large';
|
||||||
|
font-size: 16pt;
|
||||||
|
height: 48px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
server/styles/ws.min.css
vendored
2
server/styles/ws.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user