mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-14 15:49:31 -07:00
add daily rain and timestamp #132
This commit is contained in:
@@ -6,6 +6,7 @@ import { registerDisplay } from './navigation.mjs';
|
|||||||
import {
|
import {
|
||||||
temperature, pressure, distanceMm, windSpeed,
|
temperature, pressure, distanceMm, windSpeed,
|
||||||
} from './utils/units.mjs';
|
} from './utils/units.mjs';
|
||||||
|
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||||
|
|
||||||
class PersonalWeather extends WeatherDisplay {
|
class PersonalWeather extends WeatherDisplay {
|
||||||
constructor(navId, elemId) {
|
constructor(navId, elemId) {
|
||||||
@@ -57,6 +58,8 @@ class PersonalWeather extends WeatherDisplay {
|
|||||||
deviceLocation: this.data.device_location,
|
deviceLocation: this.data.device_location,
|
||||||
humidity: `${this.data.Humidity}%`,
|
humidity: `${this.data.Humidity}%`,
|
||||||
pressure: `${this.data.Pressure} ${this.data.PressureUnit}`,
|
pressure: `${this.data.Pressure} ${this.data.PressureUnit}`,
|
||||||
|
dailyRain: `${this.data.DailyRain} ${this.data.DailyRainUnit}`,
|
||||||
|
timestamp: `At ${this.data.timestamp}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const area = this.elem.querySelector('.main');
|
const area = this.elem.querySelector('.main');
|
||||||
@@ -97,6 +100,7 @@ const parseData = (data) => {
|
|||||||
data.WindUnit = windConverter.units;
|
data.WindUnit = windConverter.units;
|
||||||
data.DailyRain = inConverter(data.dailyrainin);
|
data.DailyRain = inConverter(data.dailyrainin);
|
||||||
data.DailyRainUnit = inConverter.units;
|
data.DailyRainUnit = inConverter.units;
|
||||||
|
data.timestamp = DateTime.fromISO(data.date).toFormat('H:mm:ss a EEE MMM d').toUpperCase();
|
||||||
|
|
||||||
// set wind speed of 0 as calm
|
// set wind speed of 0 as calm
|
||||||
if (data.WindSpeed === 0) data.WindSpeed = 'Calm';
|
if (data.WindSpeed === 0) data.WindSpeed = 'Calm';
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,6 +12,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
|
height: 290px;
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
@@ -53,5 +54,15 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-wrap: nowrap;
|
text-wrap: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timestamp {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 15px;
|
||||||
|
right: 10px;
|
||||||
|
text-align: right;
|
||||||
|
font-family: "Star4000 Small";
|
||||||
|
font-size: 24pt;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,9 @@
|
|||||||
<div class="pressure value"></div>
|
<div class="pressure value"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="heat-index-label label"></div>
|
<div class="label">Daily Rain:</div>
|
||||||
<div class="heat-index value"></div>
|
<div class="dailyRain value"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="timestamp value">At 12:34:55 PM</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user