diff --git a/apps/web/app/[lng]/(dashboard)/home/page.tsx b/apps/web/app/[lng]/(dashboard)/home/page.tsx index c98c45d4..6a374b2a 100644 --- a/apps/web/app/[lng]/(dashboard)/home/page.tsx +++ b/apps/web/app/[lng]/(dashboard)/home/page.tsx @@ -12,6 +12,7 @@ import { useProjects } from "@/lib/api/projects"; import type { PaginatedQueryParams } from "@/lib/validations/common"; import type { Layer } from "@/lib/validations/layer"; +import { useAuthZ } from "@/hooks/auth/AuthZ"; import { useJobStatus } from "@/hooks/jobs/JobStatus"; import BlogSection from "@/components/dashboard/home/BlogSection"; @@ -44,6 +45,8 @@ const Home = () => { useJobStatus(mutate); + const { isOrgEditor } = useAuthZ(); + return ( @@ -67,9 +70,17 @@ const Home = () => { - + - + diff --git a/apps/web/components/dashboard/home/DataSection.tsx b/apps/web/components/dashboard/home/DataSection.tsx index 6750084b..18442818 100644 --- a/apps/web/components/dashboard/home/DataSection.tsx +++ b/apps/web/components/dashboard/home/DataSection.tsx @@ -20,6 +20,7 @@ import DatasetUploadModal from "@/components/modals/DatasetUpload"; interface DataSectionProps { layers: Layer[]; isLoading: boolean; + hideCreate?: boolean; } const DataSection = (props: DataSectionProps) => { @@ -65,7 +66,7 @@ const DataSection = (props: DataSectionProps) => { - {(isLoading ? Array.from(new Array(4)) : layers ?? []).map((item: Layer, index: number) => ( + {(isLoading ? Array.from(new Array(4)) : (layers ?? [])).map((item: Layer, index: number) => ( { {isLoading ? ( ) : ( - setOpenDatasetUploadModal(true)} - tooltip={t("create_new_dataset")} - backgroundImage="https://assets.plan4better.de/img/grid_thumbnail.png" - /> + !props.hideCreate && ( + setOpenDatasetUploadModal(true)} + tooltip={t("create_new_dataset")} + backgroundImage="https://assets.plan4better.de/img/grid_thumbnail.png" + /> + ) )} diff --git a/apps/web/components/dashboard/home/ProjectSection.tsx b/apps/web/components/dashboard/home/ProjectSection.tsx index f17532a1..26c6e3a8 100644 --- a/apps/web/components/dashboard/home/ProjectSection.tsx +++ b/apps/web/components/dashboard/home/ProjectSection.tsx @@ -18,6 +18,7 @@ import ProjectModal from "@/components/modals/Project"; interface ProjectSectionProps { projects: Project[]; isLoading: boolean; + hideCreate?: boolean; } const ProjectSection = (props: ProjectSectionProps) => { @@ -43,7 +44,7 @@ const ProjectSection = (props: ProjectSectionProps) => { )} - {(isLoading ? Array.from(new Array(3)) : projects ?? []).map((item: Project, index: number) => ( + {(isLoading ? Array.from(new Array(3)) : (projects ?? [])).map((item: Project, index: number) => ( { {isLoading ? ( ) : ( - { - setOpenProjectModal(true); - }} - tooltip={t("create_new_project")} - backgroundImage="https://assets.plan4better.de/img/goat_new_project_artwork.png" - /> + !props.hideCreate && ( + { + setOpenProjectModal(true); + }} + tooltip={t("create_new_project")} + backgroundImage="https://assets.plan4better.de/img/goat_new_project_artwork.png" + /> + ) )}