Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
1a5f0e63
Unverified
Commit
1a5f0e63
authored
Jul 04, 2025
by
Igor Stuev
Committed by
GitHub
Jul 04, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change txs socket alert text (#2822)
parent
a2b9c418
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
70 additions
and
63 deletions
+70
-63
AddressBlocksValidated.tsx
ui/address/AddressBlocksValidated.tsx
+5
-5
AddressTokenTransfers.tsx
ui/address/AddressTokenTransfers.tsx
+6
-6
BlocksContent.tsx
ui/blocks/BlocksContent.tsx
+5
-5
BlocksTable.tsx
ui/blocks/BlocksTable.tsx
+3
-3
LatestTxs.tsx
ui/home/LatestTxs.tsx
+2
-2
LatestArbitrumDeposits.tsx
ui/home/latestDeposits/LatestArbitrumDeposits.tsx
+4
-4
LatestDeposits.tsx
ui/home/latestDeposits/LatestDeposits.tsx
+10
-3
LatestOptimisticDeposits.tsx
ui/home/latestDeposits/LatestOptimisticDeposits.tsx
+4
-4
Blocks.pw.tsx_default_socket-error-1.png
.../__screenshots__/Blocks.pw.tsx_default_socket-error-1.png
+0
-0
SocketNewItemsNotice.pw.tsx
ui/shared/SocketNewItemsNotice.pw.tsx
+1
-1
SocketNewItemsNotice.tsx
ui/shared/SocketNewItemsNotice.tsx
+4
-4
TokenTransferTable.tsx
ui/shared/TokenTransfer/TokenTransferTable.tsx
+3
-3
SocketNewItemsNotice.pw.tsx_default_connection-loss-1.png
...SocketNewItemsNotice.pw.tsx_default_connection-loss-1.png
+0
-0
TokenTransfer.tsx
ui/token/TokenTransfer/TokenTransfer.tsx
+5
-5
TokenTransferTable.tsx
ui/token/TokenTransfer/TokenTransferTable.tsx
+3
-3
TxsSocketNoticeTypeAddress.tsx
ui/txs/socket/TxsSocketNoticeTypeAddress.tsx
+3
-3
TxsSocketNoticeTypeAll.tsx
ui/txs/socket/TxsSocketNoticeTypeAll.tsx
+3
-3
useTxsSocketTypeAddress.tsx
ui/txs/socket/useTxsSocketTypeAddress.tsx
+5
-5
useTxsSocketTypeAll.tsx
ui/txs/socket/useTxsSocketTypeAll.tsx
+4
-4
No files found.
ui/address/AddressBlocksValidated.tsx
View file @
1a5f0e63
...
@@ -33,7 +33,7 @@ interface Props {
...
@@ -33,7 +33,7 @@ interface Props {
}
}
const
AddressBlocksValidated
=
({
shouldRender
=
true
,
isQueryEnabled
=
true
}:
Props
)
=>
{
const
AddressBlocksValidated
=
({
shouldRender
=
true
,
isQueryEnabled
=
true
}:
Props
)
=>
{
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketAlert
,
setShowSocketAlert
]
=
React
.
useState
(
false
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
...
@@ -60,11 +60,11 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
...
@@ -60,11 +60,11 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
});
});
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new blocks. Please refresh the page to load new blocks.
'
);
setS
howSocketAlert
(
true
);
},
[]);
},
[]);
const
handleNewSocketMessage
:
SocketMessage
.
NewBlock
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
const
handleNewSocketMessage
:
SocketMessage
.
NewBlock
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
setS
ocketAlert
(
''
);
setS
howSocketAlert
(
false
);
queryClient
.
setQueryData
(
queryClient
.
setQueryData
(
getResourceKey
(
'
general:address_blocks_validated
'
,
{
pathParams
:
{
hash
:
addressHash
}
}),
getResourceKey
(
'
general:address_blocks_validated
'
,
{
pathParams
:
{
hash
:
addressHash
}
}),
...
@@ -121,7 +121,7 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
...
@@ -121,7 +121,7 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
<
TableBody
>
<
TableBody
>
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
num=
{
newItemsCount
}
num=
{
newItemsCount
}
alert=
{
s
ocketAlert
}
showErrorAlert=
{
showS
ocketAlert
}
type=
"block"
type=
"block"
isLoading=
{
query
.
isPlaceholderData
}
isLoading=
{
query
.
isPlaceholderData
}
/>
/>
...
@@ -140,7 +140,7 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
...
@@ -140,7 +140,7 @@ const AddressBlocksValidated = ({ shouldRender = true, isQueryEnabled = true }:
{
query
.
pagination
.
page
===
1
&&
(
{
query
.
pagination
.
page
===
1
&&
(
<
SocketNewItemsNotice
.
Mobile
<
SocketNewItemsNotice
.
Mobile
num=
{
newItemsCount
}
num=
{
newItemsCount
}
alert=
{
s
ocketAlert
}
showErrorAlert=
{
showS
ocketAlert
}
type=
"block"
type=
"block"
isLoading=
{
query
.
isPlaceholderData
}
isLoading=
{
query
.
isPlaceholderData
}
/>
/>
...
...
ui/address/AddressTokenTransfers.tsx
View file @
1a5f0e63
...
@@ -73,7 +73,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
...
@@ -73,7 +73,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
const
currentAddress
=
getQueryParamString
(
router
.
query
.
hash
);
const
currentAddress
=
getQueryParamString
(
router
.
query
.
hash
);
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketAlert
,
setShowSocketAlert
]
=
React
.
useState
(
false
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
[
filters
,
setFilters
]
=
React
.
useState
<
Filters
>
(
const
[
filters
,
setFilters
]
=
React
.
useState
<
Filters
>
(
...
@@ -109,7 +109,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
...
@@ -109,7 +109,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
},
[
filters
,
onFilterChange
]);
},
[
filters
,
onFilterChange
]);
const
handleNewSocketMessage
:
SocketMessage
.
AddressTokenTransfer
[
'
handler
'
]
=
(
payload
)
=>
{
const
handleNewSocketMessage
:
SocketMessage
.
AddressTokenTransfer
[
'
handler
'
]
=
(
payload
)
=>
{
setS
ocketAlert
(
''
);
setS
howSocketAlert
(
false
);
const
newItems
:
Array
<
TokenTransfer
>
=
[];
const
newItems
:
Array
<
TokenTransfer
>
=
[];
let
newCount
=
0
;
let
newCount
=
0
;
...
@@ -152,11 +152,11 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
...
@@ -152,11 +152,11 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
};
};
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
Connection is lost. Please refresh the page to load new token transfers.
'
);
setS
howSocketAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new token transfers. Please refresh the page.
'
);
setS
howSocketAlert
(
true
);
},
[]);
},
[]);
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
...
@@ -189,7 +189,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
...
@@ -189,7 +189,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
top=
{
isActionBarHidden
?
0
:
ACTION_BAR_HEIGHT_DESKTOP
}
top=
{
isActionBarHidden
?
0
:
ACTION_BAR_HEIGHT_DESKTOP
}
enableTimeIncrement
enableTimeIncrement
showSocketInfo=
{
pagination
.
page
===
1
}
showSocketInfo=
{
pagination
.
page
===
1
}
s
ocketInfoAlert=
{
s
ocketAlert
}
s
howSocketErrorAlert=
{
showS
ocketAlert
}
socketInfoNum=
{
newItemsCount
}
socketInfoNum=
{
newItemsCount
}
isLoading=
{
isPlaceholderData
}
isLoading=
{
isPlaceholderData
}
/>
/>
...
@@ -198,7 +198,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
...
@@ -198,7 +198,7 @@ const AddressTokenTransfers = ({ overloadCount = OVERLOAD_COUNT, shouldRender =
{
pagination
.
page
===
1
&&
(
{
pagination
.
page
===
1
&&
(
<
SocketNewItemsNotice
.
Mobile
<
SocketNewItemsNotice
.
Mobile
num=
{
newItemsCount
}
num=
{
newItemsCount
}
alert=
{
s
ocketAlert
}
showErrorAlert=
{
showS
ocketAlert
}
type=
"token_transfer"
type=
"token_transfer"
isLoading=
{
isPlaceholderData
}
isLoading=
{
isPlaceholderData
}
/>
/>
...
...
ui/blocks/BlocksContent.tsx
View file @
1a5f0e63
...
@@ -34,7 +34,7 @@ interface Props {
...
@@ -34,7 +34,7 @@ interface Props {
const
BlocksContent
=
({
type
,
query
,
enableSocket
=
true
,
top
}:
Props
)
=>
{
const
BlocksContent
=
({
type
,
query
,
enableSocket
=
true
,
top
}:
Props
)
=>
{
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketAlert
,
setShowSocketAlert
]
=
React
.
useState
(
false
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
...
@@ -66,11 +66,11 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
...
@@ -66,11 +66,11 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
},
[
queryClient
,
type
]);
},
[
queryClient
,
type
]);
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
Connection is lost. Please refresh the page to load new blocks.
'
);
setS
howSocketAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new blocks. Please refresh the page to load new blocks.
'
);
setS
howSocketAlert
(
true
);
},
[]);
},
[]);
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
...
@@ -91,7 +91,7 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
...
@@ -91,7 +91,7 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
{
query
.
pagination
.
page
===
1
&&
enableSocket
&&
(
{
query
.
pagination
.
page
===
1
&&
enableSocket
&&
(
<
SocketNewItemsNotice
.
Mobile
<
SocketNewItemsNotice
.
Mobile
num=
{
newItemsCount
}
num=
{
newItemsCount
}
alert=
{
s
ocketAlert
}
showErrorAlert=
{
showS
ocketAlert
}
type=
"block"
type=
"block"
isLoading=
{
query
.
isPlaceholderData
}
isLoading=
{
query
.
isPlaceholderData
}
/>
/>
...
@@ -106,7 +106,7 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
...
@@ -106,7 +106,7 @@ const BlocksContent = ({ type, query, enableSocket = true, top }: Props) => {
isLoading=
{
query
.
isPlaceholderData
}
isLoading=
{
query
.
isPlaceholderData
}
showSocketInfo=
{
query
.
pagination
.
page
===
1
&&
enableSocket
}
showSocketInfo=
{
query
.
pagination
.
page
===
1
&&
enableSocket
}
socketInfoNum=
{
newItemsCount
}
socketInfoNum=
{
newItemsCount
}
s
ocketInfoAlert=
{
s
ocketAlert
}
s
howSocketErrorAlert=
{
showS
ocketAlert
}
/>
/>
</
Box
>
</
Box
>
</>
</>
...
...
ui/blocks/BlocksTable.tsx
View file @
1a5f0e63
...
@@ -19,7 +19,7 @@ interface Props {
...
@@ -19,7 +19,7 @@ interface Props {
top
:
number
;
top
:
number
;
page
:
number
;
page
:
number
;
socketInfoNum
?:
number
;
socketInfoNum
?:
number
;
s
ocketInfoAlert
?:
string
;
s
howSocketErrorAlert
?:
boolean
;
showSocketInfo
?:
boolean
;
showSocketInfo
?:
boolean
;
}
}
...
@@ -30,7 +30,7 @@ const FEES_COL_WEIGHT = 22;
...
@@ -30,7 +30,7 @@ const FEES_COL_WEIGHT = 22;
const
isRollup
=
config
.
features
.
rollup
.
isEnabled
;
const
isRollup
=
config
.
features
.
rollup
.
isEnabled
;
const
BlocksTable
=
({
data
,
isLoading
,
top
,
page
,
showSocketInfo
,
socketInfoNum
,
s
ocketInfo
Alert
}:
Props
)
=>
{
const
BlocksTable
=
({
data
,
isLoading
,
top
,
page
,
showSocketInfo
,
socketInfoNum
,
s
howSocketError
Alert
}:
Props
)
=>
{
const
initialList
=
useInitialList
({
const
initialList
=
useInitialList
({
data
:
data
??
[],
data
:
data
??
[],
idFn
:
(
item
)
=>
item
.
height
,
idFn
:
(
item
)
=>
item
.
height
,
...
@@ -71,7 +71,7 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum
...
@@ -71,7 +71,7 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum
<
TableBody
>
<
TableBody
>
{
showSocketInfo
&&
(
{
showSocketInfo
&&
(
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
alert=
{
socketInfo
Alert
}
showErrorAlert=
{
showSocketError
Alert
}
num=
{
socketInfoNum
}
num=
{
socketInfoNum
}
type=
"block"
type=
"block"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
...
...
ui/home/LatestTxs.tsx
View file @
1a5f0e63
...
@@ -23,7 +23,7 @@ const LatestTransactions = () => {
...
@@ -23,7 +23,7 @@ const LatestTransactions = () => {
},
},
});
});
const
{
num
,
alertTex
t
}
=
useNewTxsSocket
({
type
:
'
txs_home
'
,
isLoading
:
isPlaceholderData
});
const
{
num
,
showErrorAler
t
}
=
useNewTxsSocket
({
type
:
'
txs_home
'
,
isLoading
:
isPlaceholderData
});
if
(
isError
)
{
if
(
isError
)
{
return
<
Text
mt=
{
4
}
>
No data. Please reload the page.
</
Text
>;
return
<
Text
mt=
{
4
}
>
No data. Please reload the page.
</
Text
>;
...
@@ -33,7 +33,7 @@ const LatestTransactions = () => {
...
@@ -33,7 +33,7 @@ const LatestTransactions = () => {
const
txsUrl
=
route
({
pathname
:
'
/txs
'
});
const
txsUrl
=
route
({
pathname
:
'
/txs
'
});
return
(
return
(
<>
<>
<
SocketNewItemsNotice
borderBottomRadius=
{
0
}
url=
{
txsUrl
}
num=
{
num
}
alert=
{
alertTex
t
}
isLoading=
{
isPlaceholderData
}
/>
<
SocketNewItemsNotice
borderBottomRadius=
{
0
}
url=
{
txsUrl
}
num=
{
num
}
showErrorAlert=
{
showErrorAler
t
}
isLoading=
{
isPlaceholderData
}
/>
<
Box
mb=
{
3
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
<
Box
mb=
{
3
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
{
data
.
slice
(
0
,
txsCount
).
map
(((
tx
,
index
)
=>
(
{
data
.
slice
(
0
,
txsCount
).
map
(((
tx
,
index
)
=>
(
<
LatestTxsItemMobile
<
LatestTxsItemMobile
...
...
ui/home/latestDeposits/LatestArbitrumDeposits.tsx
View file @
1a5f0e63
...
@@ -22,14 +22,14 @@ const LatestArbitrumDeposits = () => {
...
@@ -22,14 +22,14 @@ const LatestArbitrumDeposits = () => {
});
});
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketErrorAlert
,
setShowSocketErrorAlert
]
=
React
.
useState
(
false
);
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
Connection is lost. Please reload the page.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new transactions. Please reload the page.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
handleNewDepositMessage
:
SocketMessage
.
NewArbitrumDeposits
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
const
handleNewDepositMessage
:
SocketMessage
.
NewArbitrumDeposits
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
...
@@ -66,7 +66,7 @@ const LatestArbitrumDeposits = () => {
...
@@ -66,7 +66,7 @@ const LatestArbitrumDeposits = () => {
))
}
))
}
isLoading=
{
isPlaceholderData
}
isLoading=
{
isPlaceholderData
}
socketItemsNum=
{
num
}
socketItemsNum=
{
num
}
s
ocketAlert=
{
socket
Alert
}
s
howSocketErrorAlert=
{
showSocketError
Alert
}
/>
/>
);
);
}
}
...
...
ui/home/latestDeposits/LatestDeposits.tsx
View file @
1a5f0e63
...
@@ -28,7 +28,7 @@ type Props = {
...
@@ -28,7 +28,7 @@ type Props = {
isLoading
?:
boolean
;
isLoading
?:
boolean
;
items
:
Array
<
DepositsItem
>
;
items
:
Array
<
DepositsItem
>
;
socketItemsNum
:
number
;
socketItemsNum
:
number
;
s
ocketAlert
?:
string
;
s
howSocketErrorAlert
?:
boolean
;
};
};
type
ItemProps
=
{
type
ItemProps
=
{
...
@@ -151,11 +151,18 @@ const LatestDepositsItem = ({ item, isLoading }: ItemProps) => {
...
@@ -151,11 +151,18 @@ const LatestDepositsItem = ({ item, isLoading }: ItemProps) => {
);
);
};
};
const
LatestDeposits
=
({
isLoading
,
items
,
s
ocket
Alert
,
socketItemsNum
}:
Props
)
=>
{
const
LatestDeposits
=
({
isLoading
,
items
,
s
howSocketError
Alert
,
socketItemsNum
}:
Props
)
=>
{
const
depositsUrl
=
route
({
pathname
:
'
/deposits
'
});
const
depositsUrl
=
route
({
pathname
:
'
/deposits
'
});
return
(
return
(
<>
<>
<
SocketNewItemsNotice
borderBottomRadius=
{
0
}
url=
{
depositsUrl
}
num=
{
socketItemsNum
}
alert=
{
socketAlert
}
type=
"deposit"
isLoading=
{
isLoading
}
/>
<
SocketNewItemsNotice
borderBottomRadius=
{
0
}
url=
{
depositsUrl
}
num=
{
socketItemsNum
}
showErrorAlert=
{
showSocketErrorAlert
}
type=
"deposit"
isLoading=
{
isLoading
}
/>
<
Box
mb=
{
{
base
:
3
,
lg
:
4
}
}
>
<
Box
mb=
{
{
base
:
3
,
lg
:
4
}
}
>
{
items
.
map
(((
item
,
index
)
=>
(
{
items
.
map
(((
item
,
index
)
=>
(
<
LatestDepositsItem
<
LatestDepositsItem
...
...
ui/home/latestDeposits/LatestOptimisticDeposits.tsx
View file @
1a5f0e63
...
@@ -22,14 +22,14 @@ const LatestOptimisticDeposits = () => {
...
@@ -22,14 +22,14 @@ const LatestOptimisticDeposits = () => {
});
});
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketErrorAlert
,
setShowSocketErrorAlert
]
=
React
.
useState
(
false
);
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
Connection is lost. Please reload the page.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new transactions. Please reload the page.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
handleNewDepositMessage
:
SocketMessage
.
NewOptimisticDeposits
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
const
handleNewDepositMessage
:
SocketMessage
.
NewOptimisticDeposits
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
...
@@ -61,7 +61,7 @@ const LatestOptimisticDeposits = () => {
...
@@ -61,7 +61,7 @@ const LatestOptimisticDeposits = () => {
))
}
))
}
isLoading=
{
isPlaceholderData
}
isLoading=
{
isPlaceholderData
}
socketItemsNum=
{
num
}
socketItemsNum=
{
num
}
s
ocketAlert=
{
socket
Alert
}
s
howSocketErrorAlert=
{
showSocketError
Alert
}
/>
/>
);
);
}
}
...
...
ui/pages/__screenshots__/Blocks.pw.tsx_default_socket-error-1.png
View replaced file @
a2b9c418
View file @
1a5f0e63
46.2 KB
|
W:
|
H:
45 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/shared/SocketNewItemsNotice.pw.tsx
View file @
1a5f0e63
...
@@ -17,7 +17,7 @@ test('2 new items in validated txs list +@dark-mode', async({ render }) => {
...
@@ -17,7 +17,7 @@ test('2 new items in validated txs list +@dark-mode', async({ render }) => {
});
});
test
(
'
connection loss
'
,
async
({
render
})
=>
{
test
(
'
connection loss
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
SocketNewItemsNotice
url=
"/"
alert=
"Connection is lost. Please reload the page."
/>,
{
hooksConfig
});
const
component
=
await
render
(<
SocketNewItemsNotice
url=
"/"
showErrorAlert
/>,
{
hooksConfig
});
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
...
...
ui/shared/SocketNewItemsNotice.tsx
View file @
1a5f0e63
...
@@ -15,19 +15,19 @@ interface Props {
...
@@ -15,19 +15,19 @@ interface Props {
children
?:
(
props
:
InjectedProps
)
=>
React
.
JSX
.
Element
;
children
?:
(
props
:
InjectedProps
)
=>
React
.
JSX
.
Element
;
className
?:
string
;
className
?:
string
;
url
?:
string
;
url
?:
string
;
alert
?:
string
;
showErrorAlert
?:
boolean
;
num
?:
number
;
num
?:
number
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
}
}
const
SocketNewItemsNotice
=
chakra
(({
children
,
className
,
url
,
num
,
a
lert
,
type
=
'
transaction
'
,
isLoading
}:
Props
)
=>
{
const
SocketNewItemsNotice
=
chakra
(({
children
,
className
,
url
,
num
,
showErrorA
lert
,
type
=
'
transaction
'
,
isLoading
}:
Props
)
=>
{
const
handleLinkClick
=
React
.
useCallback
(()
=>
{
const
handleLinkClick
=
React
.
useCallback
(()
=>
{
window
.
location
.
reload
();
window
.
location
.
reload
();
},
[]);
},
[]);
const
alertContent
=
(()
=>
{
const
alertContent
=
(()
=>
{
if
(
a
lert
)
{
if
(
showErrorA
lert
)
{
return
alert
;
return
'
Live updates temporarily delayed
'
;
}
}
let
name
;
let
name
;
...
...
ui/shared/TokenTransfer/TokenTransferTable.tsx
View file @
1a5f0e63
...
@@ -15,7 +15,7 @@ interface Props {
...
@@ -15,7 +15,7 @@ interface Props {
top
:
number
;
top
:
number
;
enableTimeIncrement
?:
boolean
;
enableTimeIncrement
?:
boolean
;
showSocketInfo
?:
boolean
;
showSocketInfo
?:
boolean
;
s
ocketInfoAlert
?:
string
;
s
howSocketErrorAlert
?:
boolean
;
socketInfoNum
?:
number
;
socketInfoNum
?:
number
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
}
}
...
@@ -27,7 +27,7 @@ const TokenTransferTable = ({
...
@@ -27,7 +27,7 @@ const TokenTransferTable = ({
top
,
top
,
enableTimeIncrement
,
enableTimeIncrement
,
showSocketInfo
,
showSocketInfo
,
s
ocketInfo
Alert
,
s
howSocketError
Alert
,
socketInfoNum
,
socketInfoNum
,
isLoading
,
isLoading
,
}:
Props
)
=>
{
}:
Props
)
=>
{
...
@@ -53,7 +53,7 @@ const TokenTransferTable = ({
...
@@ -53,7 +53,7 @@ const TokenTransferTable = ({
<
TableBody
>
<
TableBody
>
{
showSocketInfo
&&
(
{
showSocketInfo
&&
(
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
alert=
{
socketInfo
Alert
}
showErrorAlert=
{
showSocketError
Alert
}
num=
{
socketInfoNum
}
num=
{
socketInfoNum
}
type=
"token_transfer"
type=
"token_transfer"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
...
...
ui/shared/__screenshots__/SocketNewItemsNotice.pw.tsx_default_connection-loss-1.png
View replaced file @
a2b9c418
View file @
1a5f0e63
2.74 KB
|
W:
|
H:
2.36 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/token/TokenTransfer/TokenTransfer.tsx
View file @
1a5f0e63
...
@@ -40,18 +40,18 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
...
@@ -40,18 +40,18 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
const
{
data
:
token
,
isPlaceholderData
:
isTokenPlaceholderData
,
isError
:
isTokenError
}
=
tokenQuery
;
const
{
data
:
token
,
isPlaceholderData
:
isTokenPlaceholderData
,
isError
:
isTokenError
}
=
tokenQuery
;
const
[
newItemsCount
,
setNewItemsCount
]
=
useGradualIncrement
(
0
);
const
[
newItemsCount
,
setNewItemsCount
]
=
useGradualIncrement
(
0
);
const
[
s
ocketAlert
,
setSocketAlert
]
=
React
.
useState
(
''
);
const
[
s
howSocketErrorAlert
,
setShowSocketErrorAlert
]
=
React
.
useState
(
false
);
const
handleNewTransfersMessage
:
SocketMessage
.
TokenTransfers
[
'
handler
'
]
=
(
payload
)
=>
{
const
handleNewTransfersMessage
:
SocketMessage
.
TokenTransfers
[
'
handler
'
]
=
(
payload
)
=>
{
setNewItemsCount
(
payload
.
token_transfer
);
setNewItemsCount
(
payload
.
token_transfer
);
};
};
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
Connection is lost. Please refresh the page to load new token transfers.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
setS
ocketAlert
(
'
An error has occurred while fetching new token transfers. Please refresh the page.
'
);
setS
howSocketErrorAlert
(
true
);
},
[]);
},
[]);
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
...
@@ -79,7 +79,7 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
...
@@ -79,7 +79,7 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
data={ data?.items }
data={ data?.items }
top={ tabsHeight }
top={ tabsHeight }
showSocketInfo={ pagination.page === 1 }
showSocketInfo={ pagination.page === 1 }
s
ocketInfoAlert={ socket
Alert }
s
howSocketErrorAlert={ showSocketError
Alert }
socketInfoNum={ newItemsCount }
socketInfoNum={ newItemsCount }
tokenId={ tokenId }
tokenId={ tokenId }
token={ token }
token={ token }
...
@@ -91,7 +91,7 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
...
@@ -91,7 +91,7 @@ const TokenTransfer = ({ transfersQuery, tokenId, tokenQuery, tabsHeight = TABS_
{ pagination.page === 1 && (
{ pagination.page === 1 && (
<SocketNewItemsNotice.Mobile
<SocketNewItemsNotice.Mobile
num={ newItemsCount }
num={ newItemsCount }
alert={ socket
Alert }
showErrorAlert={ showSocketError
Alert }
type="token_transfer"
type="token_transfer"
isLoading={ isLoading }
isLoading={ isLoading }
/>
/>
...
...
ui/token/TokenTransfer/TokenTransferTable.tsx
View file @
1a5f0e63
...
@@ -15,7 +15,7 @@ interface Props {
...
@@ -15,7 +15,7 @@ interface Props {
data
:
Array
<
TokenTransfer
>
;
data
:
Array
<
TokenTransfer
>
;
top
:
number
;
top
:
number
;
showSocketInfo
:
boolean
;
showSocketInfo
:
boolean
;
s
ocketInfoAlert
?:
string
;
s
howSocketErrorAlert
?:
boolean
;
socketInfoNum
?:
number
;
socketInfoNum
?:
number
;
tokenId
?:
string
;
tokenId
?:
string
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
...
@@ -23,7 +23,7 @@ interface Props {
...
@@ -23,7 +23,7 @@ interface Props {
instance
?:
TokenInstance
;
instance
?:
TokenInstance
;
}
}
const
TokenTransferTable
=
({
data
,
top
,
showSocketInfo
,
s
ocketInfo
Alert
,
socketInfoNum
,
tokenId
,
isLoading
,
token
,
instance
}:
Props
)
=>
{
const
TokenTransferTable
=
({
data
,
top
,
showSocketInfo
,
s
howSocketError
Alert
,
socketInfoNum
,
tokenId
,
isLoading
,
token
,
instance
}:
Props
)
=>
{
const
tokenType
=
token
.
type
;
const
tokenType
=
token
.
type
;
...
@@ -51,7 +51,7 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket
...
@@ -51,7 +51,7 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket
<
TableBody
>
<
TableBody
>
{
showSocketInfo
&&
(
{
showSocketInfo
&&
(
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
alert=
{
socketInfo
Alert
}
showErrorAlert=
{
showSocketError
Alert
}
num=
{
socketInfoNum
}
num=
{
socketInfoNum
}
type=
"token_transfer"
type=
"token_transfer"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
...
...
ui/txs/socket/TxsSocketNoticeTypeAddress.tsx
View file @
1a5f0e63
...
@@ -12,7 +12,7 @@ interface Props {
...
@@ -12,7 +12,7 @@ interface Props {
}
}
const
TxsSocketNoticeTypeAddress
=
({
place
,
isLoading
}:
Props
)
=>
{
const
TxsSocketNoticeTypeAddress
=
({
place
,
isLoading
}:
Props
)
=>
{
const
{
num
,
alertTex
t
}
=
useTxsSocketTypeAddress
({
isLoading
});
const
{
num
,
showErrorAler
t
}
=
useTxsSocketTypeAddress
({
isLoading
});
if
(
num
===
undefined
)
{
if
(
num
===
undefined
)
{
return
null
;
return
null
;
...
@@ -21,7 +21,7 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
...
@@ -21,7 +21,7 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
if
(
place
===
'
table
'
)
{
if
(
place
===
'
table
'
)
{
return
(
return
(
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
alert=
{
alertTex
t
}
showErrorAlert=
{
showErrorAler
t
}
num=
{
num
}
num=
{
num
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
...
@@ -32,7 +32,7 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
...
@@ -32,7 +32,7 @@ const TxsSocketNoticeTypeAddress = ({ place, isLoading }: Props) => {
return
(
return
(
<
SocketNewItemsNotice
.
Mobile
<
SocketNewItemsNotice
.
Mobile
num=
{
num
}
num=
{
num
}
alert=
{
alertTex
t
}
showErrorAlert=
{
showErrorAler
t
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
);
);
...
...
ui/txs/socket/TxsSocketNoticeTypeAll.tsx
View file @
1a5f0e63
...
@@ -17,7 +17,7 @@ interface Props {
...
@@ -17,7 +17,7 @@ interface Props {
const
TxsSocketNoticeTypeAll
=
({
type
,
place
,
isLoading
}:
Props
)
=>
{
const
TxsSocketNoticeTypeAll
=
({
type
,
place
,
isLoading
}:
Props
)
=>
{
const
multichainContext
=
useMultichainContext
();
const
multichainContext
=
useMultichainContext
();
const
{
num
,
alertTex
t
}
=
useNewTxsSocketTypeAll
({
type
,
isLoading
});
const
{
num
,
showErrorAler
t
}
=
useNewTxsSocketTypeAll
({
type
,
isLoading
});
if
(
num
===
undefined
)
{
if
(
num
===
undefined
)
{
return
null
;
return
null
;
...
@@ -36,7 +36,7 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
...
@@ -36,7 +36,7 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
if
(
place
===
'
table
'
)
{
if
(
place
===
'
table
'
)
{
return
(
return
(
<
SocketNewItemsNotice
.
Desktop
<
SocketNewItemsNotice
.
Desktop
alert=
{
alertTex
t
}
showErrorAlert=
{
showErrorAler
t
}
num=
{
num
}
num=
{
num
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
url=
{
url
}
url=
{
url
}
...
@@ -48,7 +48,7 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
...
@@ -48,7 +48,7 @@ const TxsSocketNoticeTypeAll = ({ type, place, isLoading }: Props) => {
return
(
return
(
<
SocketNewItemsNotice
.
Mobile
<
SocketNewItemsNotice
.
Mobile
num=
{
num
}
num=
{
num
}
alert=
{
alertTex
t
}
showErrorAlert=
{
showErrorAler
t
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
url=
{
url
}
url=
{
url
}
/>
/>
...
...
ui/txs/socket/useTxsSocketTypeAddress.tsx
View file @
1a5f0e63
...
@@ -38,7 +38,7 @@ interface Params {
...
@@ -38,7 +38,7 @@ interface Params {
}
}
export
default
function
useTxsSocketTypeAddress
({
isLoading
}:
Params
)
{
export
default
function
useTxsSocketTypeAddress
({
isLoading
}:
Params
)
{
const
[
alertText
,
setAlertText
]
=
React
.
useState
(
''
);
const
[
showErrorAlert
,
setShowErrorAlert
]
=
React
.
useState
(
false
);
const
[
num
,
setNum
]
=
React
.
useState
(
0
);
const
[
num
,
setNum
]
=
React
.
useState
(
0
);
const
router
=
useRouter
();
const
router
=
useRouter
();
...
@@ -51,12 +51,12 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
...
@@ -51,12 +51,12 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
const
{
chain
}
=
useMultichainContext
()
||
{};
const
{
chain
}
=
useMultichainContext
()
||
{};
const
handleNewSocketMessage
:
SocketMessage
.
AddressTxs
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
const
handleNewSocketMessage
:
SocketMessage
.
AddressTxs
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
setAlertText
(
''
);
const
queryKey
=
getResourceKey
(
'
general:address_txs
'
,
{
const
queryKey
=
getResourceKey
(
'
general:address_txs
'
,
{
pathParams
:
{
hash
:
currentAddress
},
pathParams
:
{
hash
:
currentAddress
},
queryParams
:
filterValue
?
{
filter
:
filterValue
}
:
undefined
,
queryParams
:
filterValue
?
{
filter
:
filterValue
}
:
undefined
,
chainSlug
:
chain
?.
slug
,
chainSlug
:
chain
?.
slug
,
});
});
setShowErrorAlert
(
false
);
queryClient
.
setQueryData
(
queryClient
.
setQueryData
(
queryKey
,
queryKey
,
...
@@ -100,11 +100,11 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
...
@@ -100,11 +100,11 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
},
[
currentAddress
,
filterValue
,
queryClient
,
sort
,
chain
?.
slug
]);
},
[
currentAddress
,
filterValue
,
queryClient
,
sort
,
chain
?.
slug
]);
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
set
AlertText
(
'
Connection is lost. Please refresh the page to load new transactions.
'
);
set
ShowErrorAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
set
AlertText
(
'
An error has occurred while fetching new transactions. Please refresh the page.
'
);
set
ShowErrorAlert
(
true
);
},
[]);
},
[]);
const
isDisabled
=
Boolean
((
page
&&
page
!==
'
1
'
)
||
isLoading
);
const
isDisabled
=
Boolean
((
page
&&
page
!==
'
1
'
)
||
isLoading
);
...
@@ -132,5 +132,5 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
...
@@ -132,5 +132,5 @@ export default function useTxsSocketTypeAddress({ isLoading }: Params) {
return { };
return { };
}
}
return { num,
alertTex
t };
return { num,
showErrorAler
t };
}
}
ui/txs/socket/useTxsSocketTypeAll.tsx
View file @
1a5f0e63
...
@@ -45,7 +45,7 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
...
@@ -45,7 +45,7 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
const
page
=
getQueryParamString
(
router
.
query
.
page
);
const
page
=
getQueryParamString
(
router
.
query
.
page
);
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
num
,
setNum
]
=
useGradualIncrement
(
0
);
const
[
alertText
,
setAlertText
]
=
React
.
useState
(
''
);
const
[
showErrorAlert
,
setShowErrorAlert
]
=
React
.
useState
(
false
);
const
{
topic
,
event
}
=
getSocketParams
(
type
,
page
);
const
{
topic
,
event
}
=
getSocketParams
(
type
,
page
);
...
@@ -59,11 +59,11 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
...
@@ -59,11 +59,11 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
},
[
setNum
]);
},
[
setNum
]);
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
const
handleSocketClose
=
React
.
useCallback
(()
=>
{
set
AlertText
(
'
Connection is lost. Please reload the page.
'
);
set
ShowErrorAlert
(
true
);
},
[]);
},
[]);
const
handleSocketError
=
React
.
useCallback
(()
=>
{
const
handleSocketError
=
React
.
useCallback
(()
=>
{
set
AlertText
(
'
An error has occurred while fetching new transactions. Please reload the page.
'
);
set
ShowErrorAlert
(
true
);
},
[]);
},
[]);
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
...
@@ -83,5 +83,5 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
...
@@ -83,5 +83,5 @@ export default function useNewTxsSocketTypeAll({ type, isLoading }: Params) {
return
{
};
return
{
};
}
}
return
{
num
,
alertTex
t
};
return
{
num
,
showErrorAler
t
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment