diff --git a/fdm-app/CHANGELOG.md b/fdm-app/CHANGELOG.md index 9b45bc82b..52e522e2a 100644 --- a/fdm-app/CHANGELOG.md +++ b/fdm-app/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog fdm-app +## 0.25.2 + +### Patch Changes + +- f443234: Fixes that saved fields of the farm are visible again with a colored outline + ## 0.25.1 ### Patch Changes diff --git a/fdm-app/app/components/blocks/atlas/atlas-panels.tsx b/fdm-app/app/components/blocks/atlas/atlas-panels.tsx index 9364da301..6fb474911 100644 --- a/fdm-app/app/components/blocks/atlas/atlas-panels.tsx +++ b/fdm-app/app/components/blocks/atlas/atlas-panels.tsx @@ -38,22 +38,29 @@ export function FieldsPanelHover({ // Set message about zoom level const zoom = map.getZoom() if (zoom && zoom > zoomLevelFields) { + if (!map.getLayer(layer)) return + const features = map.queryRenderedFeatures(evt.point, { layers: [layer], }) if (layerExclude) { - const featuresExclude = map.queryRenderedFeatures( - evt.point, - { - layers: Array.isArray(layerExclude) - ? layerExclude - : [layerExclude], - }, - ) - if (featuresExclude && featuresExclude.length > 0) { - setPanel(null) - return + const layers = Array.isArray(layerExclude) + ? layerExclude + : [layerExclude] + const validLayers = layers.filter((l) => map.getLayer(l)) + + if (validLayers.length > 0) { + const featuresExclude = map.queryRenderedFeatures( + evt.point, + { + layers: validLayers, + }, + ) + if (featuresExclude && featuresExclude.length > 0) { + setPanel(null) + return + } } } diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx index 73c0be990..607792b46 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx @@ -12,7 +12,10 @@ import { type LoaderFunctionArgs, useLoaderData } from "react-router" import { ZOOM_LEVEL_FIELDS } from "~/components/blocks/atlas/atlas" import { Controls } from "~/components/blocks/atlas/atlas-controls" import { FieldsPanelHover } from "~/components/blocks/atlas/atlas-panels" -import { FieldsSourceAvailable } from "~/components/blocks/atlas/atlas-sources" +import { + FieldsSourceAvailable, + FieldsSourceNotClickable, +} from "~/components/blocks/atlas/atlas-sources" import { getFieldsStyle } from "~/components/blocks/atlas/atlas-styles" import { getViewState } from "~/components/blocks/atlas/atlas-viewstate" import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" @@ -117,10 +120,10 @@ export default function FarmAtlasFieldsBlock() { const id = "fieldsSaved" const fields = loaderData.savedFields - const _fieldsSavedStyle = getFieldsStyle(id) + const fieldsSavedStyle = getFieldsStyle(id) const fieldsAvailableId = "fieldsAvailable" const fieldsAvailableStyle = getFieldsStyle(fieldsAvailableId) - const _fieldsSavedOutlineStyle = getFieldsStyle("fieldsSavedOutline") + const fieldsSavedOutlineStyle = getFieldsStyle("fieldsSavedOutline") const initialViewState = getViewState(fields) // Create a sessionStorage to store the latest viewstate @@ -191,6 +194,21 @@ export default function FarmAtlasFieldsBlock() { + {fields && ( + + + + + )} +
- - + +
diff --git a/fdm-app/package.json b/fdm-app/package.json index 972d3ab34..c30d01d8e 100644 --- a/fdm-app/package.json +++ b/fdm-app/package.json @@ -1,6 +1,6 @@ { "name": "@svenvw/fdm-app", - "version": "0.25.1", + "version": "0.25.2", "private": true, "sideEffects": false, "type": "module",