From a529e85b73e8db0bdf7d03ded32f509e323f2e41 Mon Sep 17 00:00:00 2001 From: Dean Jones Date: Fri, 19 Nov 2021 12:26:57 -0800 Subject: [PATCH] Add dashboard tab for Admin/basic query for mentors/mentees --- src/components/icons/Database.svg | 6 ++ src/components/icons/index.ts | 1 + src/layouts/TabLayout/AdminTabLayout.tsx | 6 ++ .../[slug]/[profileRoute]/dashboard.tsx | 69 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100755 src/components/icons/Database.svg create mode 100644 src/pages/program/[slug]/[profileRoute]/dashboard.tsx diff --git a/src/components/icons/Database.svg b/src/components/icons/Database.svg new file mode 100755 index 00000000..64219898 --- /dev/null +++ b/src/components/icons/Database.svg @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/components/icons/index.ts b/src/components/icons/index.ts index a84306a7..03d3710d 100644 --- a/src/components/icons/index.ts +++ b/src/components/icons/index.ts @@ -4,6 +4,7 @@ export { default as CircledCheck } from "./CircledCheck.svg"; export { default as CircledCheckSolid } from "./CircledCheckSolid.svg"; export { default as CircledCross } from "./CircledCross.svg"; export { default as Clipboard } from "./Clipboard.svg"; +export { default as Database } from "./Database.svg"; export { default as Edit } from "./Edit.svg"; export { default as Filter } from "./Filter.svg"; export { default as Home } from "./Home.svg"; diff --git a/src/layouts/TabLayout/AdminTabLayout.tsx b/src/layouts/TabLayout/AdminTabLayout.tsx index f84de9f6..afea3bc8 100644 --- a/src/layouts/TabLayout/AdminTabLayout.tsx +++ b/src/layouts/TabLayout/AdminTabLayout.tsx @@ -2,6 +2,7 @@ import { Clipboard, Edit, Home, + Database, Settings, User, Users, @@ -17,6 +18,11 @@ const AdminTabLayout: React.FC = ({ return ( + { + const { currentProgram } = useCurrentProgram(); + const { programId } = currentProgram || { + programId: "" + }; + + const mentors = useGetProfilesQuery({ + variables: { + programId: programId, + profileType: ProfileType.Mentor, + }, + }); + + const mentees = useGetProfilesQuery({ + variables: { + programId: programId, + profileType: ProfileType.Mentee, + }, + }); + + if (!currentProgram || mentors.error || mentees.error) return ; + + return ( + + + Dashboard + +
+ +
+ + Mentors (#): + + + {mentors.data?.getProfiles.length} + + + Mentees (#): + + + {mentees.data?.getProfiles.length} + +
+
+
+ ); +}; + +DashboardPage.getLayout = (page, pageProps) => ( + + + {page} + + +); + +export default DashboardPage;