forked from Blendman974/faceclaw
1 parent
cb165d90d2
commit
2c819c8d0e
13 files changed
+537
-25
No files matched your search
@@ -14,7 +14,7 @@ import {
|
||||
export const WEATHER_WINDOW_ID = "weather";
|
||||
export const WEATHER_SURFACE_ID = "window:weather";
|
||||
|
||||
/** Local current conditions and forecast from the National Weather Service. */
|
||||
/** Local current conditions and forecast from the National Weather Service, or Open-Meteo outside the US. */
|
||||
export function createWeatherAppWindow(options: InProcessAppOptions): InProcessWindow {
|
||||
let closed = false;
|
||||
let requestingPermission = false;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getDefaultLargeFont, getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { type ForecastPeriod, type WeatherState } from "../../native/weather";
|
||||
import { WEATHER_SOURCE_NAMES, type ForecastPeriod, type WeatherState } from "../../native/weather";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { Menu, type MenuDrawArgs } from "../../ui/menu-core";
|
||||
@@ -145,7 +145,9 @@ export class WeatherLayer implements Layer {
|
||||
}
|
||||
image.drawText(small, textX, cy, details.join(" ") || "Current forecast", 170);
|
||||
cy += lineStep(small);
|
||||
const source = current.observed ? "Observed" : "Forecast";
|
||||
// Naming the source also credits Open-Meteo, as its CC BY licence asks.
|
||||
const sourceName = weather.source ? `${WEATHER_SOURCE_NAMES[weather.source]} ` : "";
|
||||
const source = `${sourceName}${current.observed ? "observed" : "forecast"}`;
|
||||
const age = current.timestampMs ? formatAge(Date.now() - current.timestampMs) : "";
|
||||
const updating = weather.phase === "locating" || weather.phase === "loading" ? " · updating" : "";
|
||||
image.drawText(small, textX, cy, `${source}${age ? ` ${age}` : ""}${updating}`, 105);
|
||||
|
||||
Reference in new issue
Block a user