Skip to content

Commit

Permalink
fix: scroll, loader, charts
Browse files Browse the repository at this point in the history
change scroll value to auto
change loader of redux persist
add charts page
  • Loading branch information
vien.nguyen2-tiki committed Jan 9, 2023
1 parent ee57652 commit 401fec6
Show file tree
Hide file tree
Showing 39 changed files with 1,054 additions and 75 deletions.
11 changes: 10 additions & 1 deletion api/api_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ const API_LIST = {
VERIFY_CONTRACT: 'https://blockscout.astranaut.dev/verify_smart_contract/contract_verifications',
CHECK_VERIFY_STATUS: 'evm_/api/v1?module=contract&action=checkverifystatus',
GET_EVM_VERSION: 'evm_/api/v1/evm-versions',
GET_SOLIDITY_COMPILER: 'evm_/api/v1/compiler-versions?compiler=solc'
GET_SOLIDITY_COMPILER: 'evm_/api/v1/compiler-versions?compiler=solc',

// charts && stats
GET_TRANSACTION_HISTORY: '/api/v1/transactions-history?year=#YEAR&daily=true',
GET_ACTIVE_ADDRESS: '/api/v1/active-addresses-history?year=#YEAR&daily=true',
GET_ADDRESS_GROWTH: '/api/v1/total-addresses-growth?year=#YEAR&daily=true',
GET_GAS_DAILY: '/api/v1/gas-used-history?year=#YEAR&daily=true',
GET_GAS_MONTHLY: '/api/v1/gas-used-history?year=#YEAR',
GET_FEE_DAILY: '/api/v1/total-fee-history?year=2023&daily=true',
GET_FEE_MONTHLY: '/api/v1/total-fee-history?year=2023'
}

