Select usable Flanders theme by default
This commit is contained in:
@@ -17,6 +17,8 @@ def test_flanders_workspace_exposes_governed_thematic_products_on_demand() -> No
|
||||
assert "activeScopeProject?.name === FLANDERS_WORKSPACE_PROJECT_NAME" in workspace
|
||||
assert "new Map<DataThemeId, ThematicRasterProductRead>" in workspace
|
||||
assert "'Op aanvraag'" in workspace
|
||||
assert "theme.id === 'space_occupation'" in workspace
|
||||
assert "setActiveThemeId(fallbackTheme.id)" in workspace
|
||||
assert "thematicProductKey: thematicProduct.key" in workspace
|
||||
assert "datasetsApi.listThematicRasterProducts" in product_hook
|
||||
assert "datasetsApi.acquireThematicRaster" in selection_hook
|
||||
|
||||
@@ -790,6 +790,40 @@ export function MapWorkspace({
|
||||
const onDemandThematicThemeActive = analysisMode === 'current' && Boolean(activeOnDemandThematicProduct)
|
||||
const regionalOnDemandThematicThemeActive = regionalScopeSelected && onDemandThematicThemeActive
|
||||
const activeThemeAvailable = Boolean(activeThemeDataset) || onDemandThematicThemeActive
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!flandersScopeSelected
|
||||
|| analysisMode !== 'current'
|
||||
|| activeThemeAvailable
|
||||
|| (onDemandThematicProductMap.size === 0 && !thematicRasterProductsError)
|
||||
) {
|
||||
return
|
||||
}
|
||||
const fallbackTheme = DATA_THEMES.find((theme) =>
|
||||
theme.id === 'space_occupation'
|
||||
&& Boolean(themeDatasetMap[theme.id] || onDemandThematicProductMap.get(theme.id)),
|
||||
) ?? DATA_THEMES.find((theme) =>
|
||||
Boolean(themeDatasetMap[theme.id] || onDemandThematicProductMap.get(theme.id)),
|
||||
)
|
||||
if (!fallbackTheme) {
|
||||
return
|
||||
}
|
||||
setActiveThemeId(fallbackTheme.id)
|
||||
const fallbackDataset = themeDatasetMap[fallbackTheme.id]
|
||||
if (fallbackDataset) {
|
||||
onOpenDatasetInMap(fallbackDataset)
|
||||
}
|
||||
}, [
|
||||
activeThemeAvailable,
|
||||
analysisMode,
|
||||
flandersScopeSelected,
|
||||
onDemandThematicProductMap,
|
||||
onOpenDatasetInMap,
|
||||
thematicRasterProductsError,
|
||||
themeDatasetMap,
|
||||
])
|
||||
|
||||
const terrainImageOverlays = useMemo(
|
||||
() =>
|
||||
activeTheme.id === 'elevation' && selectedProjectId
|
||||
|
||||
Reference in New Issue
Block a user