mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 00:20:07 +00:00
8e95b4c7b6
useJourneyEntryForm holds the fields, the photo queue that only goes out on save, the gallery links, the location search and "use my location", the verdict rows, quick capture and the save for both the editor dialog and the entry sheet. journeyWeatherCategory moves to components/Journey/journeyWeather so the dialog no longer reaches into mobile/. Where the two differed they still do: the dialog starts with a blank verdict row, counts a moved point as a change, toasts a failed save or location and fills the weather from the forecast; the sheet edits tags and shows a refused location under the field.
16 lines
755 B
TypeScript
16 lines
755 B
TypeScript
/**
|
|
* The journey weather icon id for a weather service answer: its main condition, with
|
|
* the description telling a partly cloudy sky from a cloudy one. 'cold' is the stored
|
|
* id for snow.
|
|
*/
|
|
export function journeyWeatherCategory(main: string, description: string): string {
|
|
const normalizedMain = main.toLowerCase();
|
|
const normalizedDescription = description.toLowerCase();
|
|
if (normalizedMain === 'clear') return 'sunny';
|
|
if (normalizedMain === 'thunderstorm') return 'stormy';
|
|
if (normalizedMain === 'snow') return 'cold';
|
|
if (normalizedMain === 'rain' || normalizedMain === 'drizzle') return 'rainy';
|
|
if (normalizedDescription.includes('partly') || normalizedDescription.includes('teilweise')) return 'partly';
|
|
return 'cloudy';
|
|
}
|