diff --git a/apps/web/components/dashboard/home/BlogSection.tsx b/apps/web/components/dashboard/home/BlogSection.tsx index 6dabed10..bbd6eb2e 100644 --- a/apps/web/components/dashboard/home/BlogSection.tsx +++ b/apps/web/components/dashboard/home/BlogSection.tsx @@ -35,7 +35,7 @@ const blogPosts: BlogPost[] = [ url: "https://plan4better.de/en/posts/2023-08-01-parking/", }, { - title: "GOAT as a cross-stakeholder planning platform in the MRN", + title: "Green Spaces in Urban Areas: The Key to Resilient Cities", date: "May 30, 2023", thumbnail: "https://plan4better.de/images/blog/green-spaces-resilient-cities/thumbnail.webp", diff --git a/apps/web/components/dashboard/home/SectionCard.tsx b/apps/web/components/dashboard/home/SectionCard.tsx index 8d48f63d..ae9b9015 100644 --- a/apps/web/components/dashboard/home/SectionCard.tsx +++ b/apps/web/components/dashboard/home/SectionCard.tsx @@ -60,6 +60,11 @@ const SectionCard = (props: SectionCard) => { setIsDeleteDialogOpen(false)} + onDelete={() => { + setIsDeleteDialogOpen(false); + setActiveContent(null); + // show success toast + }} activeContent={activeContent} /> = ({ onDelete, activeContent, }) => { - const handleDelete = () => { + const handleDelete = async () => { + try { + if (!activeContent) return; + if (activeContent.type === "layer") { + await deleteLayer(activeContent?.id); + mutate((key) => Array.isArray(key) && key[0] === LAYERS_API_BASE_URL); + } else if (activeContent.type === "project") { + await deleteProject(activeContent?.id); + mutate((key) => Array.isArray(key) && key[0] === PROJECTS_API_BASE_URL); + } + toast.success(`${activeContent?.type} deleted successfully`); + } catch { + toast.error(`Error deleting ${activeContent?.type}`); + } + if (onDelete) onDelete(); }; @@ -43,10 +61,7 @@ const DeleteContentModal: React.FC = ({ pb: 2, }} > -