diff --git a/packages/plugins/packages/location-point-map/src/GCSTransformers/locationPayloadToGCS.ts b/packages/plugins/packages/location-point-map/src/GCSTransformers/locationPayloadToGCS.ts index c1a00675e..0a9b73917 100644 --- a/packages/plugins/packages/location-point-map/src/GCSTransformers/locationPayloadToGCS.ts +++ b/packages/plugins/packages/location-point-map/src/GCSTransformers/locationPayloadToGCS.ts @@ -1,17 +1,21 @@ import type { LocationWitnessPayload } from '@xyo-network/api' -import { LocationWitnessSchema } from '@xyo-network/api' import type { GeographicCoordinateSystemLocationPayload } from '@xyo-network/location-payload-plugin' import { GeographicCoordinateSystemLocationSchema } from '@xyo-network/location-payload-plugin' import type { Payload } from '@xyo-network/payload-model' import { currentLocationToGCS } from './transformers/index.ts' +const validSchemas = { + currentLocation: 'network.xyo.location.current', + gcsLocation: GeographicCoordinateSystemLocationSchema, +} + export const locationPayloadToGCS = (location: Payload) => { switch (location.schema) { - case LocationWitnessSchema: { + case validSchemas.currentLocation: { return currentLocationToGCS(location as LocationWitnessPayload) } - case GeographicCoordinateSystemLocationSchema: { + case validSchemas.gcsLocation: { return location as GeographicCoordinateSystemLocationPayload } default: { diff --git a/packages/plugins/packages/location-point-map/src/components/storyPayload.tsx b/packages/plugins/packages/location-point-map/src/components/storyPayload.tsx index 4f08cccda..6e5032fbf 100644 --- a/packages/plugins/packages/location-point-map/src/components/storyPayload.tsx +++ b/packages/plugins/packages/location-point-map/src/components/storyPayload.tsx @@ -10,7 +10,7 @@ export const gcsLocationPayload = { } export const currentLocationPayload = { - schema: 'network.xyo.location', + schema: 'network.xyo.location.current', currentLocation: { coords: { accuracy: 600, diff --git a/packages/plugins/packages/location-point-map/src/constants.ts b/packages/plugins/packages/location-point-map/src/constants.ts new file mode 100644 index 000000000..caddc73b3 --- /dev/null +++ b/packages/plugins/packages/location-point-map/src/constants.ts @@ -0,0 +1 @@ +export const CurrentLocationSchema = 'network.xyo.location.current' diff --git a/packages/plugins/packages/location-point-map/src/meta/index.ts b/packages/plugins/packages/location-point-map/src/meta/index.ts index 2de910afd..49e9631a3 100644 --- a/packages/plugins/packages/location-point-map/src/meta/index.ts +++ b/packages/plugins/packages/location-point-map/src/meta/index.ts @@ -1,11 +1,10 @@ -import { GeographicCoordinateSystemLocationSchema, LocationSchema } from '@xyo-network/location-payload-plugin' import type { Payload } from '@xyo-network/payload-model' import type { PayloadRenderPluginBase } from '@xyo-network/react-payload-plugin' -const validSchemas: Set = new Set([LocationSchema, GeographicCoordinateSystemLocationSchema]) +import { validPointMapSchemas } from './validPointMapSchemas.ts' const PointMapRenderPluginMeta: PayloadRenderPluginBase = { - canRender: (payload?: Payload) => !!(payload && validSchemas.has(payload.schema)), + canRender: (payload?: Payload) => !!(payload && validPointMapSchemas.has(payload.schema)), name: 'Point Map', } diff --git a/packages/plugins/packages/location-point-map/src/meta/validPointMapSchemas.ts b/packages/plugins/packages/location-point-map/src/meta/validPointMapSchemas.ts new file mode 100644 index 000000000..d0b287f8d --- /dev/null +++ b/packages/plugins/packages/location-point-map/src/meta/validPointMapSchemas.ts @@ -0,0 +1,3 @@ +import { CurrentLocationSchema, GeographicCoordinateSystemLocationSchema } from '@xyo-network/location-payload-plugin' + +export const validPointMapSchemas = new Set([CurrentLocationSchema, GeographicCoordinateSystemLocationSchema])