Enhance dashboard interactivity and update dependencies

- Added a new function to navigate to specific locations on the map with animation and detail display.
- Made the item title clickable to trigger the navigation function.
- Updated CSS to style the clickable item title for better user experience.
- Added `pydantic[email]` to backend requirements for enhanced validation capabilities.
This commit is contained in:
2025-09-26 20:31:22 +08:00
parent 2a46ecb7d2
commit 0e3eea7de9
3 changed files with 41 additions and 2 deletions

View File

@@ -320,6 +320,25 @@ function App(){
window.open(`https://www.google.com/maps/search/?api=1&query=${lat},${lng}`, '_blank');
};
const navigateToLocation = (r) => {
const map = mapRef.current;
if (!map || !r.location) return;
const { lat, lng } = r.location;
const currentZoom = map.getZoom();
const targetZoom = 20; // Maximum zoom level for focusing on a specific location
// First zoom out a bit for animation effect, then zoom to target
map.flyTo([lat, lng], targetZoom, {
animate: true,
duration: 1.5,
easeLinearity: 0.25
});
// Also set the selected item to show details
setSelected(r);
};
return (
<div className="app-root">
<header className="header">
@@ -411,7 +430,13 @@ function App(){
<div key={r.id} className="queue-item" role="listitem">
<div className="thumb">{t(`category.${r.category}`) || r.category}</div>
<div className="item-main">
<div className="item-title">{t(`category.${r.category}`) || r.category}</div>
<div
className="item-title clickable"
onClick={() => navigateToLocation(r)}
title="Click to view on map"
>
{t(`category.${r.category}`) || r.category}
</div>
<div className="item-meta">
<span className={`chip severity-${r.severity}`}>{t(`severity.${r.severity}`) || r.severity}</span>
<span className={`chip status-${r.status}`}>{t(`status.${r.status}`) || r.status}</span>