From 45f9cd29f0aa3c033671d75eba6c15d3be543290 Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 21 Oct 2024 13:33:26 +0200 Subject: [PATCH] Dashboard: Add list to all projects for admins --- .../_components/AdminProjectsList.tsx | 28 +++++++++++++++++++ src/app/(loggedInGeneral)/dashboard/page.tsx | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/app/(loggedInGeneral)/dashboard/_components/AdminProjectsList.tsx diff --git a/src/app/(loggedInGeneral)/dashboard/_components/AdminProjectsList.tsx b/src/app/(loggedInGeneral)/dashboard/_components/AdminProjectsList.tsx new file mode 100644 index 00000000..e925384e --- /dev/null +++ b/src/app/(loggedInGeneral)/dashboard/_components/AdminProjectsList.tsx @@ -0,0 +1,28 @@ +"use client" +import { SuperAdminBox } from "@/src/core/components/AdminBox" +import { Link } from "@/src/core/components/links/Link" +import { shortTitle } from "@/src/core/components/text" +import { isAdmin } from "@/src/pagesComponents/users/utils/isAdmin" +import getProjects from "@/src/server/projects/queries/getProjects" +import { useCurrentUser } from "@/src/server/users/hooks/useCurrentUser" +import { useQuery } from "@blitzjs/rpc" + +export const AdminProjectsList = () => { + const user = useCurrentUser() + const [projects] = useQuery(getProjects, {}, { enabled: isAdmin(user) }) + + return ( + +

Alle Projekte

+ +
+ ) +} diff --git a/src/app/(loggedInGeneral)/dashboard/page.tsx b/src/app/(loggedInGeneral)/dashboard/page.tsx index c10cc487..1f8af715 100644 --- a/src/app/(loggedInGeneral)/dashboard/page.tsx +++ b/src/app/(loggedInGeneral)/dashboard/page.tsx @@ -4,6 +4,7 @@ import { PageHeader } from "@/src/core/components/pages/PageHeader" import getProjectsWithGeometryWithMembershipRole from "@/src/server/projects/queries/getProjectsWithGeometryWithMembershipRole" import { Metadata } from "next" import "server-only" +import { AdminProjectsList } from "./_components/AdminProjectsList" import { NoProjectMembershipsYet } from "./_components/NoProjectMembershipsYet" import { ProjectsMap } from "./_components/ProjectsMap" import { ProjectsTable } from "./_components/ProjectsTable" @@ -29,6 +30,7 @@ export default async function DashboardPage() { /> + )