Skip to content

Commit

Permalink
chore: disable account detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpeach committed Mar 11, 2023
1 parent e377dcc commit 197118d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
17 changes: 17 additions & 0 deletions src/lib/app-fns/explorer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ export const getExplorerTxUrl = (chainName: string) => {
return `${explorerMap[chainName]}/${pathSuffix}`;
};

export const getExplorerUserAddressUrl = (chainName: string) => {
let pathSuffix = "";
switch (chainName) {
case "osmosis":
case "osmosistestnet":
pathSuffix = "account";
break;
case "terra2":
case "terra2testnet":
pathSuffix = "address";
break;
default:
break;
}
return `${explorerMap[chainName]}/${pathSuffix}`;
};

export const getExplorerBlockUrl = (chainName: string) => {
let pathSuffix = "";
switch (chainName) {
Expand Down
8 changes: 3 additions & 5 deletions src/lib/components/ExplorerLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useWallet } from "@cosmos-kit/react";
import {
getExplorerBlockUrl,
getExplorerTxUrl,
getExplorerUserAddressUrl,
getProposalUrl,
} from "lib/app-fns/explorer";
import type { AddressReturnType } from "lib/app-provider";
Expand Down Expand Up @@ -45,7 +46,7 @@ const getNavigationUrl = (
url = "/contract";
break;
case "user_address":
url = "/account";
url = getExplorerUserAddressUrl(currentChainName);
break;
case "code_id":
url = "/code";
Expand Down Expand Up @@ -135,10 +136,7 @@ export const ExplorerLink = ({
...componentProps
}: ExplorerLinkProps) => {
const { address, currentChainName } = useWallet();
const isInternal =
type === "code_id" ||
type === "contract_address" ||
type === "user_address";
const isInternal = type === "code_id" || type === "contract_address";

const [hrefLink, textValue] = [
getNavigationUrl(type, currentChainName, copyValue || value),
Expand Down
6 changes: 3 additions & 3 deletions src/lib/layout/Searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const getRoute = (type: SearchResultType) => {
return "/code";
case "Contract Address":
return "/contract";
case "Wallet Address":
return "/account";
// case "Wallet Address":
// return "/account";
default:
return null;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ const Searchbar = () => {
value={keyword}
h="36px"
onChange={handleSearchChange}
placeholder="Search by Wallet Address / Contract Address / Code ID"
placeholder="Search by Contract Address / Code ID"
focusBorderColor="lilac.main"
onFocus={() => setDisplayResults(keyword.length > 0)}
onKeyDown={handleOnKeyEnter}
Expand Down
9 changes: 7 additions & 2 deletions src/lib/pages/account-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { useRouter } from "next/router";
import { useEffect, useState } from "react";

import { useValidateAddress } from "lib/app-provider";
import { useInternalNavigate, useValidateAddress } from "lib/app-provider";
import { BackButton } from "lib/components/button";
import { CustomTab } from "lib/components/CustomTab";
import { ExplorerLink } from "lib/components/ExplorerLink";
Expand Down Expand Up @@ -245,9 +245,14 @@ const AccountDetails = () => {
router.query.accountAddress
) as HumanAddr;

const navigate = useInternalNavigate();

useEffect(() => {
// remark: disable account detail and redirect to home page
navigate({ pathname: "/" });

if (router.isReady) AmpTrack(AmpEvent.TO_ACCOUNT_DETAIL);
}, [router.isReady]);
}, [router.isReady, navigate]);

return (
<PageContainer>
Expand Down

0 comments on commit 197118d

Please sign in to comment.