diff --git a/src/components/SampleTableDashboard.tsx b/src/components/SampleTableDashboard.tsx deleted file mode 100644 index d61b2ac..0000000 --- a/src/components/SampleTableDashboard.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Table, Thead, Tbody, Tr, Th, TableContainer } from '@chakra-ui/react' -import React from 'react' -import sampleUserData from '../sample_data.json' - -function SampleTableDashboard (): JSX.Element { - const [sampleData] = React.useState(sampleUserData) - - return ( - - - - - - - - - - - - {sampleData && Object.values(sampleData.Users) - .sort((a, b) => { - return a.Displayname.localeCompare(b.Displayname) - }).filter((user) => !user.Disabled) - .map(({ Displayname, Email, Disabled }) => - - - - - - - )} - -
NameEmailTitleStatus
{Displayname}{Email}{Disabled ? 'Inactive' : 'Active'}
-
- ) -} - -export default SampleTableDashboard diff --git a/src/components/TableDashboard.tsx b/src/components/TableDashboard.tsx index 2897afa..c782a90 100644 --- a/src/components/TableDashboard.tsx +++ b/src/components/TableDashboard.tsx @@ -1,54 +1,36 @@ -import { - Table, - Thead, - Tr, - Th, - TableContainer, - Td, - Tbody -} from '@chakra-ui/react' -import { getAllUsers } from '../api/lib/users' -import { useEffect, useState } from 'react' -import { type User } from '../types' +import { Table, Thead, Tbody, Tr, Th, TableContainer } from '@chakra-ui/react' +import React from 'react' +import sampleUserData from '../sample_data.json' function TableDashboard (): JSX.Element { - const [users, setUsers] = useState([]) - useEffect(() => { - const fetchUsers = async (): Promise => { - try { - const response = await getAllUsers() - if (response.data) { - setUsers(response.data as User[]) - } - } catch (error) { - console.error('Error fetching users: ', error) - } - } - void fetchUsers() - }, []) + const [sampleData] = React.useState(sampleUserData) return ( - - - - - - - - - - - {users.map((user, index) => ( - - - - - - - ))} - -
NameEmailTitleStatus
{user.displayName}{user.email}{user.role}{user.enabled}
+ + + + + + + + + + + {sampleData && Object.values(sampleData.Users) + .sort((a, b) => { + return a.Displayname.localeCompare(b.Displayname) + }).filter((user) => !user.Disabled) + .map(({ Displayname, Email, Disabled }) => + + + + + + + )} + +
NameEmailTitleStatus
{Displayname}{Email}{Disabled ? 'Inactive' : 'Active'}
) } diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index b404dc1..ed57d22 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,14 +1,12 @@ import { Container, HStack } from '@chakra-ui/react' import TableDashboard from '../components/TableDashboard' import Sidebar from '../components/Sidebar' -import SampleTableDashboard from '../components/SampleTableDashboard' function HomePage (): JSX.Element { return ( -