export default API_LIST
2 changes: 1 addition & 1 deletion components/Card/CardInfo/Components/RawInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function RawInput({ text }: RawInputProps) {
Sentry.captureException(e)
}
return (
<div style={{ maxWidth: '885px', maxHeight: '200px', overflowY: 'scroll' }}>
<div style={{ maxWidth: '885px', maxHeight: '200px', overflowY: 'auto' }}>
<Tabs
tabs={[
{ title: 'Hex', id: 'hex', padding: ' ' },
Expand Down
201 changes: 201 additions & 0 deletions components/Loader/InitPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
export default function InitPage() {
return (
<div
style={{
background:
'radial-gradient(100% 90% at 10% 0%, rgba(82, 120, 255, 0.2) 0%, rgba(23, 31, 60, 0.096) 100%), #08080a',
height: '100vh',
width: '100vw',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column'
}}
>
<svg
className="tea"
width={74}
height={96}
viewBox="0 0 37 48"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M27.0819 17H3.02508C1.91076 17 1.01376 17.9059 1.0485 19.0197C1.15761 22.5177 1.49703 29.7374 2.5 34C4.07125 40.6778 7.18553 44.8868 8.44856 46.3845C8.79051 46.79 9.29799 47 9.82843 47H20.0218C20.639 47 21.2193 46.7159 21.5659 46.2052C22.6765 44.5687 25.2312 40.4282 27.5 34C28.9757 29.8188 29.084 22.4043 29.0441 18.9156C29.0319 17.8436 28.1539 17 27.0819 17Z"
stroke="var(--secondary)"
strokeWidth={2}
/>
<path
d="M29 23.5C29 23.5 34.5 20.5 35.5 25.4999C36.0986 28.4926 34.2033 31.5383 32 32.8713C29.4555 34.4108 28 34 28 34"
stroke="var(--secondary)"
strokeWidth={2}
/>
<path
id="teabag"
fill="var(--secondary)"
fillRule="evenodd"
clipRule="evenodd"
d="M16 25V17H14V25H12C10.3431 25 9 26.3431 9 28V34C9 35.6569 10.3431 37 12 37H18C19.6569 37 21 35.6569 21 34V28C21 26.3431 19.6569 25 18 25H16ZM11 28C11 27.4477 11.4477 27 12 27H18C18.5523 27 19 27.4477 19 28V34C19 34.5523 18.5523 35 18 35H12C11.4477 35 11 34.5523 11 34V28Z"
/>
<path
id="steamL"
d="M17 1C17 1 17 4.5 14 6.5C11 8.5 11 12 11 12"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
stroke="var(--secondary)"
/>
<path
id="steamR"
d="M21 6C21 6 21 8.22727 19 9.5C17 10.7727 17 13 17 13"
stroke="var(--secondary)"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<span style={{ color: 'rgb(255 255 255 / 40%)', marginTop: '10px' }}>Loading...</span>
<style jsx>{`
body {
min-height: 100vh;
display: grid;
place-items: center;
}
svg.tea {
--secondary: #33406f;
}
svg.tea #teabag {
transform-origin: top center;
transform: rotate(3deg);
animation: swing 2s infinite;
}
svg.tea #steamL {
stroke-dasharray: 13;
stroke-dashoffset: 13;
animation: steamLarge 2s infinite;
}
svg.tea #steamR {
stroke-dasharray: 9;
stroke-dashoffset: 9;
animation: steamSmall 2s infinite;
}
@-moz-keyframes swing {
50% {
transform: rotate(-3deg);
}
}
@-webkit-keyframes swing {
50% {
transform: rotate(-3deg);
}
}
@-o-keyframes swing {
50% {
transform: rotate(-3deg);
}
}
@keyframes swing {
50% {
transform: rotate(-3deg);
}
}
@-moz-keyframes steamLarge {
0% {
stroke-dashoffset: 13;
opacity: 0.6;
}
100% {
stroke-dashoffset: 39;
opacity: 0;
}
}
@-webkit-keyframes steamLarge {
0% {
stroke-dashoffset: 13;
opacity: 0.6;
}
100% {
stroke-dashoffset: 39;
opacity: 0;
}
}
@-o-keyframes steamLarge {
0% {
stroke-dashoffset: 13;
opacity: 0.6;
}
100% {
stroke-dashoffset: 39;
opacity: 0;
}
}
@keyframes steamLarge {
0% {
stroke-dashoffset: 13;
opacity: 0.6;
}
100% {
stroke-dashoffset: 39;
opacity: 0;
}
}
@-moz-keyframes steamSmall {
10% {
stroke-dashoffset: 9;
opacity: 0.6;
}
80% {
stroke-dashoffset: 27;
opacity: 0;
}
100% {
stroke-dashoffset: 27;
opacity: 0;
}
}
@-webkit-keyframes steamSmall {
10% {
stroke-dashoffset: 9;
opacity: 0.6;
}
80% {
stroke-dashoffset: 27;
opacity: 0;
}
100% {
stroke-dashoffset: 27;
opacity: 0;
}
}
@-o-keyframes steamSmall {
10% {
stroke-dashoffset: 9;
opacity: 0.6;
}
80% {
stroke-dashoffset: 27;
opacity: 0;
}
100% {
stroke-dashoffset: 27;
opacity: 0;
}
}
@keyframes steamSmall {
10% {
stroke-dashoffset: 9;
opacity: 0.6;
}
80% {
stroke-dashoffset: 27;
opacity: 0;
}
100% {
stroke-dashoffset: 27;
opacity: 0;
}
}
`}</style>
</div>
)
}
4 changes: 1 addition & 3 deletions components/Navbar/MobileNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ export default function MoibleNavigation({ items }: MobileNavigationProps) {
title: titleElement,
items: subCollapse
}
menus.push(
<Collapse key={item.label} {...collapse} classes={{ wrapper: 'border border-bottom-base' }} />
)
menus.push(<Collapse key={item.label} {...collapse} />)
} else {
menus.push(<LinkMenuItem key={item.label} link={item.link} label={item.label} pathname={pathname} />)
}
Expand Down
2 changes: 1 addition & 1 deletion components/Navbar/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function Navigation({ items }: NavigationProps) {

{sub1?.length > 0 && (
<>
<span className="icon-dropdown" data-text="icon"></span>
<span className="icon-dropdown text-base" data-text="icon"></span>
<ul
className={clsx(styles.submenu, 'radius-sm shadow-xs', {
[styles.show]: show,
Expand Down
11 changes: 11 additions & 0 deletions components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ export const items: MenuItem[] = [
},
// {
// id: '4',
// label: 'Resources',
// submenus: [
// {
// id: '4.1',
// label: 'Charts and Stats',
// link: '/charts'
// }
// ]
// },
// {
// id: '4',
// label: 'APIs',
// submenus: [
// {
Expand Down
1 change: 0 additions & 1 deletion components/Navbar/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ $backgroundHover: rgba(var(--contrast-color-theme--raw), 0.05);
span[data-text='icon'] {
display: inline-flex;
&::before {
font-size: 5px;
color: var(--contrast-color-theme-70);
}
}
Expand Down
10 changes: 6 additions & 4 deletions components/Search/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export default function SearchModal({ open, closeModal }: SearchModalProps) {
}
const response = useSWR(_fetch())
const data: SearchItemResponse = response.data
useEffect(() => {
_setSearchStatus(SearchStatusEnum.DONE)
}, [router.query])

// useEffect(() => {
// _setSearchStatus(SearchStatusEnum.DONE)
// }, [router.query])

useEffect(() => {
if (_search && data !== undefined) {
_setSearchStatus(SearchStatusEnum.DONE)
Expand All @@ -81,7 +83,7 @@ export default function SearchModal({ open, closeModal }: SearchModalProps) {
? `${transactions[0].evmHash}?type=evm`
: transactions[0].cosmosHash
: undefined
const block = blocks?.[0] ? blocks[0].blockHash : undefined
const block = blocks?.[0] ? blocks[0].blockNumber : undefined
const address = addresses?.[0] ? addresses[0].addressHash : undefined
const validator = validators?.[0] ? validators[0].operatorAddress : undefined
const token = tokens?.[0] ? tokens[0].addressHash : undefined
Expand Down
2 changes: 1 addition & 1 deletion components/Tabs/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.tabs {
overflow-x: scroll;
overflow-x: auto;
}

.tab {
Expand Down
2 changes: 1 addition & 1 deletion components/VerifyContract/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

.container {
overflow-y: scroll;
overflow-y: auto;
}

.body {
Expand Down
3 changes: 2 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@astraprotocol/astra-ui/lib/shared/style.css'
import { cosmosFetcher, evmFetcher } from 'api'
import InitPage from 'components/Loader/InitPage'
import PageLoader from 'components/Loader/PageLoader'
import dayjs from 'dayjs'
import { NextIntlProvider } from 'next-intl'
Expand Down Expand Up @@ -45,7 +46,7 @@ const App = ({ Component, pageProps }: AppProps) => {
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
</Head>
<PersistGate loading={'loading'} persistor={persistor}>
<PersistGate loading={<InitPage />} persistor={persistor}>
<NextIntlProvider messages={(pageProps as typeof pageProps & { messages: any }).messages}>
<SWRConfig
value={{
Expand Down
2 changes: 1 addition & 1 deletion pages/accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const AstraHolderPage: React.FC<NextPage> = _ => {
{isValidating ? (
<RowLoader row={10} />
) : (
<div className="padding-bottom-sm" style={{ overflowY: 'scroll' }}>
<div className="padding-bottom-sm" style={{ overflowY: 'auto' }}>
<HolderHeadTitle />
{result?.map((item: Holder, index: number) => {
return (
Expand Down
8 changes: 6 additions & 2 deletions pages/blocks/[block].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ const BlockDetailPage: React.FC<Props> = ({ errorMessage, blockDetail, blockHeig
case 'committedCouncilNodes': //from
const proposerHash = data[key].find(item => item.isProposer).address
const proposer = getStakingValidatorByHex(proposerHash) as Proposer
const address = astraToEth(proposer.initialDelegatorAddress)
const address =
proposer?.initialDelegatorAddress && astraToEth(proposer?.initialDelegatorAddress || '')
items.push({
label: CardInfoLabels.validatorAddress,
type: 'link-copy',
contents: [
{
value: address,
link: LinkMaker.address(astraToEth(proposer.initialDelegatorAddress))
link: LinkMaker.address(
proposer?.initialDelegatorAddress &&
astraToEth(proposer?.initialDelegatorAddress || '')
)
}
]
})
Expand Down
31 changes: 31 additions & 0 deletions pages/charts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Container from 'components/Container'
import { NextPage } from 'next'
import Head from 'next/head'
import React from 'react'
import Address from 'views/charts/Address'
import Fee from 'views/charts/Fee'
import Gas from 'views/charts/Gas'
import Transactions from 'views/charts/Transactions'
import Overview from 'views/homepage/Overview'
import Layout from '../components/Layout'

const Charts: React.FC<NextPage> = _ => {
return (
<Layout>
<Head>
<title>{process.env.NEXT_PUBLIC_TITLE}</title>
</Head>
<Container>
<div className="col md-wrap" style={{ paddingTop: '150px' }}>
<Overview />
<Transactions />
<Address />
<Gas />
<Fee />
</div>
</Container>
</Layout>
)
}

export default Charts
Loading

0 comments on commit 401fec6

Please sign in to comment.