-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/sidebar
- Loading branch information
Showing
11 changed files
with
169 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Contributors: | ||
- Miguel Merlin | ||
- Maya Patel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
Stat, | ||
StatLabel, | ||
StatNumber, | ||
StatHelpText, | ||
StatArrow | ||
} from '@chakra-ui/react' | ||
|
||
interface MetricCardProps { | ||
label: string | ||
statistic: string | number | ||
changePercentage: string | number | ||
change: 'increase' | 'decrease' | ||
} | ||
|
||
function MetricCard ({ label, statistic, changePercentage, change }: MetricCardProps): JSX.Element { | ||
return ( | ||
<Stat> | ||
<StatLabel>{label}</StatLabel> | ||
<StatNumber>{statistic.toLocaleString()}</StatNumber> | ||
<StatHelpText> | ||
<StatArrow type={change} /> | ||
{changePercentage.toLocaleString()} | ||
</StatHelpText> | ||
</Stat> | ||
) | ||
} | ||
|
||
export default MetricCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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' | ||
|
||
function TableDashboard (): JSX.Element { | ||
const [users, setUsers] = useState<User[]>([]) | ||
useEffect(() => { | ||
const fetchUsers = async (): Promise<void> => { | ||
try { | ||
const response = await getAllUsers() | ||
if (response.data) { | ||
setUsers(response.data as User[]) | ||
} | ||
} catch (error) { | ||
console.error('Error fetching users: ', error) | ||
} | ||
} | ||
void fetchUsers() | ||
}, []) | ||
|
||
return ( | ||
<TableContainer> | ||
<Table variant='simple'> | ||
<Thead> | ||
<Tr> | ||
<Th>Name</Th> | ||
<Th>Email</Th> | ||
<Th>Title</Th> | ||
<Th>Status</Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{users.map((user, index) => ( | ||
<Tr key={index}> | ||
<Td>{user.displayName}</Td> | ||
<Td>{user.email}</Td> | ||
<Td>{user.role}</Td> | ||
<Td>{user.enabled}</Td> | ||
</Tr> | ||
))} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
) | ||
} | ||
|
||
export default TableDashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function UserCard (): JSX.Element { | ||
return ( | ||
<div> | ||
</div> | ||
) | ||
} | ||
|
||
export default UserCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Container } from '@chakra-ui/react' | ||
import TableDashboard from '../components/TableDashboard' | ||
|
||
function HomePage (): JSX.Element { | ||
return ( | ||
<div> | ||
<Container> | ||
<TableDashboard /> | ||
</Container> | ||
</div> | ||
) | ||
} | ||
|
||
export default HomePage |