-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
34 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
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 |
---|---|---|
@@ -1,25 +1,42 @@ | ||
import React from 'react'; | ||
import React, { useEffect, useState } from 'react'; | ||
import moment from 'moment'; | ||
import { Box, Heading, Stat, StatLabel, StatNumber, StatHelpText, Text } from '@chakra-ui/react'; | ||
import DashboardLayout from './layout'; | ||
import { getDeveloper } from '../APIs/DevelopersAPI'; | ||
import { Developer } from '../../types'; | ||
import { auth } from '../../services/firebase'; | ||
|
||
const Dashboard = () => ( | ||
<DashboardLayout> | ||
<Box mb={4}> | ||
<Heading as="h1">Home</Heading> | ||
<Text fontSize="sm" color="gray.700" letterSpacing="0"> | ||
Your usage across all IgboAPI services. | ||
</Text> | ||
</Box> | ||
<Stat borderColor="gray.200" borderWidth="1px" borderRadius="md" p={4} maxWidth="400px"> | ||
<Box className="flex flex-row justify-between items-center"> | ||
<StatLabel>Daily IgboAPI Usage</StatLabel> | ||
<StatLabel>Daily limit: 500</StatLabel> | ||
</Box> | ||
<StatNumber>54</StatNumber> | ||
<StatHelpText>{moment().format('MMMM DD, YYYY')}</StatHelpText> | ||
</Stat> | ||
</DashboardLayout> | ||
); | ||
const Dashboard = () => { | ||
const [developer, setDeveloper] = useState<Developer>(); | ||
|
||
useEffect(() => { | ||
(async () => { | ||
if (auth.currentUser) { | ||
const fetchedDeveloper = await getDeveloper(auth.currentUser.uid); | ||
setDeveloper(fetchedDeveloper); | ||
} | ||
})(); | ||
}, []); | ||
return ( | ||
<DashboardLayout> | ||
<Box mb={4}> | ||
<Heading as="h1">Home</Heading> | ||
<Text fontSize="sm" color="gray.700" letterSpacing="0"> | ||
Your usage across all IgboAPI services. | ||
</Text> | ||
</Box> | ||
<Stat borderColor="gray.200" borderWidth="1px" borderRadius="md" p={4} maxWidth="400px"> | ||
<> | ||
<Box className="flex flex-row justify-between items-center"> | ||
<StatLabel>Daily IgboAPI Usage</StatLabel> | ||
<StatLabel>Daily limit: 500</StatLabel> | ||
</Box> | ||
<StatNumber>54</StatNumber> | ||
<StatHelpText>{moment().format('MMMM DD, YYYY')}</StatHelpText> | ||
{console.log(developer)} | ||
</> | ||
</Stat> | ||
</DashboardLayout> | ||
); | ||
}; | ||
export default Dashboard; |
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,2 @@ | ||
export default () => | ||
typeof window !== 'undefined' ? window?.location?.host === 'igboapi.com' : false; |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import chalk from 'chalk'; | ||
|
||
console.green = (...args) => console.log(chalk.green(...args)); | ||
console.blue = (...args) => console.log(chalk.blue(...args)); | ||
console.red = (...args) => console.log(chalk.red(...args)); | ||
console.green = (...args) => console.log(chalk.green(...args)); // eslint-disable-line | ||
console.blue = (...args) => console.log(chalk.blue(...args)); // eslint-disable-line | ||
console.red = (...args) => console.log(chalk.red(...args)); // eslint-disable-line |