diff --git a/apps/frontend/src/app/components/AssetsDropdown.tsx b/apps/frontend/src/app/components/AssetsDropdown.tsx index 77df916a..ab898c50 100644 --- a/apps/frontend/src/app/components/AssetsDropdown.tsx +++ b/apps/frontend/src/app/components/AssetsDropdown.tsx @@ -58,7 +58,7 @@ const AssetsDropdown = () => { const layerData = loadedLayers.find( (layer) => layer.asset_name === layerName, ); - if (!layerData || !layerData.layer_url) { + if (!layerData?.layer_url) { toast.error(`Layer URL not found for ${layerName}`); return; } @@ -120,9 +120,9 @@ const AssetsDropdown = () => { [...loadedLayers] .sort((a, b) => a.asset_name.localeCompare(b.asset_name)) .filter((a) => a.item_id === itemIds[sliderValue]) - .map((layer, index) => ( + .map((layer) => ( )) ) : ( - <>
{
{t('loading_label')}
- + )} )} diff --git a/apps/frontend/src/app/components/Footer.tsx b/apps/frontend/src/app/components/Footer.tsx index 54cad84d..ada547a7 100644 --- a/apps/frontend/src/app/components/Footer.tsx +++ b/apps/frontend/src/app/components/Footer.tsx @@ -129,9 +129,9 @@ const Footer = () => { isDraggingRef.current = false; document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); - + const finalValue = pendingSliderRef.current; - + setSliderValue(finalValue); const map = mapRef.current as Map; if (timeStamps.length > 0) { @@ -171,7 +171,7 @@ const Footer = () => { timeStamps.length - 1, ), ); - + setPendingSliderValue(newValue); pendingSliderRef.current = newValue; } @@ -232,14 +232,14 @@ const Footer = () => { ? parseInt(stringCurrentSliderValue) : 0; if (timestampsResponse) { - await setTimeStamps(timestampsResponse); + setTimeStamps(timestampsResponse); setSliderValue(currentSliderValue); // State update is async, so move changeLayer to useEffect } const itemIdsResponse = await fetchItemIds(); if (Array.isArray(itemIdsResponse)) { - await setItemIds(itemIdsResponse); + setItemIds(itemIdsResponse); if (itemIdsResponse.length > 0) { await processLoadedLayers(itemIdsResponse[currentSliderValue]); @@ -323,7 +323,6 @@ const Footer = () => { >
{timeStamps.length > 0 && ( - <>
{ : ''}
- )}
diff --git a/apps/frontend/src/app/components/MapMetaData.tsx b/apps/frontend/src/app/components/MapMetaData.tsx index ec66b16f..f6bc3752 100644 --- a/apps/frontend/src/app/components/MapMetaData.tsx +++ b/apps/frontend/src/app/components/MapMetaData.tsx @@ -41,6 +41,7 @@ const MapMetaData: React.FC = ({ datasetSource = '', visible, refreshDatasets, + onClose, }) => { const { t } = useTranslation(); const [isCollapsed, setIsCollapsed] = useState(false); @@ -75,35 +76,35 @@ const MapMetaData: React.FC = ({ const handleMouseDown = useCallback((e: React.MouseEvent) => { if (!containerRef.current) return; - + setIsResizing(true); startXRef.current = e.clientX; startWidthRef.current = containerRef.current.offsetWidth; - + // Hint browser about upcoming changes for better performance if (containerRef.current) { containerRef.current.style.willChange = 'width'; } - + e.preventDefault(); }, []); const handleMouseMove = useCallback((e: MouseEvent) => { if (!isResizing || !containerRef.current) return; - + const dx = e.clientX - startXRef.current; let newWidth = startWidthRef.current + dx; - + // Apply constraints newWidth = Math.max(minWidth, Math.min(newWidth, maxWidth)); - + // DIRECT DOM UPDATE (no React state lag) containerRef.current.style.width = `${newWidth}px`; }, [isResizing, maxWidth, minWidth]); const handleMouseUp = useCallback(() => { if (!isResizing || !containerRef.current) return; - + // Only update React state AFTER dragging finishes setWidth(containerRef.current.offsetWidth); containerRef.current.style.willChange = 'auto'; @@ -322,24 +323,26 @@ const MapMetaData: React.FC = ({ ); const NonCollapsedMetaData = ( -
-
- {name || t('unknown_name')} - +
+
{[ { label: t('description'), value: description, - testId: 'dataset-description', + testId: 'dataset-description' }, { label: t('format'), value: format, testId: 'dataset-format' }, { @@ -379,7 +382,7 @@ const MapMetaData: React.FC = ({
{/* Resize handle */} -
= ({ return <>{isCollapsed ? CollapsedMetaData : NonCollapsedMetaData}; }; -export default MapMetaData; \ No newline at end of file +export default MapMetaData; diff --git a/apps/frontend/src/app/components/MapView.tsx b/apps/frontend/src/app/components/MapView.tsx index 6e0ff2bd..c74fd687 100644 --- a/apps/frontend/src/app/components/MapView.tsx +++ b/apps/frontend/src/app/components/MapView.tsx @@ -292,10 +292,10 @@ export const changeLayer = ( timestamp?: string, ) => { if (collection) { - refreshLayer(map, (collection = true)); + refreshLayer(map, true); } if (timestamp) { - refreshLayer(map, (collection = false), timestamp); + refreshLayer(map, false, timestamp); } }; diff --git a/apps/frontend/src/app/components/Sidebar.tsx b/apps/frontend/src/app/components/Sidebar.tsx index c90ac252..60e00b98 100644 --- a/apps/frontend/src/app/components/Sidebar.tsx +++ b/apps/frontend/src/app/components/Sidebar.tsx @@ -45,28 +45,45 @@ const Sidebar = () => { ) : ( <> -
- {t('collapse')} -
+ - {t('default_layer')} handleLayerChange('default')} - /> - {t('topographical_layer')} + {t('default_layer')} + + + )}
diff --git a/apps/frontend/src/app/styles/MapMetaData.css b/apps/frontend/src/app/styles/MapMetaData.css index e039e735..2640088c 100644 --- a/apps/frontend/src/app/styles/MapMetaData.css +++ b/apps/frontend/src/app/styles/MapMetaData.css @@ -95,7 +95,20 @@ border-top-left-radius: 8px; border-top-right-radius: 8px; } +.header-button { + background: none; + border: none; + padding: 0; + margin: 0; + width: 100%; + text-align: left; + cursor: pointer; +} +.header-button .header { + display: flex; + align-items: center; +} .content { padding: 12px; transition: max-height 0.3s ease, opacity 0.3s ease; diff --git a/apps/frontend/src/app/styles/Sidebar.css b/apps/frontend/src/app/styles/Sidebar.css index c7f457c4..1e299e00 100644 --- a/apps/frontend/src/app/styles/Sidebar.css +++ b/apps/frontend/src/app/styles/Sidebar.css @@ -40,7 +40,15 @@ align-items: center; outline: none; } - +.sidebar-toggle-button { + background: none; + border: none; + padding: 0; + margin: 0; + width: auto; + height: auto; + cursor: pointer; +} .icon { width: 30px; height: 30px; @@ -50,7 +58,13 @@ .icon:hover { transform: scale(1.05); } - +.layer-image-button { + border: none; + background: none; + padding: 0; + margin: 0; + display: inline-block; +} .layer-image { width: 100%; height: auto;