revamp weather UI: cards, meteograms, units in header, location favorites and range controls
This commit is contained in:
@@ -90,7 +90,7 @@ export interface ChartPanel {
|
||||
}
|
||||
|
||||
export const defaultChartLayout: ChartPanel[] = [
|
||||
{ id: 'panel-1', variables: ['temperature', 'cloud_cover'] },
|
||||
{ id: 'panel-1', variables: ['weather_icons', 'temperature', 'cloud_cover'] },
|
||||
{ id: 'panel-2', variables: ['precipitation', 'precipitation_probability'] },
|
||||
{ id: 'panel-3', variables: ['wind', 'humidity'] }
|
||||
];
|
||||
@@ -99,3 +99,27 @@ export const storedChartLayout = persisted<ChartPanel[]>('chart_layout_v1', defa
|
||||
|
||||
/** Selected ensemble model for the 14-day spread forecast. */
|
||||
export const storedEnsembleModel = persisted<string>('ensemble_model', 'ncep_gefs_seamless');
|
||||
|
||||
/** Measurement units, shared across every forecast page and persisted. */
|
||||
export interface UnitPrefs {
|
||||
temperature_unit: 'celsius' | 'fahrenheit';
|
||||
wind_speed_unit: 'kmh' | 'ms' | 'mph' | 'kn';
|
||||
precipitation_unit: 'mm' | 'inch';
|
||||
}
|
||||
|
||||
export const defaultUnits: UnitPrefs = {
|
||||
temperature_unit: 'celsius',
|
||||
wind_speed_unit: 'kmh',
|
||||
precipitation_unit: 'mm'
|
||||
};
|
||||
|
||||
export const storedUnits = persisted<UnitPrefs>('units_v1', defaultUnits);
|
||||
|
||||
/** Recently visited and starred locations, shown in the search dropdown. */
|
||||
export const storedRecentLocations = persisted<GeoLocation[]>('recent_locations_v1', []);
|
||||
export const storedFavoriteLocations = persisted<GeoLocation[]>('favorite_locations_v1', []);
|
||||
|
||||
/** Stable key for de-duping locations (geocoding id, or rounded coordinates). */
|
||||
export function locationKey(l: GeoLocation): string {
|
||||
return l.id && l.id !== 0 ? `id:${l.id}` : `c:${l.latitude.toFixed(3)},${l.longitude.toFixed(3)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user