Commit c01be7dc authored by tom goriunov's avatar tom goriunov Committed by GitHub

Eliminate underscores in URLs (#1007)

Fixes #988
parent 2f503421
...@@ -135,7 +135,7 @@ export default function useNavItems(): ReturnType { ...@@ -135,7 +135,7 @@ export default function useNavItems(): ReturnType {
}, },
].filter(Boolean); ].filter(Boolean);
const mainNavItems = [ const mainNavItems: ReturnType['mainNavItems'] = [
{ {
text: 'Blockchain', text: 'Blockchain',
icon: globeIcon, icon: globeIcon,
...@@ -171,9 +171,9 @@ export default function useNavItems(): ReturnType { ...@@ -171,9 +171,9 @@ export default function useNavItems(): ReturnType {
icon: gearIcon, icon: gearIcon,
subItems: appConfig.otherLinks, subItems: appConfig.otherLinks,
} : null, } : null,
].filter(Boolean) as Array<NavItem | NavGroupItem>; ].filter(Boolean);
const accountNavItems = [ const accountNavItems: ReturnType['accountNavItems'] = [
{ {
text: 'Watch list', text: 'Watch list',
nextRoute: { pathname: '/account/watchlist' as const }, nextRoute: { pathname: '/account/watchlist' as const },
...@@ -182,31 +182,31 @@ export default function useNavItems(): ReturnType { ...@@ -182,31 +182,31 @@ export default function useNavItems(): ReturnType {
}, },
{ {
text: 'Private tags', text: 'Private tags',
nextRoute: { pathname: '/account/tag_address' as const }, nextRoute: { pathname: '/account/tag-address' as const },
icon: privateTagIcon, icon: privateTagIcon,
isActive: pathname === '/account/tag_address', isActive: pathname === '/account/tag-address',
}, },
{ {
text: 'Public tags', text: 'Public tags',
nextRoute: { pathname: '/account/public_tags_request' as const }, nextRoute: { pathname: '/account/public-tags-request' as const },
icon: publicTagIcon, isActive: pathname === '/account/public_tags_request', icon: publicTagIcon, isActive: pathname === '/account/public-tags-request',
}, },
{ {
text: 'API keys', text: 'API keys',
nextRoute: { pathname: '/account/api_key' as const }, nextRoute: { pathname: '/account/api-key' as const },
icon: apiKeysIcon, isActive: pathname === '/account/api_key', icon: apiKeysIcon, isActive: pathname === '/account/api-key',
}, },
{ {
text: 'Custom ABI', text: 'Custom ABI',
nextRoute: { pathname: '/account/custom_abi' as const }, nextRoute: { pathname: '/account/custom-abi' as const },
icon: abiIcon, icon: abiIcon,
isActive: pathname === '/account/custom_abi', isActive: pathname === '/account/custom-abi',
}, },
appConfig.contractInfoApi.endpoint && appConfig.adminServiceApi.endpoint && { appConfig.contractInfoApi.endpoint && appConfig.adminServiceApi.endpoint && {
text: 'Verified addrs', text: 'Verified addrs',
nextRoute: { pathname: '/account/verified_addresses' as const }, nextRoute: { pathname: '/account/verified-addresses' as const },
icon: verifiedIcon, icon: verifiedIcon,
isActive: pathname === '/account/verified_addresses', isActive: pathname === '/account/verified-addresses',
}, },
].filter(Boolean); ].filter(Boolean);
......
...@@ -9,7 +9,7 @@ const PAGE_TYPE_DICT: Record<Route['pathname'], string> = { ...@@ -9,7 +9,7 @@ const PAGE_TYPE_DICT: Record<Route['pathname'], string> = {
'/accounts': 'Top accounts', '/accounts': 'Top accounts',
'/address/[hash]': 'Address details', '/address/[hash]': 'Address details',
'/verified-contracts': 'Verified contracts', '/verified-contracts': 'Verified contracts',
'/address/[hash]/contract_verification': 'Contract verification', '/address/[hash]/contract-verification': 'Contract verification',
'/tokens': 'Tokens', '/tokens': 'Tokens',
'/token/[hash]': 'Token details', '/token/[hash]': 'Token details',
'/token/[hash]/instance/[id]': 'Token Instance', '/token/[hash]/instance/[id]': 'Token Instance',
...@@ -21,11 +21,11 @@ const PAGE_TYPE_DICT: Record<Route['pathname'], string> = { ...@@ -21,11 +21,11 @@ const PAGE_TYPE_DICT: Record<Route['pathname'], string> = {
'/search-results': 'Search results', '/search-results': 'Search results',
'/auth/profile': 'Profile', '/auth/profile': 'Profile',
'/account/watchlist': 'Watchlist', '/account/watchlist': 'Watchlist',
'/account/api_key': 'API keys', '/account/api-key': 'API keys',
'/account/custom_abi': 'Custom ABI', '/account/custom-abi': 'Custom ABI',
'/account/public_tags_request': 'Public tags', '/account/public-tags-request': 'Public tags',
'/account/tag_address': 'Private tags', '/account/tag-address': 'Private tags',
'/account/verified_addresses': 'Verified addresses', '/account/verified-addresses': 'Verified addresses',
'/withdrawals': 'Withdrawals', '/withdrawals': 'Withdrawals',
'/visualize/sol2uml': 'Solidity UML diagram', '/visualize/sol2uml': 'Solidity UML diagram',
'/csv-export': 'Export data to CSV file', '/csv-export': 'Export data to CSV file',
......
...@@ -7,8 +7,8 @@ import getSeo from 'lib/next/address/getSeo'; ...@@ -7,8 +7,8 @@ import getSeo from 'lib/next/address/getSeo';
import ContractVerification from 'ui/pages/ContractVerification'; import ContractVerification from 'ui/pages/ContractVerification';
import Page from 'ui/shared/Page/Page'; import Page from 'ui/shared/Page/Page';
const ContractVerificationPage: NextPage<RoutedQuery<'/address/[hash]/contract_verification'>> = const ContractVerificationPage: NextPage<RoutedQuery<'/address/[hash]/contract-verification'>> =
({ hash }: RoutedQuery<'/address/[hash]/contract_verification'>) => { ({ hash }: RoutedQuery<'/address/[hash]/contract-verification'>) => {
const { title, description } = getSeo({ hash }); const { title, description } = getSeo({ hash });
return ( return (
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
// prettier-ignore // prettier-ignore
declare module "nextjs-routes" { declare module "nextjs-routes" {
export type Route = export type Route =
| StaticRoute<"/account/api_key"> | StaticRoute<"/account/api-key">
| StaticRoute<"/account/custom_abi"> | StaticRoute<"/account/custom-abi">
| StaticRoute<"/account/public_tags_request"> | StaticRoute<"/account/public-tags-request">
| StaticRoute<"/account/tag_address"> | StaticRoute<"/account/tag-address">
| StaticRoute<"/account/verified_addresses"> | StaticRoute<"/account/verified-addresses">
| StaticRoute<"/account/watchlist"> | StaticRoute<"/account/watchlist">
| StaticRoute<"/accounts"> | StaticRoute<"/accounts">
| DynamicRoute<"/address/[hash]/contract_verification", { "hash": string }> | DynamicRoute<"/address/[hash]/contract-verification", { "hash": string }>
| DynamicRoute<"/address/[hash]", { "hash": string }> | DynamicRoute<"/address/[hash]", { "hash": string }>
| StaticRoute<"/api/csrf"> | StaticRoute<"/api/csrf">
| StaticRoute<"/api/healthz"> | StaticRoute<"/api/healthz">
......
...@@ -75,7 +75,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -75,7 +75,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
ml="auto" ml="auto"
mr={ 3 } mr={ 3 }
as="a" as="a"
href={ route({ pathname: '/address/[hash]/contract_verification', query: { hash: addressHash || '' } }) } href={ route({ pathname: '/address/[hash]/contract-verification', query: { hash: addressHash || '' } }) }
> >
Verify & publish Verify & publish
</Button> </Button>
...@@ -157,7 +157,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -157,7 +157,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
<AddressLink type="address" hash={ data.verified_twin_address_hash } truncation="constant" ml={ 2 }/> <AddressLink type="address" hash={ data.verified_twin_address_hash } truncation="constant" ml={ 2 }/>
</Address> </Address>
<chakra.span mt={ 1 }>All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with </chakra.span> <chakra.span mt={ 1 }>All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with </chakra.span>
<LinkInternal href={ route({ pathname: '/address/[hash]/contract_verification', query: { hash: addressHash || '' } }) }> <LinkInternal href={ route({ pathname: '/address/[hash]/contract-verification', query: { hash: addressHash || '' } }) }>
Verify & Publish Verify & Publish
</LinkInternal> </LinkInternal>
<span> page</span> <span> page</span>
......
...@@ -80,7 +80,7 @@ const AddressVerificationStepAddress = ({ defaultAddress, onContinue }: Props) = ...@@ -80,7 +80,7 @@ const AddressVerificationStepAddress = ({ defaultAddress, onContinue }: Props) =
return <span>Ownership of this contract address is already verified by another account.</span>; return <span>Ownership of this contract address is already verified by another account.</span>;
} }
case 'SOURCE_CODE_NOT_VERIFIED_ERROR': { case 'SOURCE_CODE_NOT_VERIFIED_ERROR': {
const href = route({ pathname: '/address/[hash]/contract_verification', query: { hash: address } }); const href = route({ pathname: '/address/[hash]/contract-verification', query: { hash: address } });
return ( return (
<Box> <Box>
<span>The contract source code you entered is not yet verified. Please follow these steps to </span> <span>The contract source code you entered is not yet verified. Please follow these steps to </span>
......
...@@ -49,7 +49,7 @@ const ContractVerification = () => { ...@@ -49,7 +49,7 @@ const ContractVerification = () => {
React.useEffect(() => { React.useEffect(() => {
if (method && hash) { if (method && hash) {
router.replace({ pathname: '/address/[hash]/contract_verification', query: { hash } }, undefined, { scroll: false, shallow: true }); router.replace({ pathname: '/address/[hash]/contract-verification', query: { hash } }, undefined, { scroll: false, shallow: true });
} }
// onMount only // onMount only
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
......
...@@ -31,7 +31,7 @@ const PublicTagsComponent: React.FC = () => { ...@@ -31,7 +31,7 @@ const PublicTagsComponent: React.FC = () => {
useRedirectForInvalidAuthToken(); useRedirectForInvalidAuthToken();
React.useEffect(() => { React.useEffect(() => {
addressHash && router.replace({ pathname: '/account/public_tags_request' }); addressHash && router.replace({ pathname: '/account/public-tags-request' });
// componentDidMount // componentDidMount
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ ]); }, [ ]);
......
...@@ -29,7 +29,7 @@ const VerifiedAddresses = () => { ...@@ -29,7 +29,7 @@ const VerifiedAddresses = () => {
const [ selectedAddress, setSelectedAddress ] = React.useState<string | undefined>(addressHash); const [ selectedAddress, setSelectedAddress ] = React.useState<string | undefined>(addressHash);
React.useEffect(() => { React.useEffect(() => {
addressHash && router.replace({ pathname: '/account/verified_addresses' }); addressHash && router.replace({ pathname: '/account/verified-addresses' });
// componentDidMount // componentDidMount
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ ]); }, [ ]);
......
...@@ -23,7 +23,7 @@ const PrivateTagMenuItem = ({ className, hash, onBeforeClick }: Props) => { ...@@ -23,7 +23,7 @@ const PrivateTagMenuItem = ({ className, hash, onBeforeClick }: Props) => {
const addressData = queryClient.getQueryData<Address>(queryKey); const addressData = queryClient.getQueryData<Address>(queryKey);
const handleClick = React.useCallback(() => { const handleClick = React.useCallback(() => {
if (!onBeforeClick({ pathname: '/account/tag_address' })) { if (!onBeforeClick({ pathname: '/account/tag-address' })) {
return; return;
} }
......
...@@ -15,11 +15,11 @@ const PublicTagMenuItem = ({ className, hash, onBeforeClick }: Props) => { ...@@ -15,11 +15,11 @@ const PublicTagMenuItem = ({ className, hash, onBeforeClick }: Props) => {
const router = useRouter(); const router = useRouter();
const handleClick = React.useCallback(() => { const handleClick = React.useCallback(() => {
if (!onBeforeClick({ pathname: '/account/public_tags_request' })) { if (!onBeforeClick({ pathname: '/account/public-tags-request' })) {
return; return;
} }
router.push({ pathname: '/account/public_tags_request', query: { address: hash } }); router.push({ pathname: '/account/public-tags-request', query: { address: hash } });
}, [ hash, onBeforeClick, router ]); }, [ hash, onBeforeClick, router ]);
return ( return (
......
...@@ -40,7 +40,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => { ...@@ -40,7 +40,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => {
}); });
const handleAddAddressClick = React.useCallback(() => { const handleAddAddressClick = React.useCallback(() => {
if (!onBeforeClick({ pathname: '/account/verified_addresses' })) { if (!onBeforeClick({ pathname: '/account/verified-addresses' })) {
return; return;
} }
...@@ -48,7 +48,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => { ...@@ -48,7 +48,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => {
}, [ modal, onBeforeClick ]); }, [ modal, onBeforeClick ]);
const handleAddApplicationClick = React.useCallback(async() => { const handleAddApplicationClick = React.useCallback(async() => {
router.push({ pathname: '/account/verified_addresses', query: { address: hash } }); router.push({ pathname: '/account/verified-addresses', query: { address: hash } });
}, [ hash, router ]); }, [ hash, router ]);
const handleVerifiedAddressSubmit = React.useCallback(async() => { const handleVerifiedAddressSubmit = React.useCallback(async() => {
...@@ -56,7 +56,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => { ...@@ -56,7 +56,7 @@ const TokenInfoMenuItem = ({ className, hash, onBeforeClick }: Props) => {
}, [ verifiedAddressesQuery ]); }, [ verifiedAddressesQuery ]);
const handleShowMyAddressesClick = React.useCallback(async() => { const handleShowMyAddressesClick = React.useCallback(async() => {
router.push({ pathname: '/account/verified_addresses' }); router.push({ pathname: '/account/verified-addresses' });
}, [ router ]); }, [ router ]);
const icon = <Icon as={ iconEdit } boxSize={ 6 } mr={ 2 } p={ 1 }/>; const icon = <Icon as={ iconEdit } boxSize={ 6 } mr={ 2 } p={ 1 }/>;
......
...@@ -47,7 +47,7 @@ const LogItem = ({ address, index, topics, data, decoded, type, tx_hash: txHash, ...@@ -47,7 +47,7 @@ const LogItem = ({ address, index, topics, data, decoded, type, tx_hash: txHash,
<GridItem colSpan={{ base: 1, lg: 2 }}> <GridItem colSpan={{ base: 1, lg: 2 }}>
<Alert status="warning" display="inline-table" whiteSpace="normal"> <Alert status="warning" display="inline-table" whiteSpace="normal">
To see accurate decoded input data, the contract must be verified.{ space } To see accurate decoded input data, the contract must be verified.{ space }
<Link href={ route({ pathname: '/address/[hash]/contract_verification', query: { hash: address.hash } }) }>Verify the contract here</Link> <Link href={ route({ pathname: '/address/[hash]/contract-verification', query: { hash: address.hash } }) }>Verify the contract here</Link>
</Alert> </Alert>
</GridItem> </GridItem>
) } ) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment