Skip to content

Commit 4d1bb90

Browse files
feat: enhance geolocation fallback and fix search results container
1 parent 817f879 commit 4d1bb90

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/js/core/WeatherApp.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,27 @@ export class WeatherApp {
220220
// Continue to fallback location
221221
}
222222

223-
// Attempt 2: Fallback to Tehran (most reliable default)
224-
console.log('[WeatherApp] Using Tehran as fallback location');
223+
// Attempt 2: Try fallback location using IP geolocation
224+
console.log('[WeatherApp] Attempting fallback location via IP geolocation...');
225+
try {
226+
const fallbackLocation = await this.geolocationManager.getFallbackLocation();
227+
if (fallbackLocation && fallbackLocation.lat && fallbackLocation.lon) {
228+
console.log(
229+
`[WeatherApp] Fallback location found: ${fallbackLocation.city || 'Unknown'}, ${fallbackLocation.country}`
230+
);
231+
await this.getWeatherByCoordinates(fallbackLocation.lat, fallbackLocation.lon);
232+
this.toast.showInfo(
233+
`🌤️ Weather loaded for ${fallbackLocation.city || 'your location'} (via IP geolocation)`
234+
);
235+
return;
236+
}
237+
} catch (fallbackError) {
238+
console.warn('[WeatherApp] Fallback location failed:', fallbackError.message);
239+
}
240+
241+
// Attempt 3: Fallback to Tehran (most reliable default)
242+
console.log('[WeatherApp] Using Tehran as final fallback location');
243+
225244
await this.getWeatherByCoordinates(35.6892, 51.389);
226245
this.toast.showInfo('🌤️ Weather loaded for Tehran (geolocation unavailable)');
227246
} catch (error) {

src/js/ui/SearchManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class SearchManager {
201201
container.style.display = 'block';
202202
container.style.opacity = '1';
203203
container.style.visibility = 'visible';
204-
container.classList.add('show');
204+
container.classList.add('show', '__web-inspector-hide-shortcut__');
205205

206206
console.log(`[SearchManager] ✅ SHOWING ${results.length} results`);
207207

0 commit comments

Comments
 (0)