Commit 4d01d206 authored by tom's avatar tom

fix link in new item socket alert

parent 5bf614fc
...@@ -116,7 +116,6 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }: ...@@ -116,7 +116,6 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
</TableHeaderSticky> </TableHeaderSticky>
<TableBody> <TableBody>
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
num={ newItemsCount } num={ newItemsCount }
alert={ socketAlert } alert={ socketAlert }
type="block" type="block"
...@@ -136,7 +135,6 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }: ...@@ -136,7 +135,6 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
<Box hideFrom="lg"> <Box hideFrom="lg">
{ query.pagination.page === 1 && ( { query.pagination.page === 1 && (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ newItemsCount } num={ newItemsCount }
alert={ socketAlert } alert={ socketAlert }
type="block" type="block"
......
...@@ -197,7 +197,6 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender = ...@@ -197,7 +197,6 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
<Box hideFrom="lg"> <Box hideFrom="lg">
{ pagination.page === 1 && ( { pagination.page === 1 && (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ newItemsCount } num={ newItemsCount }
alert={ socketAlert } alert={ socketAlert }
type="token_transfer" type="token_transfer"
......
...@@ -90,7 +90,6 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => { ...@@ -90,7 +90,6 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
<Box hideFrom="lg"> <Box hideFrom="lg">
{ query.pagination.page === 1 && enableSocket && ( { query.pagination.page === 1 && enableSocket && (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ newItemsCount } num={ newItemsCount }
alert={ socketAlert } alert={ socketAlert }
type="block" type="block"
......
...@@ -67,7 +67,6 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum ...@@ -67,7 +67,6 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum
<TableBody> <TableBody>
{ showSocketInfo && ( { showSocketInfo && (
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
alert={ socketInfoAlert } alert={ socketInfoAlert }
num={ socketInfoNum } num={ socketInfoNum }
type="block" type="block"
......
...@@ -14,13 +14,17 @@ interface Props { ...@@ -14,13 +14,17 @@ interface Props {
type?: 'transaction' | 'token_transfer' | 'deposit' | 'block'; type?: 'transaction' | 'token_transfer' | 'deposit' | 'block';
children?: (props: InjectedProps) => React.JSX.Element; children?: (props: InjectedProps) => React.JSX.Element;
className?: string; className?: string;
url: string; url?: string;
alert?: string; alert?: string;
num?: number; num?: number;
isLoading?: boolean; isLoading?: boolean;
} }
const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, type = 'transaction', isLoading }: Props) => { const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, type = 'transaction', isLoading }: Props) => {
const handleLinkClick = React.useCallback(() => {
window.location.reload();
}, []);
const alertContent = (() => { const alertContent = (() => {
if (alert) { if (alert) {
return alert; return alert;
...@@ -49,7 +53,7 @@ const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, typ ...@@ -49,7 +53,7 @@ const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, typ
return ( return (
<> <>
<Link href={ url }>{ num.toLocaleString() } more { name }{ num > 1 ? 's' : '' }</Link> <Link href={ url } onClick={ !url ? handleLinkClick : undefined }>{ num.toLocaleString() } more { name }{ num > 1 ? 's' : '' }</Link>
<Text whiteSpace="pre"> ha{ num > 1 ? 've' : 's' } come in</Text> <Text whiteSpace="pre"> ha{ num > 1 ? 've' : 's' } come in</Text>
</> </>
); );
......
...@@ -47,7 +47,6 @@ const TokenTransferTable = ({ ...@@ -47,7 +47,6 @@ const TokenTransferTable = ({
<TableBody> <TableBody>
{ showSocketInfo && ( { showSocketInfo && (
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
alert={ socketInfoAlert } alert={ socketInfoAlert }
num={ socketInfoNum } num={ socketInfoNum }
type="token_transfer" type="token_transfer"
......
...@@ -76,7 +76,6 @@ const AlertShowcase = () => { ...@@ -76,7 +76,6 @@ const AlertShowcase = () => {
</TableHeader> </TableHeader>
<TableBody> <TableBody>
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
num={ 1234 } num={ 1234 }
type="block" type="block"
isLoading isLoading
...@@ -95,7 +94,6 @@ const AlertShowcase = () => { ...@@ -95,7 +94,6 @@ const AlertShowcase = () => {
</TableHeader> </TableHeader>
<TableBody> <TableBody>
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
num={ 1234 } num={ 1234 }
type="block" type="block"
isLoading={ false } isLoading={ false }
......
...@@ -89,7 +89,6 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_ ...@@ -89,7 +89,6 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
<Box display={{ base: 'block', lg: 'none' }}> <Box display={{ base: 'block', lg: 'none' }}>
{ pagination.page === 1 && ( { pagination.page === 1 && (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ newItemsCount } num={ newItemsCount }
alert={ socketAlert } alert={ socketAlert }
type="token_transfer" type="token_transfer"
......
...@@ -47,7 +47,6 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket ...@@ -47,7 +47,6 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket
<TableBody> <TableBody>
{ showSocketInfo && ( { showSocketInfo && (
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
alert={ socketInfoAlert } alert={ socketInfoAlert }
num={ socketInfoNum } num={ socketInfoNum }
type="token_transfer" type="token_transfer"
......
...@@ -21,7 +21,6 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => { ...@@ -21,7 +21,6 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
if (place === 'table') { if (place === 'table') {
return ( return (
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
alert={ alertText } alert={ alertText }
num={ num } num={ num }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -32,7 +31,6 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => { ...@@ -32,7 +31,6 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
if (place === 'list') { if (place === 'list') {
return ( return (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ num } num={ num }
alert={ alertText } alert={ alertText }
isLoading={ isLoading } isLoading={ isLoading }
......
...@@ -22,7 +22,6 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => { ...@@ -22,7 +22,6 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
if (place === 'table') { if (place === 'table') {
return ( return (
<SocketNewItemsNotice.Desktop <SocketNewItemsNotice.Desktop
url={ window.location.href }
alert={ alertText } alert={ alertText }
num={ num } num={ num }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -33,7 +32,6 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => { ...@@ -33,7 +32,6 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
if (place === 'list') { if (place === 'list') {
return ( return (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href }
num={ num } num={ num }
alert={ alertText } alert={ alertText }
isLoading={ isLoading } isLoading={ isLoading }
......
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