diff --git a/src/components/ProgramUsersModal.tsx b/src/components/ProgramUsersModal.tsx index 64c47b1f..dbdd1a78 100644 --- a/src/components/ProgramUsersModal.tsx +++ b/src/components/ProgramUsersModal.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { gql, useQuery } from '@apollo/client'; -import DataTable from './DataTable'; import Dialog from '@mui/material/Dialog'; import DialogContent from '@mui/material/DialogContent'; import DialogTitle from '@mui/material/DialogTitle'; import { styled } from '@mui/material/styles'; +import DataTable from './DataTable'; interface User { email: string; @@ -70,7 +70,7 @@ export function ProgramUsersModal({ isOpen, onClose, // defaultProgram = 'default', - programName + programName, }: ProgramUsersModalProps) { const { data, loading, error } = useQuery(GET_ALL_USERS, { variables: { @@ -79,10 +79,11 @@ export function ProgramUsersModal({ skip: !isOpen, }); - const programUsers = data?.getAllUsers.filter( - (user: User) => user.team?.cohort?.program?.name === programName + const programUsers = + data?.getAllUsers.filter( + (user: User) => user.team?.cohort?.program?.name === programName, // || (user.team === null && programName === defaultProgram) - ) || []; + ) || []; const columns = [ { @@ -91,7 +92,11 @@ export function ProgramUsersModal({ Cell: ({ value }: CellProps) => (
- + @@ -119,7 +124,7 @@ export function ProgramUsersModal({ if (loading) { return (
-
+
); } @@ -152,12 +157,7 @@ export function ProgramUsersModal({ }; return ( - +
{programName} - Users @@ -168,4 +168,4 @@ export function ProgramUsersModal({
); -} \ No newline at end of file +} diff --git a/src/pages/SupAdDashboard.tsx b/src/pages/SupAdDashboard.tsx index 593eb358..da84b793 100644 --- a/src/pages/SupAdDashboard.tsx +++ b/src/pages/SupAdDashboard.tsx @@ -1,26 +1,135 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { id } from 'date-fns/locale'; import Chart from '../components/Chart'; import Card from '../components/Card'; import useDocumentTitle from '../hook/useDocumentTitle'; -import Comingsoon from './Comingsoon'; function SupAdDashboard() { useDocumentTitle('Dashboard'); const { t } = useTranslation(); + const [isModalOpen, setIsModalOpen] = useState(false); + const [selectedOrg, setSelectedOrg] = useState(null); + + const organizations = [ + { + id: '1', + name: 'Andela', + totalLogins: 130, + totalUsers: 30, + activeUsers: 20, + inactiveUsers: 10, + numberOfTeams: 5, + numberOfCohorts: 5, + numberOfPrograms: 5, + }, + { + id: '2', + name: 'Acme Corp', + totalLogins: 200, + totalUsers: 50, + activeUsers: 35, + inactiveUsers: 15, + numberOfTeams: 7, + numberOfCohorts: 4, + numberOfPrograms: 8, + }, + ]; + + const openModal = (org: any) => { + setSelectedOrg(org); + setIsModalOpen(true); + }; + + const closeModal = () => { + setIsModalOpen(false); + setSelectedOrg(null); + }; + return (
- {/*
- - - - +
+ + + + +
+ + +
+ + + + + + + + + + + {organizations.map((org) => ( + + + + + + + ))} + +
+ Organization + + Total Logins + + Total Users + + Actions +
{org.name}{org.totalLogins}{org.totalUsers} + +
- */} - + {isModalOpen && selectedOrg && ( +
+
+

Andela

+

+ Total Logins: {10} +

+

+ Number of Teams: {10} +

+

+ Number of Cohorts: {10} +

+

+ Number of Programs: {10} +

+

+ Users: Active Users: {10}, Inactive Users:{' '} + {10} +

+ +
+
+ )}
diff --git a/src/pages/superAdminDashboard.tsx b/src/pages/superAdminDashboard.tsx new file mode 100644 index 00000000..e69de29b