mirror of
https://github.com/mue/mue.git
synced 2026-06-06 07:55:48 +02:00
fix: Refactor event handling in LocationSearch and streamline modal navigation logic in Modals
This commit is contained in:
@@ -60,7 +60,9 @@ const LocationSearch = memo((props) => {
|
||||
// Also ignore clicks on color input labels and wrappers
|
||||
const target = event.target;
|
||||
if (target.tagName === 'LABEL' && target.htmlFor) {
|
||||
const associatedInput = document.getElementById(target.htmlFor) || document.querySelector(`input[name="${target.htmlFor}"]`);
|
||||
const associatedInput =
|
||||
document.getElementById(target.htmlFor) ||
|
||||
document.querySelector(`input[name="${target.htmlFor}"]`);
|
||||
if (associatedInput && associatedInput.type === 'color') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,13 +176,11 @@ const Modals = () => {
|
||||
} else if (action === false && type === 'mainModal') {
|
||||
// Mark modal as closing to prevent sync logic from interfering
|
||||
setIsModalClosing(true);
|
||||
// Wait for close animation and cleanup to complete, then navigate
|
||||
// Navigate immediately to avoid URL flash
|
||||
navigate('/');
|
||||
// Wait for close animation to complete, then reset closing flag
|
||||
setTimeout(() => {
|
||||
navigate('/');
|
||||
// Reset the closing flag after navigation
|
||||
setTimeout(() => {
|
||||
setIsModalClosing(false);
|
||||
}, 100);
|
||||
setIsModalClosing(false);
|
||||
}, 350);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ const WeatherWidget = memo(() => {
|
||||
const updateWeather = useCallback(async () => {
|
||||
const currentLocation = getLocationFromStorage();
|
||||
setLocation(currentLocation);
|
||||
|
||||
|
||||
const data = await getWeather(currentLocation);
|
||||
console.log('Weather data received:', data);
|
||||
if (data) {
|
||||
|
||||
Reference in New Issue
Block a user