diff --git a/pages/_app.js b/pages/_app.js index bd0178fa1..8f227facc 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -163,7 +163,8 @@ const MyApp = ({ Component, pageProps }) => { '/terms-and-conditions', '/press', '/404', - '/faucet' + '/faucet', + '/explorer2' ] if (showTopAds) { showTopAds = !pagesWithNoTopAdds.includes(pathname) && !pathname.includes('/admin') diff --git a/pages/explorer2.js b/pages/explorer2.js new file mode 100644 index 000000000..d92ee02e7 --- /dev/null +++ b/pages/explorer2.js @@ -0,0 +1,141 @@ +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +import { useTranslation } from 'next-i18next' +import Head from 'next/head' +import Link from 'next/link' + +import { server, explorerName, nativeCurrency, network } from '../utils' +import { getIsSsrMobile } from '../utils/mobile' + +import SEO from '../components/SEO' +import SearchBlock from '../components/Layout/SearchBlock' +import Ads from '../components/Layout/Ads' +import CopyButton from '../components/UI/CopyButton' +import { shortHash } from '../utils/format' + +export async function getServerSideProps(context) { + const { locale } = context + return { + props: { + isSsrMobile: getIsSsrMobile(context), + ...(await serverSideTranslations(locale, ['common'])) + } + } +} + +const ldJsonWebsite = { + '@context': 'https://schema.org', + '@type': 'WebSite', + name: nativeCurrency + ' Explorer', + alternateName: [nativeCurrency + ' Explorer', explorerName + ' Explorer', 'Scan ' + nativeCurrency + ' Ledger'], + url: server, + potentialAction: { + '@type': 'SearchAction', + target: { + '@type': 'EntryPoint', + urlTemplate: server + '/explorer/{search_term_string}' + }, + 'query-input': 'required name=search_term_string' + } +} + +const examples = { + mainnet: { + nft: '000A13884B50699E253C5098DEFE3A0872A79D129172F496F5F7E0EA00000532', + amm: '160C6649399D6AF625ED94A66812944BDA1D8993445A503F6B5730DECC7D3767', + txHash: '29C56EB4A9E6C6F16A54968EC7DC8DAE92A95348EC583F2B82A028C3EAE627C0', + txCTID: 'C5DB956000090000', + account: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', + payString: ['username$paystring.crypto.com', 'vbuterin$bithomp.com'], + xAddress: 'XVVFXHFdehYhofb7XRWeJYV6kjTEwbq2mLScCiYyDTHKu9E', + username: ['bitstamp', 'vbuterin', 'JoelKatz'], + object: '0802E4E7EACC17414747174474487E9DF24CFDB61DD12C58B09D9EFB42C7F8C8' + }, + testnet: {} +} + +export default function Explorer({ isSsrMobile, showAds }) { + const { t } = useTranslation() + + const shortingHash = (hash) => { + let length = 24 + if (isSsrMobile) { + length = 7 + } + return shortHash(hash, length) + } + + return ( + <> + + +