Skip to content

Commit

Permalink
fix: some small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Mar 1, 2023
1 parent 4092698 commit 6bff92f
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 139 deletions.
185 changes: 56 additions & 129 deletions components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,135 +12,6 @@ import Navigation, { MenuItem } from './Navigation'
import styles from './style.module.scss'
import SwitchTheme from './SwitchTheme'

export const items: MenuItem[] = [
{
id: '1',
label: 'Blocks',
link: '/blocks'
// submenus: [
// {
// id: '1.1',
// label: 'Blocks',
// link: '/blocks'
// },
// {
// id: '1.2',
// label: 'Uncle',
// link: '/uncle'
// },
// {
// id: '1.3',
// label: 'Forked Blocks (Reorgs)',
// link: '/reorgs'
// }
// ]
},
{
id: '2',
label: 'Transactions',
link: '/tx'
// submenus: [
// {
// id: '2.1',
// label: 'Validated',
// link: '/tx'
// },
// {
// id: '2.2',
// label: 'Pending',
// link: '/pending'
// }
// ]
},
{
id: '3',
label: 'Tokens',
submenus: [
{
id: '3.1',
label: 'All',
link: '/tokens'
},
{
id: '3.2',
label: 'Astra',
link: '/accounts'
}
]
},
{
id: '4',
label: 'Resources',
submenus: [
{
id: '4.1',
label: 'Stats',
link: '/charts'
}
]
},
// {
// id: '4',
// label: 'APIs',
// submenus: [
// {
// id: '4.1',
// label: 'GraphQL',
// link: '/graphql'
// },
// {
// id: '4.2',
// label: 'RPC',
// link: '/astra'
// },
// {
// id: '4.3',
// label: 'Eth RPC',
// link: '/eth-rpc'
// }
// ]
// },
{
id: '5',
label: process.env.NEXT_PUBLIC_ENV == 'mainnet' ? 'Astra Mainnet' : 'Astra Testnet',
prefixIcon: <LiveIcon />,
link: '/'
// submenus: [
// {
// id: '5.1',
// label: 'GraphQL',
// link: '/graphql'
// },
// {
// id: '5.2',
// label: 'RPC',
// link: '/astra'
// }
// ]
}
// {
// id: '6',
// type: 'locale',
// submenus: [
// {
// id: '6.1',
// label: 'ENG',
// link: '/en'
// },
// {
// id: '6.2',
// label: 'VI',
// link: '/vi'
// }
// ]
// }
// {
// id: '7',
// label: 'Single Menu',
// link: '/accounts'
// }
]

export default function Navbar() {
const { isMobile } = useMobileLayout('small')
const { isMobile: isResponsive } = useMobileLayout('large')
Expand All @@ -150,6 +21,62 @@ export default function Navbar() {

const _searchWrapperRef = useRef<HTMLDivElement>(null)

const items: MenuItem[] = [
{
id: '1',
label: 'Blocks',
link: '/blocks'
},
{
id: '2',
label: 'Transactions',
link: '/tx'
},
{
id: '3',
label: 'Tokens',
submenus: [
{
id: '3.1',
label: 'All',
link: '/tokens'
},
{
id: '3.2',
label: 'Astra',
link: '/accounts'
}
]
},
{
id: '4',
label: 'Stats',
link: '/charts'
},
{
id: '5',
label: process.env.NEXT_PUBLIC_ENV == 'mainnet' ? 'Astra Mainnet' : 'Astra Testnet',
prefixIcon: <LiveIcon />,
link: '/'
}
// {
// id: '6',
// type: 'locale',
// submenus: [
// {
// id: '6.1',
// label: 'ENG',
// link: '/en'
// },
// {
// id: '6.2',
// label: 'VI',
// link: '/vi'
// }
// ]
// }
]

const _hideMenu = () => {
setLoad(false)
//time for animation
Expand Down
4 changes: 2 additions & 2 deletions utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export class LinkMaker {
* @returns
*/
static block(blockNumber?: string | number, query: string = '') {
blockNumber = blockNumber > 0 ? `/${blockNumber}${query}` : ''
return `/blocks${blockNumber}`
blockNumber = blockNumber > 0 ? `${blockNumber}${query}` : ''
return `/block/${blockNumber}`
}

/**
Expand Down
26 changes: 19 additions & 7 deletions views/tokens/[instance]/NftOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,33 @@ interface Props {

const NftOverview = ({ token, tokenData, tokenId }: Props) => {
const { isMobile } = useMobileLayout()
const size = isMobile ? 200 : 800
const size = isMobile ? 100 : 200
const Layout = ({ children }) =>
isMobile ? (
<div style={{ display: 'flex', flexDirection: 'column-reverse' }}>{children}</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>{children}</div>
) : (
<Row>{children}</Row>
<div className="row">{children}</div>
)
const tokenImage = tokenData?.image?.replace('ipfs://', 'https://ipfs.io/ipfs/')
return (
<BackgroundCard classes="padding-top-lg padding-bottom-lg margin-top-2xl padding-left-2xl padding-right-2xl">
<Layout>
<div className="margin-right-md">
<div
className={clsx(
isMobile ? 'margin-bottom-md flex flex-justify-center' : 'flex flex-justify-end margin-right-md'
)}
>
{tokenImage && (
<Image
className="border radius-lg"
src={tokenImage}
alt={tokenData.name}
width={size}
height={size}
/>
)}
</div>
<div className=" border border-base flex-1 padding-lg radius-lg">
<Row style={{ justifyContent: 'space-between' }}>
<div className="text text-base contrast-color-50">Token ID:</div>
<div className="text text-base">{tokenId}</div>
Expand All @@ -38,9 +53,6 @@ const NftOverview = ({ token, tokenData, tokenId }: Props) => {
<div className="text text-base">&quot;{tokenData.description}&quot;</div>
{/* </Row> */}
</div>
<div className={clsx(isMobile ? 'margin-bottom-md' : 'flex flex-justify-end')}>
{tokenImage && <Image src={tokenImage} alt={tokenData.name} width={size} height={size} />}
</div>
</Layout>
</BackgroundCard>
)
Expand Down
1 change: 0 additions & 1 deletion views/transactions/cosmosMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const handleCosmosMsg = (messages: TransactionMessage[]) => {
*/
export const getAstraTokenAmount = (amount: TokenAmount | TokenAmount[]): string => {
let totalAmount = BigNumber.from('0')
console.log(amount)
if (isArray(amount) && !isEmpty(amount)) {
for (let a of amount) {
totalAmount = totalAmount.add(BigNumber.from(a.amount || '0'))
Expand Down

0 comments on commit 6bff92f

Please sign in to comment.