fix: localize primary map delivery status
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
VECTOR_VIEWPORT_MIN_ZOOM,
|
||||
} from '../config/vectorDelivery'
|
||||
import { formatError } from '../lib/formatError'
|
||||
import { getDatasetDisplayName } from '../lib/datasetDisplay'
|
||||
import { datasetsApi } from '../services/api/datasets'
|
||||
import type { DatasetCreateResponse, MapViewportState } from '../types'
|
||||
|
||||
@@ -38,7 +39,7 @@ export function useViewportVectorLayer({
|
||||
)
|
||||
const zoom = viewport?.zoom ?? null
|
||||
const zoomRequired = enabled && (zoom === null || zoom < VECTOR_VIEWPORT_MIN_ZOOM)
|
||||
const layerLabel = selectedDataset?.reference_layer_name?.trim() || 'features'
|
||||
const layerLabel = selectedDataset ? getDatasetDisplayName(selectedDataset) : 'de kaartlaag'
|
||||
|
||||
useEffect(() => {
|
||||
requestSequence.current += 1
|
||||
@@ -86,7 +87,7 @@ export function useViewportVectorLayer({
|
||||
setData(null)
|
||||
setLoadedFeatureCount(0)
|
||||
setTruncated(false)
|
||||
setError(formatError(requestError, 'Unable to load visible vector features'))
|
||||
setError(formatError(requestError, 'De zichtbare kaartobjecten konden niet worden geladen'))
|
||||
} finally {
|
||||
if (requestSequence.current === sequence) {
|
||||
setLoading(false)
|
||||
@@ -104,18 +105,18 @@ export function useViewportVectorLayer({
|
||||
return null
|
||||
}
|
||||
if (zoomRequired) {
|
||||
return `Zoom in to level ${VECTOR_VIEWPORT_MIN_ZOOM} to load ${layerLabel} from PostGIS.`
|
||||
return `Zoom verder in (tot niveau ${VECTOR_VIEWPORT_MIN_ZOOM}) om ${layerLabel} op de kaart te tonen.`
|
||||
}
|
||||
if (loading) {
|
||||
return 'Loading visible features from PostGIS...'
|
||||
return 'Zichtbare kaartobjecten laden...'
|
||||
}
|
||||
if (error) {
|
||||
return error
|
||||
}
|
||||
if (truncated) {
|
||||
return `${loadedFeatureCount.toLocaleString()} visible features loaded; zoom in further because this view exceeds the ${VECTOR_VIEWPORT_FEATURE_LIMIT.toLocaleString()} feature limit.`
|
||||
return `${loadedFeatureCount.toLocaleString('nl-BE')} kaartobjecten getoond. Zoom verder in om meer detail te zien.`
|
||||
}
|
||||
return `${loadedFeatureCount.toLocaleString()} visible of ${(featureCount ?? 0).toLocaleString()} total features loaded from PostGIS.`
|
||||
return `${loadedFeatureCount.toLocaleString('nl-BE')} van ${(featureCount ?? 0).toLocaleString('nl-BE')} kaartobjecten zichtbaar.`
|
||||
}, [enabled, error, featureCount, layerLabel, loadedFeatureCount, loading, truncated, zoomRequired])
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user