-
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.
- Loading branch information
Tien Nam Dao
committed
Oct 6, 2022
1 parent
93f7c17
commit 998fd67
Showing
13 changed files
with
373 additions
and
40 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
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,35 +1,46 @@ | ||
import Container from 'components/Container' | ||
import { PageTitle } from 'components/Typography/PageTitle' | ||
import RowTitle from 'components/Typography/RowTitle' | ||
import { NextPage } from 'next' | ||
// import {Pagination} from '@astraprotocol/astra-ui' | ||
import Head from 'next/head' | ||
import React from 'react' | ||
import React, { useState } from 'react' | ||
import Layout from '../components/Layout' | ||
|
||
const AccountsPage: React.FC<NextPage> = _ => { | ||
// // const t = useTranslations('Index') | ||
const AstraHolderPage: React.FC<NextPage> = _ => { | ||
const [currentPage, setPage] = useState(1) | ||
// const { tokens } = useTokens(currentPage) | ||
// console.log(tokens) | ||
|
||
return ( | ||
<Layout> | ||
<Head> | ||
<title>Astra Explorer</title> | ||
</Head> | ||
<Container>Account</Container> | ||
|
||
<Container> | ||
<PageTitle>Astra Address</PageTitle> | ||
<RowTitle | ||
columns={[ | ||
{ title: '', col: 'gutter-right' }, | ||
{ title: 'Address', col: 'padding-left-lg gutter-left col-5' }, | ||
{ title: 'Balance', col: 'padding-left-sm col-4' }, | ||
{ title: 'Transaction Count', col: 'padding-left-lg ' } | ||
]} | ||
/> | ||
{/* <Pagination></Pagination> */} | ||
{/* {!tokens || tokens.length === 0 ? ( | ||
<RowLoader row={10} /> | ||
) : ( | ||
<div className="padding-bottom-sm"> | ||
{tokens?.map((item: Token, index: number) => { | ||
return <TokenRow key={index} index={index} token={item} /> | ||
})} | ||
</div> | ||
)} */} | ||
</Container> | ||
</Layout> | ||
) | ||
} | ||
// // type HomeExtendProps = typeof Home & { messages: string[] } | ||
// // ;(Home as HomeExtendProps).messages = ['Index'] | ||
|
||
// // export async function getStaticProps({ locale }: GetStaticPropsContext) { | ||
// // return { | ||
// // props: { | ||
// // messages: pick( | ||
// // { | ||
// // ...(await import(`../messages/share/${locale}.json`)).default, | ||
// // ...(await import(`../messages/index/${locale}.json`)).default | ||
// // }, | ||
// // (Home as HomeExtendProps).messages | ||
// // ) | ||
// // } | ||
// // } | ||
// // } | ||
export default AccountsPage | ||
export default AstraHolderPage |
Empty file.
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,35 +1,50 @@ | ||
import Container from 'components/Container' | ||
import RowLoader from 'components/Loader/RowLoader' | ||
import { PageTitle } from 'components/Typography/PageTitle' | ||
import RowTitle from 'components/Typography/RowTitle' | ||
import { NextPage } from 'next' | ||
// import {Pagination} from '@astraprotocol/astra-ui' | ||
import Head from 'next/head' | ||
import React from 'react' | ||
import React, { useState } from 'react' | ||
import useTokens from 'views/tokens/hook/useTokens' | ||
import TokenRow from 'views/tokens/TokenRow' | ||
import Layout from '../components/Layout' | ||
|
||
const AllTokensPage: React.FC<NextPage> = _ => { | ||
// // const t = useTranslations('Index') | ||
const [currentPage, setPage] = useState(1) | ||
const { tokens } = useTokens(currentPage) | ||
console.log(tokens) | ||
|
||
return ( | ||
<Layout> | ||
<Head> | ||
<title>Astra Explorer</title> | ||
</Head> | ||
<Container>Token</Container> | ||
|
||
<Container> | ||
<PageTitle>Tokens</PageTitle> | ||
<RowTitle | ||
columns={[ | ||
{ title: '', col: 'gutter-right' }, | ||
{ title: 'Token', col: 'padding-left-lg col-2 gutter-right' }, | ||
{ title: 'Address', col: 'padding-left-lg gutter-left col-5' }, | ||
{ title: 'Total Supply', col: 'padding-left-sm col-4' }, | ||
{ title: 'Holders Count', col: 'padding-left-lg ' } | ||
]} | ||
/> | ||
{/* <Pagination></Pagination> */} | ||
{!tokens || tokens.length === 0 ? ( | ||
<RowLoader row={10} /> | ||
) : ( | ||
<div className="padding-bottom-sm"> | ||
{tokens?.map((item: Token, index: number) => { | ||
return <TokenRow key={index} index={index} token={item} /> | ||
})} | ||
</div> | ||
)} | ||
</Container> | ||
</Layout> | ||
) | ||
} | ||
// // type HomeExtendProps = typeof Home & { messages: string[] } | ||
// // ;(Home as HomeExtendProps).messages = ['Index'] | ||
|
||
// // export async function getStaticProps({ locale }: GetStaticPropsContext) { | ||
// // return { | ||
// // props: { | ||
// // messages: pick( | ||
// // { | ||
// // ...(await import(`../messages/share/${locale}.json`)).default, | ||
// // ...(await import(`../messages/index/${locale}.json`)).default | ||
// // }, | ||
// // (Home as HomeExtendProps).messages | ||
// // ) | ||
// // } | ||
// // } | ||
// // } | ||
export default AllTokensPage |
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,77 @@ | ||
import clsx from 'clsx' | ||
import Typography from 'components/Typography' | ||
import { LinkMaker } from 'utils/helper' | ||
import styles from './style.module.scss' | ||
|
||
type Props = { | ||
index: number | ||
token: Token | ||
// blockNumber: number | ||
// size: number | ||
// updatedAt: number | string | ||
// transactions: number | ||
// proposerAddress: string | ||
// mine?: boolean | ||
// value: number | ||
// newBlock?: boolean | ||
} | ||
|
||
export default function TokenRow({ | ||
index, | ||
token | ||
}: // blockNumber, | ||
// updatedAt, | ||
// transactions, | ||
// proposerAddress, | ||
// mine, | ||
// size, | ||
// value, | ||
// newBlock | ||
Props) { | ||
return ( | ||
<div | ||
className={clsx( | ||
styles.rowBrief, | ||
styles.tokenRow, | ||
'row padding-left-lg', | ||
'padding-right-lg padding-top-sm padding-bottom-sm', | ||
'radius-lg', | ||
'margin-bottom-xs' | ||
)} | ||
> | ||
<div className={clsx('text text-base contrast-color-70 text-center margin-right-sm')}>{index}</div> | ||
<div className="col-2 block-ver-center"> | ||
<Typography.LinkText | ||
href={LinkMaker.token(token.contract_address_hash)} | ||
className={['text', 'text-base']} | ||
> | ||
{`${token.name} (${token.symbol})`} | ||
</Typography.LinkText> | ||
</div> | ||
|
||
<div className={clsx('col-5 padding-left-lg', styles.borderLeft)}> | ||
<div> | ||
<Typography.LinkText | ||
href={LinkMaker.address(token.contract_address_hash)} | ||
className={['text', 'text-sm']} | ||
> | ||
{token.contract_address_hash} | ||
</Typography.LinkText> | ||
</div> | ||
{/* <div className={clsx('block-ver-center', styles.info)}> | ||
<span className={clsx('money money-sm money-bold')}>{10000}</span> | ||
<span className={clsx(styles.currency, 'money money-sm money-bold')}>USDT</span> | ||
</div> */} | ||
</div> | ||
|
||
<div className="col-4 block-ver-center"> | ||
<span className={clsx('money money-sm money-bold padding-right-xs')}>{token.total_supply}</span> | ||
<span className={clsx(styles.currency, 'money money-sm money-bold')}>{token.symbol}</span> | ||
</div> | ||
|
||
<div className="padding-left-lg text-center money money-xs contrast-color-70 block-ver-center"> | ||
{token.holder_count} | ||
</div> | ||
</div> | ||
) | ||
} |
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,27 @@ | ||
import API_LIST from 'api/api_list' | ||
import { useEffect, useState } from 'react' | ||
import useSWR from 'swr' | ||
|
||
export default function useAccounts(page: number) { | ||
const [tokens, setState] = useState<Token[]>() | ||
|
||
const _fetchCondition = () => { | ||
return [ | ||
API_LIST.ALL_HOLDERS, | ||
{ | ||
page, | ||
offset: 20 | ||
} | ||
] | ||
} | ||
const { data } = useSWR<TokenResponse>(_fetchCondition()) | ||
|
||
useEffect(() => { | ||
if (data?.result) { | ||
setState(data?.result) | ||
} | ||
}, [data]) | ||
return { | ||
tokens | ||
} | ||
} |
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,34 @@ | ||
.rowBrief { | ||
display: flex; | ||
align-items: center; | ||
.indexCenter { | ||
display: flex; | ||
align-items: center; | ||
} | ||
.content { | ||
width: 100%; | ||
.info { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
} | ||
} | ||
|
||
.tokenRow { | ||
background: rgba(var(--contrast-color-theme--raw), 0.05); | ||
border: 1px solid rgba(var(--contrast-color-theme--raw), 0.05); | ||
backdrop-filter: blur(42px); | ||
|
||
.currency { | ||
font-family: 'TitilliumWeb-SemiBold'; | ||
color: var(--contrast-color-theme-70); | ||
} | ||
} | ||
.borderLeft { | ||
border-left: 1px solid rgba(var(--contrast-color-theme--raw), 0.05); | ||
} | ||
|
||
.topRow { | ||
display: flex; | ||
justify-content: space-between; | ||
} |
Oops, something went wrong.