diff --git a/client/src/components/panels/contextual-layers/index.tsx b/client/src/components/panels/contextual-layers/index.tsx
index 4108506..b13d705 100644
--- a/client/src/components/panels/contextual-layers/index.tsx
+++ b/client/src/components/panels/contextual-layers/index.tsx
@@ -9,7 +9,7 @@ import XMarkIcon from "@/svgs/xmark.svg";
import Item from "./item";
const ContextualLayersPanel = () => {
- const { data, isLoading } = useDatasetsBySubTopic("contextual");
+ const { data, isLoading } = useDatasetsBySubTopic("contextual", ["layer", "download_link"]);
return (
<>
@@ -71,6 +71,7 @@ const ContextualLayersPanel = () => {
// Assuming the dataset has just one layer, which is currently the case
id: dataset.layers[0].id!,
name: dataset.layers[0].attributes!.name!,
+ downloadLink: dataset.layers[0].attributes!.download_link,
}))}
/>
))}
diff --git a/client/src/components/panels/contextual-layers/item.tsx b/client/src/components/panels/contextual-layers/item.tsx
index 94090a7..f90cd25 100644
--- a/client/src/components/panels/contextual-layers/item.tsx
+++ b/client/src/components/panels/contextual-layers/item.tsx
@@ -1,11 +1,16 @@
+import Link from "next/link";
+
+import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import useMapLayers from "@/hooks/use-map-layers";
+import { cn } from "@/lib/utils";
+import DownloadIcon from "@/svgs/download.svg";
import { Dataset, Layer } from "@/types/generated/strapi.schemas";
interface ItemProps {
name: Dataset["name"];
- layers: { id: number; name: Layer["name"] }[];
+ layers: { id: number; name: Layer["name"]; downloadLink?: Layer["download_link"] }[];
}
const Item = ({ name, layers }: ItemProps) => {
@@ -20,7 +25,30 @@ const Item = ({ name, layers }: ItemProps) => {
-
+
+
id === layer.id) !== -1}
diff --git a/client/src/svgs/download.svg b/client/src/svgs/download.svg
new file mode 100644
index 0000000..680f4ef
--- /dev/null
+++ b/client/src/svgs/download.svg
@@ -0,0 +1,4 @@
+
diff --git a/client/src/types/generated/strapi.schemas.ts b/client/src/types/generated/strapi.schemas.ts
index 4dd972c..e49b888 100644
--- a/client/src/types/generated/strapi.schemas.ts
+++ b/client/src/types/generated/strapi.schemas.ts
@@ -1053,6 +1053,7 @@ export interface Layer {
createdAt?: string;
createdBy?: LayerCreatedBy;
dataset?: LayerDataset;
+ download_link?: string;
legend_config: LegendLegendConfigComponent;
mapbox_config: unknown;
name: string;
@@ -1206,6 +1207,7 @@ export type LayerDatasetDataAttributesLayersDataItemAttributes = {
createdAt?: string;
createdBy?: LayerDatasetDataAttributesLayersDataItemAttributesCreatedBy;
dataset?: LayerDatasetDataAttributesLayersDataItemAttributesDataset;
+ download_link?: string;
legend_config?: LayerDatasetDataAttributesLayersDataItemAttributesLegendConfig;
mapbox_config?: unknown;
name?: string;
@@ -1476,6 +1478,7 @@ export type LayerRequestDataDataset = number | string;
export type LayerRequestData = {
dataset?: LayerRequestDataDataset;
+ download_link?: string;
legend_config: LegendLegendConfigComponent;
mapbox_config: unknown;
name: string;
@@ -1552,6 +1555,7 @@ export type DatasetLayersDataItemAttributes = {
createdAt?: string;
createdBy?: DatasetLayersDataItemAttributesCreatedBy;
dataset?: DatasetLayersDataItemAttributesDataset;
+ download_link?: string;
legend_config?: DatasetLayersDataItemAttributesLegendConfig;
mapbox_config?: unknown;
name?: string;
diff --git a/cms/config/sync/admin-role.strapi-super-admin.json b/cms/config/sync/admin-role.strapi-super-admin.json
index 8c6e5a4..baad72d 100644
--- a/cms/config/sync/admin-role.strapi-super-admin.json
+++ b/cms/config/sync/admin-role.strapi-super-admin.json
@@ -70,7 +70,8 @@
"legend_config.items.value",
"legend_config.items.pattern",
"legend_config.unit",
- "dataset"
+ "dataset",
+ "download_link"
]
},
"conditions": []
@@ -97,7 +98,8 @@
"legend_config.items.value",
"legend_config.items.pattern",
"legend_config.unit",
- "dataset"
+ "dataset",
+ "download_link"
]
},
"conditions": []
@@ -117,7 +119,8 @@
"legend_config.items.value",
"legend_config.items.pattern",
"legend_config.unit",
- "dataset"
+ "dataset",
+ "download_link"
]
},
"conditions": []
diff --git a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##layer.layer.json b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##layer.layer.json
index 92e78eb..545c7b2 100644
--- a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##layer.layer.json
+++ b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##layer.layer.json
@@ -104,6 +104,20 @@
"sortable": true
}
},
+ "download_link": {
+ "edit": {
+ "label": "download_link",
+ "description": "",
+ "placeholder": "",
+ "visible": true,
+ "editable": true
+ },
+ "list": {
+ "label": "download_link",
+ "searchable": true,
+ "sortable": true
+ }
+ },
"createdAt": {
"edit": {
"label": "createdAt",
@@ -164,6 +178,12 @@
}
},
"layouts": {
+ "list": [
+ "id",
+ "dataset",
+ "type",
+ "name"
+ ],
"edit": [
[
{
@@ -198,13 +218,13 @@
"name": "legend_config",
"size": 12
}
+ ],
+ [
+ {
+ "name": "download_link",
+ "size": 6
+ }
]
- ],
- "list": [
- "id",
- "dataset",
- "type",
- "name"
]
},
"uid": "api::layer.layer"
diff --git a/cms/src/api/layer/content-types/layer/schema.json b/cms/src/api/layer/content-types/layer/schema.json
index 41ba907..8fe1508 100644
--- a/cms/src/api/layer/content-types/layer/schema.json
+++ b/cms/src/api/layer/content-types/layer/schema.json
@@ -42,6 +42,10 @@
"type": "relation",
"relation": "oneToOne",
"target": "api::dataset.dataset"
+ },
+ "download_link": {
+ "type": "string",
+ "regex": "^(https?:\\/\\/)?(www\\.)?[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)+((\\/[\\w\\-\\._~:\\/\\?#\\[\\]@!$&'\\(\\)\\*+,;=]*)*)$"
}
}
}
diff --git a/cms/src/extensions/documentation/documentation/1.0.0/full_documentation.json b/cms/src/extensions/documentation/documentation/1.0.0/full_documentation.json
index 3cbe46d..e53f428 100644
--- a/cms/src/extensions/documentation/documentation/1.0.0/full_documentation.json
+++ b/cms/src/extensions/documentation/documentation/1.0.0/full_documentation.json
@@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
- "x-generation-date": "2024-11-05T12:51:46.101Z"
+ "x-generation-date": "2024-11-08T08:14:51.291Z"
},
"x-strapi-config": {
"path": "/documentation",
@@ -753,6 +753,9 @@
}
}
},
+ "download_link": {
+ "type": "string"
+ },
"createdAt": {
"type": "string",
"format": "date-time"
@@ -960,6 +963,9 @@
}
],
"example": "string or id"
+ },
+ "download_link": {
+ "type": "string"
}
}
}
@@ -1133,6 +1139,9 @@
}
}
},
+ "download_link": {
+ "type": "string"
+ },
"createdAt": {
"type": "string",
"format": "date-time"
@@ -1628,6 +1637,9 @@
}
}
},
+ "download_link": {
+ "type": "string"
+ },
"createdAt": {
"type": "string",
"format": "date-time"
diff --git a/cms/types/generated/contentTypes.d.ts b/cms/types/generated/contentTypes.d.ts
index daea56b..37e6618 100644
--- a/cms/types/generated/contentTypes.d.ts
+++ b/cms/types/generated/contentTypes.d.ts
@@ -861,6 +861,7 @@ export interface ApiLayerLayer extends Schema.CollectionType {
'oneToOne',
'api::dataset.dataset'
>;
+ download_link: Attribute.String;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
createdBy: Attribute.Relation<