diff --git a/client/src/containers/map/legend/legend-item/index.tsx b/client/src/containers/map/legend/legend-item/index.tsx
index 5de80316..fd15a498 100644
--- a/client/src/containers/map/legend/legend-item/index.tsx
+++ b/client/src/containers/map/legend/legend-item/index.tsx
@@ -2,6 +2,7 @@
import { useGetLayersId } from '@/types/generated/layer';
import type { LayerSettings } from '@/types/layers';
+import type { Legend } from '@/types/map';
import BasicLegendItem from './basic';
import ChoroplethLegendItem from './choropleth';
@@ -15,18 +16,22 @@ const MapLegendItem = ({ settings }: { settings: LayerSettings }) => {
if (!data?.data?.attributes) return null;
const { legend_config, name } = data.data.attributes;
- const { type, items } = legend_config;
+ const { type } = legend_config as Legend;
return (
- {type === 'gradient' && }
+ {type === 'gradient' && (
+
+ )}
{type === 'choropleth' && (
-
+
+ )}
+ {type === 'basic' && (
+
)}
- {type === 'basic' && }
);
};
diff --git a/client/src/types/generated/strapi.schemas.ts b/client/src/types/generated/strapi.schemas.ts
index abe9b631..8e4ae769 100644
--- a/client/src/types/generated/strapi.schemas.ts
+++ b/client/src/types/generated/strapi.schemas.ts
@@ -1478,15 +1478,29 @@ export type LayerCreatedBy = {
data?: LayerCreatedByData;
};
+export const LEGEND_TYPE = ['basic', 'choropleth', 'gradient'] as const;
+
+export type LegendType = (typeof LEGEND_TYPE)[number];
+
+export type LegendConfig = {
+ type: LegendType;
+ name?: string;
+ info?: string;
+ description?: string;
+ items: { color: string; value: string; notes?: string }[];
+ intersections?: { id: number; color: string }[];
+ notes?: string;
+};
+
export interface Layer {
name?: string;
config?: unknown;
params_config?: unknown;
decode_function?: string;
legend_config?: unknown;
- description?: string;
- info?: string;
slug?: string;
+ description?: string;
+ dialog?: string;
createdAt?: string;
updatedAt?: string;
publishedAt?: string;
@@ -1672,7 +1686,7 @@ export type LayerListResponseMeta = {
};
export interface LayerListResponseDataItem {
- id: number;
+ id?: number;
attributes?: Layer;
}
@@ -1687,9 +1701,9 @@ export type LayerRequestData = {
params_config?: unknown;
decode_function?: string;
legend_config?: unknown;
- description?: string;
- info?: unknown;
slug?: string;
+ description?: string;
+ dialog?: string;
};
export interface LayerRequest {