feat(weather): block weather retrieval for non-current-day entries with translation alert
This commit is contained in:
@@ -412,6 +412,14 @@ export default function LogEntryEditor({ entryId, logbookId, onBack }: LogEntryE
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleFetchWeather = async () => {
|
const handleFetchWeather = async () => {
|
||||||
|
const localToday = new Date()
|
||||||
|
const todayStr = `${localToday.getFullYear()}-${String(localToday.getMonth() + 1).padStart(2, '0')}-${String(localToday.getDate()).padStart(2, '0')}`
|
||||||
|
|
||||||
|
if (date && date !== todayStr) {
|
||||||
|
showAlert(t('settings.weather_date_mismatch', { date, today: todayStr }))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const hasGps = evGpsLat && evGpsLng
|
const hasGps = evGpsLat && evGpsLng
|
||||||
const fallbackLocation = evLocationName.trim() || departure.trim() || destination.trim()
|
const fallbackLocation = evLocationName.trim() || departure.trim() || destination.trim()
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,7 @@
|
|||||||
"no_key": "Bitte hinterlegen Sie Ihren OpenWeatherMap API-Schlüssel in den Einstellungen, um Wetterdaten abzurufen.",
|
"no_key": "Bitte hinterlegen Sie Ihren OpenWeatherMap API-Schlüssel in den Einstellungen, um Wetterdaten abzurufen.",
|
||||||
"weather_success": "Wetterdaten erfolgreich abgerufen!",
|
"weather_success": "Wetterdaten erfolgreich abgerufen!",
|
||||||
"weather_error": "Wetterdatenabruf fehlgeschlagen. Überprüfen Sie den API-Schlüssel und die Verbindung.",
|
"weather_error": "Wetterdatenabruf fehlgeschlagen. Überprüfen Sie den API-Schlüssel und die Verbindung.",
|
||||||
|
"weather_date_mismatch": "Wetterdaten können nur für den heutigen Tag ({{today}}) abgerufen werden. Dieser Logbucheintrag ist auf den {{date}} datiert.",
|
||||||
"gps_error": "Bitte geben Sie einen Ort an oder ermitteln Sie die GPS-Koordinaten.",
|
"gps_error": "Bitte geben Sie einen Ort an oder ermitteln Sie die GPS-Koordinaten.",
|
||||||
"theme_title": "Design-Anpassung",
|
"theme_title": "Design-Anpassung",
|
||||||
"theme_label": "Design-Stil der App",
|
"theme_label": "Design-Stil der App",
|
||||||
|
|||||||
@@ -178,6 +178,7 @@
|
|||||||
"no_key": "Please set your OpenWeatherMap API Key in settings to enable weather auto-fill.",
|
"no_key": "Please set your OpenWeatherMap API Key in settings to enable weather auto-fill.",
|
||||||
"weather_success": "Weather details fetched successfully!",
|
"weather_success": "Weather details fetched successfully!",
|
||||||
"weather_error": "Failed to fetch weather. Check your API key and connection.",
|
"weather_error": "Failed to fetch weather. Check your API key and connection.",
|
||||||
|
"weather_date_mismatch": "Weather data can only be fetched for today ({{today}}). This logbook entry is dated {{date}}.",
|
||||||
"gps_error": "Please enter a location or fetch GPS coordinates first.",
|
"gps_error": "Please enter a location or fetch GPS coordinates first.",
|
||||||
"theme_title": "UI Customization",
|
"theme_title": "UI Customization",
|
||||||
"theme_label": "Application Style / Theme",
|
"theme_label": "Application Style / Theme",
|
||||||
|
|||||||
Reference in New Issue
Block a user