-
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 pull request #215 from AmbireTech/admin-panel-on-steroids
Admin panel on steroids
- Loading branch information
Showing
18 changed files
with
635 additions
and
211 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
import { useMemo } from 'react' | ||
import { | ||
SimpleGrid, | ||
Box | ||
// Accordion | ||
} from '@mantine/core' | ||
import useAdmin from 'hooks/useAdmin' | ||
import { useParams } from 'react-router-dom' | ||
import { FundsActivity } from './AccountDetailsElements' | ||
import { AccountInfo } from './AccoutInfo' | ||
import { AdminDeposit } from './AdminDeposit' | ||
|
||
function AccountDetails() { | ||
const { accountId = '' } = useParams() | ||
const { accounts, initialDataLoading } = useAdmin() | ||
const accountData = useMemo(() => accounts.get(accountId), [accounts, accountId]) | ||
|
||
if (!accountData || initialDataLoading) { | ||
return <div>{`Invalid account id ${accountId}`}</div> | ||
} | ||
|
||
return ( | ||
<Box> | ||
<SimpleGrid | ||
cols={2} | ||
breakpoints={[ | ||
{ maxWidth: 'xl', cols: 2, spacing: 'md' }, | ||
{ maxWidth: 'md', cols: 1, spacing: 'md' } | ||
]} | ||
> | ||
<AccountInfo accountData={accountData} /> | ||
<AdminDeposit accountData={accountData} /> | ||
</SimpleGrid> | ||
<SimpleGrid spacing="md" mt="md"> | ||
<FundsActivity accountData={accountData} /> | ||
</SimpleGrid> | ||
</Box> | ||
) | ||
} | ||
|
||
export { AccountDetails } |
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,38 @@ | ||
import { useMemo } from 'react' | ||
import { Account } from 'types' | ||
import { Box, Text } from '@mantine/core' | ||
|
||
import CustomTable from 'components/common/CustomTable' | ||
import { parseBigNumTokenAmountToDecimal } from 'helpers/balances' | ||
|
||
export const FundsActivity = ({ accountData }: { accountData: Account }) => { | ||
const elements = useMemo(() => { | ||
const data = accountData.fundsDeposited.deposits | ||
.sort((a, b) => Number(b.created) - Number(a.created)) | ||
.map((x) => { | ||
return { | ||
id: x.created?.toString() || '', | ||
date: new Date(x.created).toLocaleDateString(), | ||
amount: parseBigNumTokenAmountToDecimal(x.amount, x.token.decimals), | ||
token: x.token.name, | ||
txHash: x.txHash | ||
} | ||
}) | ||
|
||
console.log({ data }) | ||
|
||
return data | ||
}, [accountData]) | ||
|
||
return ( | ||
<Box> | ||
<Text /> | ||
<CustomTable | ||
background | ||
headings={['Date', 'Amount', 'Token', 'Tx hash']} | ||
elements={elements} | ||
pageSize={10} | ||
/> | ||
</Box> | ||
) | ||
} |
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
Oops, something went wrong.