diff --git a/src/components/elements/MapSidePanel/MapSidePanel.stories.tsx b/src/components/elements/MapSidePanel/MapSidePanel.stories.tsx index 88bdec011..3ca39db2e 100644 --- a/src/components/elements/MapSidePanel/MapSidePanel.stories.tsx +++ b/src/components/elements/MapSidePanel/MapSidePanel.stories.tsx @@ -25,8 +25,7 @@ export const Default: Story = { ); }, args: { - title: "Project Sites", - onSelectItem: console.log + title: "Project Sites" } }; diff --git a/src/components/elements/MapSidePanel/MapSidePanel.tsx b/src/components/elements/MapSidePanel/MapSidePanel.tsx index 879f07e64..163713de5 100644 --- a/src/components/elements/MapSidePanel/MapSidePanel.tsx +++ b/src/components/elements/MapSidePanel/MapSidePanel.tsx @@ -18,7 +18,6 @@ import { MENU_PLACEMENT_BOTTOM_BOTTOM } from "../Menu/MenuVariant"; export interface MapSidePanelProps extends DetailedHTMLProps, HTMLDivElement> { title: string; items: MapSidePanelItemProps[]; - onSelectItem: (item: MapSidePanelItemProps) => void; onSearch?: (query: string) => void; onLoadMore?: () => void; emptyText?: string; @@ -32,7 +31,6 @@ const MapSidePanel = ({ title, items, className, - onSelectItem, onSearch, onLoadMore, emptyText, @@ -192,7 +190,6 @@ const MapSidePanel = ({ status={item.status} onClick={() => { setSelected(item); - onSelectItem(item); }} setClickedButton={setClickedButton} isSelected={selected?.uuid === item.uuid} diff --git a/src/components/elements/TooltipMap/TooltipMap.tsx b/src/components/elements/TooltipMap/TooltipMap.tsx index 2c8500dd3..4c9d7809d 100644 --- a/src/components/elements/TooltipMap/TooltipMap.tsx +++ b/src/components/elements/TooltipMap/TooltipMap.tsx @@ -124,16 +124,6 @@ const TooltipMap = (props: TooltipMapProps) => { )} - {type === "goTo" && ( -
- -
- )} ); }; diff --git a/src/components/extensive/EntityMapAndGalleryCard/EntityMapAndGalleryCard.tsx b/src/components/extensive/EntityMapAndGalleryCard/EntityMapAndGalleryCard.tsx index 43e7c6c1e..f0345ac40 100644 --- a/src/components/extensive/EntityMapAndGalleryCard/EntityMapAndGalleryCard.tsx +++ b/src/components/extensive/EntityMapAndGalleryCard/EntityMapAndGalleryCard.tsx @@ -1,14 +1,23 @@ import { useT } from "@transifex/react"; +import { useRouter } from "next/router"; import { useMemo, useState } from "react"; import { Else, If, Then } from "react-if"; import EmptyState from "@/components/elements/EmptyState/EmptyState"; import ImageGallery from "@/components/elements/ImageGallery/ImageGallery"; -import Map from "@/components/elements/Map-mapbox/Map"; +import { BBox } from "@/components/elements/Map-mapbox/GeoJSON"; +import { useMap } from "@/components/elements/Map-mapbox/hooks/useMap"; +import { MapContainer } from "@/components/elements/Map-mapbox/Map"; +import { mapPolygonData } from "@/components/elements/Map-mapbox/utils"; import { IconNames } from "@/components/extensive/Icon/Icon"; import PageCard from "@/components/extensive/PageElements/Card/PageCard"; import { getEntitiesOptions } from "@/constants/options/entities"; -import { useDeleteV2FilesUUID, useGetV2MODELUUIDFiles } from "@/generated/apiComponents"; +import { + GetV2TypeEntityResponse, + useDeleteV2FilesUUID, + useGetV2MODELUUIDFiles, + useGetV2TypeEntity +} from "@/generated/apiComponents"; import { useGetReadableEntityName } from "@/hooks/entity/useGetReadableEntityName"; import { useDate } from "@/hooks/useDate"; import { useGetImagesGeoJSON } from "@/hooks/useImageGeoJSON"; @@ -34,7 +43,10 @@ const EntityMapAndGalleryCard = ({ const { format } = useDate(); const [pagination, setPagination] = useState({ page: 1, pageSize: 10 }); const [filter, setFilter] = useState<{ key: string; value: string }>(); + const mapFunctions = useMap(); const { getReadableEntityName } = useGetReadableEntityName(); + const router = useRouter(); + const projectUUID = router.query.uuid as string; const queryParams: any = { page: pagination.page, per_page: pagination.pageSize, @@ -44,6 +56,17 @@ const EntityMapAndGalleryCard = ({ queryParams[filter?.key] = filter?.value; } + const { data: sitePolygonData } = useGetV2TypeEntity({ + queryParams: { + uuid: projectUUID, + type: modelName + } + }); + + const mapBbox = sitePolygonData?.bbox as BBox; + + const polygonDataMap = mapPolygonData(sitePolygonData?.polygonsData); + const { data, refetch } = useGetV2MODELUUIDFiles({ // Currently only projects, sites, nurseries, projectReports, nurseryReports and siteReports are set up pathParams: { model: modelName, uuid: modelUUID }, @@ -90,11 +113,18 @@ const EntityMapAndGalleryCard = ({ return ( <> - deleteFile({ pathParams: { uuid } })} + mapFunctions={mapFunctions} + showLegend + hasControls + showPopups /> { const t = useT(); const { format } = useDate(); - const [setSelected] = useState(); const [polygonsData, setPolygonsData] = useState([]); const [polygonDataMap, setPolygonDataMap] = useState({}); const [projectBbox, setProjectBbox] = useState(); @@ -88,7 +87,6 @@ const ProjectArea = ({ project }: ProjectAreaProps) => { })) || []) as any[] } mapFunctions={mapFunctions} - onSelectItem={setSelected} className="absolute z-20 h-[500px] w-[23vw] bg-[#ffffff12] p-8" emptyText={t("No polygons are available.")} checkedValues={checkedValues} diff --git a/src/pages/project/[uuid]/tabs/Overview.tsx b/src/pages/project/[uuid]/tabs/Overview.tsx index 40556f5f4..8f92105ff 100644 --- a/src/pages/project/[uuid]/tabs/Overview.tsx +++ b/src/pages/project/[uuid]/tabs/Overview.tsx @@ -5,20 +5,16 @@ import { Else, If, Then } from "react-if"; import Button from "@/components/elements/Button/Button"; import GoalProgressCard from "@/components/elements/Cards/GoalProgressCard/GoalProgressCard"; -import LongTextField from "@/components/elements/Field/LongTextField"; -import SelectImageListField from "@/components/elements/Field/SelectImageListField"; -import TextField from "@/components/elements/Field/TextField"; +import ItemMonitoringCards from "@/components/elements/Cards/ItemMonitoringCard/ItemMonitoringCards"; +import Dropdown from "@/components/elements/Inputs/Dropdown/Dropdown"; +import Text from "@/components/elements/Text/Text"; import { IconNames } from "@/components/extensive/Icon/Icon"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; import PageCard from "@/components/extensive/PageElements/Card/PageCard"; import PageColumn from "@/components/extensive/PageElements/Column/PageColumn"; import PageRow from "@/components/extensive/PageElements/Row/PageRow"; -import { getCountriesOptions } from "@/constants/options/countries"; -import { useDate } from "@/hooks/useDate"; import { useFramework } from "@/hooks/useFramework"; -import { useGetOptions } from "@/hooks/useGetOptions"; import ProjectArea from "@/pages/project/[uuid]/components/ProjectArea"; -import { formatOptionsList } from "@/utils/options"; interface ProjectOverviewTabProps { project: any; @@ -28,9 +24,6 @@ const ProjectOverviewTab = ({ project }: ProjectOverviewTabProps) => { const t = useT(); const router = useRouter(); const { isPPC } = useFramework(project); - const { format } = useDate(); - const landUseTypesOptions = useGetOptions(project.land_use_types); - const restorationStrategyOptions = useGetOptions(project.restoration_strategy); return ( @@ -49,81 +42,47 @@ const ProjectOverviewTab = ({ project }: ProjectOverviewTabProps) => { } > -
- - - - - - - - - - +
+
+ + + + + + + + + + +
+
+ +
- - - - - - {project.description_of_project_timeline} - - {project.history} - - - - - - - - - - - - - - - { variant="secondary" href={`/entity/sites/create/${project.framework_uuid}?parent_name=projects&parent_uuid=${project.uuid}`} > - {t("Add Site")} + {t("expand view")} } > @@ -142,6 +101,110 @@ const ProjectOverviewTab = ({ project }: ProjectOverviewTabProps) => { + + + + +
+ + {t(`Select all or specific sites to view remote sensing analytics such as tree counts, NDVI, and other + metrics useful for assessing the impact of the restoration effort.`)} + +
+ {}} + /> +
+
+ + + + + + + + + + + + +
+
+
+
+
); };