mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-21 02:59:31 -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,
|
||||
// stopping as soon as we have 7 valid stations with data.
|
||||
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;
|
||||
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
|
||||
// and only fetch additional batches if needed, rather than hitting all 30 stations at once
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
@@ -50,11 +51,11 @@ class LatestObservations extends WeatherDisplay {
|
||||
actualConditions.push(...someStations);
|
||||
// update counters
|
||||
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
|
||||
this.data = actualConditions.slice(0, this.MaximumRegionalStations);
|
||||
// cut down to the maximum that fit on the page
|
||||
this.data = actualConditions.slice(0, stationLimit);
|
||||
|
||||
// test for at least one station
|
||||
if (this.data.length === 0) {
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
@use 'shared/_colors'as c;
|
||||
@use 'shared/_utils'as u;
|
||||
@use 'shared/_positions'as p;
|
||||
|
||||
.weather-display .latest-observations {
|
||||
|
||||
&.main {
|
||||
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 {
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
@@ -91,6 +102,10 @@
|
||||
min-height: 338px;
|
||||
padding-top: 10px;
|
||||
|
||||
.portrait.enhanced & {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
.observation-row {
|
||||
font-family: 'Star4000';
|
||||
font-size: 24pt;
|
||||
@@ -107,6 +122,13 @@
|
||||
white-space: pre;
|
||||
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