Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fdm-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 18 additions & 11 deletions fdm-app/app/components/blocks/atlas/atlas-panels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -191,6 +194,21 @@ export default function FarmAtlasFieldsBlock() {
<Layer {...fieldsAvailableStyle} layout={layerLayout} />
</FieldsSourceAvailable>

{fields && (
<FieldsSourceNotClickable id={id} fieldsData={fields}>
<Layer
{...fieldsSavedOutlineStyle}
source={id}
layout={layerLayout}
/>
<Layer
{...fieldsSavedStyle}
source={id}
layout={layerLayout}
/>
</FieldsSourceNotClickable>
)}

<div className="fields-panel grid gap-4 w-[350px]">
<FieldsPanelHover
zoomLevelFields={ZOOM_LEVEL_FIELDS}
Expand Down
10 changes: 8 additions & 2 deletions fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,14 @@ export default function Index() {
id={fieldsSavedId}
fieldsData={fieldsSaved}
>
<Layer {...fieldsSavedStyle} />
<Layer {...fieldsSavedOutlineStyle} />
<Layer
{...fieldsSavedOutlineStyle}
source={fieldsSavedId}
/>
<Layer
{...fieldsSavedStyle}
source={fieldsSavedId}
/>
</FieldsSourceNotClickable>

<div className="fields-panel grid gap-4 w-[350px]">
Expand Down
2 changes: 1 addition & 1 deletion fdm-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@svenvw/fdm-app",
"version": "0.25.1",
"version": "0.25.2",
"private": true,
"sideEffects": false,
"type": "module",
Expand Down