refactor: remove any types and fix TypeScript errors
All checks were successful
Build Docker Image / build (push) Successful in 3m59s
All checks were successful
Build Docker Image / build (push) Successful in 3m59s
- Export InfoProductItem, InfoHubItem, InfoSupplierItem, InfoOfferItem types - Update InfoEntity interface to have explicit fields (no index signature) - Export CatalogHubItem, CatalogNearestHubItem from useCatalogHubs - Fix MapItem interfaces to accept nullable GraphQL types - Fix v-for :key bindings to handle null uuid - Add null guards in select-location pages - Update HubCard to accept nullable transportTypes - Add shims.d.ts for missing module declarations
This commit is contained in:
@@ -20,11 +20,11 @@ import { LngLatBounds } from 'mapbox-gl'
|
||||
import type { ClusterPointType } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
interface MapItem {
|
||||
uuid: string
|
||||
name: string
|
||||
latitude: number
|
||||
longitude: number
|
||||
country?: string
|
||||
uuid?: string | null
|
||||
name?: string | null
|
||||
latitude?: number | null
|
||||
longitude?: number | null
|
||||
country?: string | null
|
||||
}
|
||||
|
||||
export interface MapBounds {
|
||||
@@ -186,11 +186,13 @@ const mapOptions = computed(() => ({
|
||||
// Client-side clustering GeoJSON (when not using server clustering)
|
||||
const geoJsonData = computed(() => ({
|
||||
type: 'FeatureCollection' as const,
|
||||
features: props.items.map(item => ({
|
||||
type: 'Feature' as const,
|
||||
properties: { uuid: item.uuid, name: item.name, country: item.country },
|
||||
geometry: { type: 'Point' as const, coordinates: [item.longitude, item.latitude] }
|
||||
}))
|
||||
features: props.items
|
||||
.filter(item => item.latitude != null && item.longitude != null)
|
||||
.map(item => ({
|
||||
type: 'Feature' as const,
|
||||
properties: { uuid: item.uuid, name: item.name, country: item.country },
|
||||
geometry: { type: 'Point' as const, coordinates: [item.longitude!, item.latitude!] }
|
||||
}))
|
||||
}))
|
||||
|
||||
// Server-side clustering GeoJSON
|
||||
@@ -481,7 +483,9 @@ const initClientClusteringLayers = async (map: MapboxMapType) => {
|
||||
if (!didFitBounds.value && props.items.length > 0) {
|
||||
const bounds = new LngLatBounds()
|
||||
props.items.forEach(item => {
|
||||
bounds.extend([item.longitude, item.latitude])
|
||||
if (item.longitude != null && item.latitude != null) {
|
||||
bounds.extend([item.longitude, item.latitude])
|
||||
}
|
||||
})
|
||||
map.fitBounds(bounds, { padding: 50, maxZoom: 10 })
|
||||
didFitBounds.value = true
|
||||
|
||||
Reference in New Issue
Block a user