Commit 02da3e4b authored by tom's avatar tom

address link enhancement

parent ee2a86d9
...@@ -6,23 +6,26 @@ import HashStringShorten from 'ui/shared/HashStringShorten'; ...@@ -6,23 +6,26 @@ import HashStringShorten from 'ui/shared/HashStringShorten';
import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic'; import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
interface Props { interface Props {
type?: 'address' | 'transaction' | 'token'; type?: 'address' | 'transaction' | 'token' | 'block';
alias?: string; alias?: string;
className?: string; className?: string;
hash: string; hash: string;
truncation?: 'constant' | 'dynamic'| 'none'; truncation?: 'constant' | 'dynamic'| 'none';
fontWeight?: string; fontWeight?: string;
id?: string;
} }
const AddressLink = ({ alias, type, className, truncation = 'dynamic', hash, fontWeight }: Props) => { const AddressLink = ({ alias, type, className, truncation = 'dynamic', hash, id, fontWeight }: Props) => {
const link = useLink(); const link = useLink();
let url; let url;
if (type === 'transaction') { if (type === 'transaction') {
url = link('tx_index', { id: hash }); url = link('tx_index', { id: id || hash });
} else if (type === 'token') { } else if (type === 'token') {
url = link('token_index', { id: hash }); url = link('token_index', { id: id || hash });
} else if (type === 'block') {
url = link('block_index', { id: id || hash });
} else { } else {
url = link('address_index', { id: hash }); url = link('address_index', { id: id || hash });
} }
const content = (() => { const content = (() => {
......
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