Fix regional bathymetry context labels
This commit is contained in:
+43
-4
@@ -36,7 +36,12 @@ import { useSourceFreshness } from './hooks/useSourceFreshness'
|
||||
import { useWorkbenchBootstrap } from './hooks/useWorkbenchBootstrap'
|
||||
import { useViewportVectorLayer } from './hooks/useViewportVectorLayer'
|
||||
import { getDatasetDisplayName } from './lib/datasetDisplay'
|
||||
import { REGIONAL_WORKSPACE_LABEL, REGIONAL_WORKSPACE_PROJECT_NAME } from './config/primaryFocus'
|
||||
import {
|
||||
FLANDERS_WORKSPACE_LABEL,
|
||||
FLANDERS_WORKSPACE_PROJECT_NAME,
|
||||
REGIONAL_WORKSPACE_LABEL,
|
||||
REGIONAL_WORKSPACE_PROJECT_NAME,
|
||||
} from './config/primaryFocus'
|
||||
|
||||
function isVectorDatasetType(datasetType: string): boolean {
|
||||
return datasetType === 'vector' || datasetType === 'geojson'
|
||||
@@ -664,8 +669,38 @@ function App(): JSX.Element {
|
||||
|| segmentationItems.length > 0
|
||||
const projectContextLabel = selectedProject?.name === REGIONAL_WORKSPACE_PROJECT_NAME
|
||||
? REGIONAL_WORKSPACE_LABEL
|
||||
: selectedProject?.name ?? 'Geen werkruimte'
|
||||
: selectedProject?.name === FLANDERS_WORKSPACE_PROJECT_NAME
|
||||
? FLANDERS_WORKSPACE_LABEL
|
||||
: selectedProject?.name ?? 'Geen werkruimte'
|
||||
const areaContextLabel = selectedArea?.name ?? (areas.length > 0 ? 'Kies een gebied' : 'Geen gebied')
|
||||
const bathymetryContextActive = Boolean(
|
||||
activeWorkspace === 'map'
|
||||
&& selectedDataset?.source_name === 'vmm_vha_bathymetry_profiles',
|
||||
)
|
||||
const regionalBathymetryContextActive = Boolean(
|
||||
bathymetryContextActive
|
||||
&& selectedDataset?.source_metadata?.regional_partitions_complete === true
|
||||
&& selectedArea
|
||||
&& !/^Gemeente\s/i.test(selectedArea.name),
|
||||
)
|
||||
const regionalBathymetryManifest = String(
|
||||
selectedDataset?.source_metadata?.partition_manifest_sha256 ?? '',
|
||||
)
|
||||
const regionalBathymetryPartitions = regionalBathymetryContextActive
|
||||
? availableMapDatasets.filter(
|
||||
(dataset) =>
|
||||
dataset.source_name === 'vmm_vha_bathymetry_profiles'
|
||||
&& dataset.source_metadata?.regional_partitions_complete === true
|
||||
&& String(dataset.source_metadata?.partition_manifest_sha256 ?? '') === regionalBathymetryManifest,
|
||||
)
|
||||
: []
|
||||
const regionalBathymetryProfileCount = regionalBathymetryPartitions.reduce(
|
||||
(total, dataset) => total + (dataset.feature_count ?? dataset.vector_summary?.feature_count ?? 0),
|
||||
0,
|
||||
)
|
||||
const bathymetryProfileCount = regionalBathymetryContextActive
|
||||
? regionalBathymetryProfileCount
|
||||
: selectedDataset?.feature_count ?? selectedDataset?.vector_summary?.feature_count ?? 0
|
||||
const datasetContextLabel = activeWorkspace === 'map' && mapContextSourceLabel
|
||||
? mapContextSourceLabel
|
||||
: analysisMapLayerActive && mapFeatureCollection
|
||||
@@ -675,7 +710,11 @@ function App(): JSX.Element {
|
||||
: datasets.length > 0
|
||||
? 'Kies een bron'
|
||||
: 'Geen bron'
|
||||
const layerContextLabel = mapFeatureCollection
|
||||
const layerContextLabel = bathymetryContextActive
|
||||
? regionalBathymetryContextActive
|
||||
? `${bathymetryProfileCount.toLocaleString('nl-BE')} profielen · ${regionalBathymetryPartitions.length} gemeenten`
|
||||
: `${bathymetryProfileCount.toLocaleString('nl-BE')} profielen`
|
||||
: mapFeatureCollection
|
||||
? `${mapFeatureCount.toLocaleString('nl-BE')} objecten`
|
||||
: viewportVectorLayerActive
|
||||
? 'Kaartlaag gekozen'
|
||||
@@ -693,7 +732,7 @@ function App(): JSX.Element {
|
||||
<span className="brand-mark" aria-hidden="true">GI</span>
|
||||
<div>
|
||||
<h1>GeoIntel</h1>
|
||||
<p>GeoAI-werkruimte · Mol en de Kempen</p>
|
||||
<p>GeoAI-werkruimte · gebiedsdata en analyse</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="context-bar" aria-label="Actieve werkcontext">
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import type { AreaRead, DatasetCreateResponse, ExportRead, ProjectRead, QualityCheckRead } from '../types'
|
||||
import { REGIONAL_WORKSPACE_LABEL, REGIONAL_WORKSPACE_PROJECT_NAME } from '../config/primaryFocus'
|
||||
import {
|
||||
FLANDERS_WORKSPACE_LABEL,
|
||||
FLANDERS_WORKSPACE_PROJECT_NAME,
|
||||
REGIONAL_WORKSPACE_LABEL,
|
||||
REGIONAL_WORKSPACE_PROJECT_NAME,
|
||||
} from '../config/primaryFocus'
|
||||
|
||||
interface StatusItem {
|
||||
key: string
|
||||
@@ -35,6 +40,7 @@ function statusLabel(state: StatusItem['state']): string {
|
||||
|
||||
function projectLabel(project: ProjectRead | null): string {
|
||||
if (!project) return 'Geen werkruimte'
|
||||
if (project.name === FLANDERS_WORKSPACE_PROJECT_NAME) return FLANDERS_WORKSPACE_LABEL
|
||||
return project.name === REGIONAL_WORKSPACE_PROJECT_NAME ? REGIONAL_WORKSPACE_LABEL : project.name
|
||||
}
|
||||
|
||||
|
||||
@@ -853,11 +853,17 @@ export function MapWorkspace({
|
||||
- new Date(activeTemporalSeries[0].observed_at ?? 0).getTime() <= 7 * 24 * 60 * 60 * 1000
|
||||
|
||||
useEffect(() => {
|
||||
onSetContextSourceLabel(
|
||||
analysisMode === 'evolution' ? activeTemporalSeriesGroup?.label ?? null : null,
|
||||
)
|
||||
const contextSourceLabel = analysisMode === 'evolution' ? activeTemporalSeriesGroup?.label ?? null
|
||||
: regionalBathymetryThemeActive ? 'VHA-dwarsprofielen Vlaanderen'
|
||||
: null
|
||||
onSetContextSourceLabel(contextSourceLabel)
|
||||
return () => onSetContextSourceLabel(null)
|
||||
}, [activeTemporalSeriesGroup?.label, analysisMode, onSetContextSourceLabel])
|
||||
}, [
|
||||
activeTemporalSeriesGroup?.label,
|
||||
analysisMode,
|
||||
onSetContextSourceLabel,
|
||||
regionalBathymetryThemeActive,
|
||||
])
|
||||
|
||||
const themeResults = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -5,6 +5,10 @@ import type {
|
||||
VectorSelectionMetric,
|
||||
VectorSelectionResponse,
|
||||
} from '../../types'
|
||||
import {
|
||||
FLANDERS_WORKSPACE_LABEL,
|
||||
FLANDERS_WORKSPACE_PROJECT_NAME,
|
||||
} from '../../config/primaryFocus'
|
||||
|
||||
const MOL_PROJECT_NAME = 'Mol Municipality Workbench'
|
||||
const KEMPEN_PROJECT_NAME = 'Kempen Regional Workbench'
|
||||
@@ -16,6 +20,9 @@ export function operationalScopeProjectLabel(project: ProjectRead): string {
|
||||
if (project.name === KEMPEN_PROJECT_NAME) {
|
||||
return 'Kempen (28 gemeenten)'
|
||||
}
|
||||
if (project.name === FLANDERS_WORKSPACE_PROJECT_NAME) {
|
||||
return FLANDERS_WORKSPACE_LABEL
|
||||
}
|
||||
return project.name
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ export const PRIMARY_FOCUS_LABEL = 'Mol'
|
||||
export const PRIMARY_FOCUS_REGION = 'Mol, Kempen'
|
||||
export const REGIONAL_WORKSPACE_PROJECT_NAME = 'Kempen Regional Workbench'
|
||||
export const REGIONAL_WORKSPACE_LABEL = 'Kempen (28 gemeenten)'
|
||||
export const FLANDERS_WORKSPACE_PROJECT_NAME = 'Flanders Regional Workbench'
|
||||
export const FLANDERS_WORKSPACE_LABEL = 'Vlaanderen (285 gemeenten)'
|
||||
export const PRIMARY_FOCUS_CENTER: [number, number] = [5.1167, 51.1919]
|
||||
export const PRIMARY_FOCUS_AREA_NAME = 'Mol primary AOI'
|
||||
export const PRIMARY_FOCUS_MUNICIPALITY_PROJECT_NAME = 'Mol Municipality Workbench'
|
||||
|
||||
Reference in New Issue
Block a user