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
43ae60b4
Commit
43ae60b4
authored
Nov 04, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link to transaction tab
parent
f11218a1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
32 deletions
+73
-32
link.ts
lib/link/link.ts
+1
-1
DetailsInfoItem.tsx
ui/shared/DetailsInfoItem.tsx
+2
-2
TxDetails.tsx
ui/tx/TxDetails.tsx
+2
-24
TxDetailsTokenTransfer.tsx
ui/tx/details/TxDetailsTokenTransfer.tsx
+2
-2
TxDetailsTokenTransferList.tsx
ui/tx/details/TxDetailsTokenTransferList.tsx
+3
-3
TxDetailsTokenTransfers.tsx
ui/tx/details/TxDetailsTokenTransfers.tsx
+63
-0
No files found.
lib/link/link.ts
View file @
43ae60b4
...
...
@@ -32,5 +32,5 @@ export default function link(
url
.
searchParams
.
append
(
key
,
value
);
});
return
url
.
pathname
;
return
url
.
toString
()
;
}
ui/shared/DetailsInfoItem.tsx
View file @
43ae60b4
...
...
@@ -4,8 +4,8 @@ import React from 'react';
import
infoIcon
from
'
icons/info.svg
'
;
interface
Props
extends
HTMLChakraProps
<
'
div
'
>
{
title
:
string
;
interface
Props
extends
Omit
<
HTMLChakraProps
<
'
div
'
>
,
'
title
'
>
{
title
:
React
.
ReactNode
;
hint
:
string
;
children
:
React
.
ReactNode
;
}
...
...
ui/tx/TxDetails.tsx
View file @
43ae60b4
...
...
@@ -25,19 +25,12 @@ import TextSeparator from 'ui/shared/TextSeparator';
import
TxStatus
from
'
ui/shared/TxStatus
'
;
import
Utilization
from
'
ui/shared/Utilization
'
;
import
TxDetailsSkeleton
from
'
ui/tx/details/TxDetailsSkeleton
'
;
import
TxDetailsTokenTransfers
from
'
ui/tx/details/TxDetailsTokenTransfers
'
;
import
TxRevertReason
from
'
ui/tx/details/TxRevertReason
'
;
import
TokenTransferList
from
'
ui/tx/TokenTransferList
'
;
import
TxDecodedInputData
from
'
ui/tx/TxDecodedInputData
'
;
import
TxSocketAlert
from
'
ui/tx/TxSocketAlert
'
;
import
useFetchTxInfo
from
'
ui/tx/useFetchTxInfo
'
;
const
TOKEN_TRANSFERS
=
[
{
title
:
'
Tokens Transferred
'
,
hint
:
'
List of tokens transferred in the transaction.
'
,
type
:
'
token_transfer
'
},
{
title
:
'
Tokens Minted
'
,
hint
:
'
List of tokens minted in the transaction.
'
,
type
:
'
token_minting
'
},
{
title
:
'
Tokens Burnt
'
,
hint
:
'
List of tokens burnt in the transaction.
'
,
type
:
'
token_burning
'
},
{
title
:
'
Tokens Created
'
,
hint
:
'
List of tokens created in the transaction.
'
,
type
:
'
token_spawning
'
},
];
const
TxDetails
=
()
=>
{
const
{
data
,
isLoading
,
isError
,
socketStatus
}
=
useFetchTxInfo
();
...
...
@@ -181,22 +174,7 @@ const TxDetails = () => {
</
Flex
>
)
}
</
DetailsInfoItem
>
{
TOKEN_TRANSFERS
.
map
(({
title
,
hint
,
type
})
=>
{
const
items
=
data
.
token_transfers
?.
filter
((
token
)
=>
token
.
type
===
type
)
||
[];
if
(
items
.
length
===
0
)
{
return
null
;
}
return
(
<
DetailsInfoItem
key=
{
type
}
title=
{
title
}
hint=
{
hint
}
position=
"relative"
>
<
TokenTransferList
items=
{
items
}
/>
</
DetailsInfoItem
>
);
})
}
{
data
.
token_transfers
&&
<
TxDetailsTokenTransfers
data=
{
data
.
token_transfers
}
txHash=
{
data
.
hash
}
/>
}
<
GridItem
colSpan=
{
{
base
:
undefined
,
lg
:
2
}
}
mt=
{
{
base
:
3
,
lg
:
8
}
}
/>
<
DetailsInfoItem
...
...
ui/tx/TokenTransfer.tsx
→
ui/tx/
details/TxDetails
TokenTransfer.tsx
View file @
43ae60b4
...
...
@@ -12,7 +12,7 @@ import NftTokenTransferSnippet from 'ui/tx/NftTokenTransferSnippet';
type
Props
=
TTokenTransfer
;
const
TokenTransfer
=
({
token
,
total
,
to
,
from
}:
Props
)
=>
{
const
T
xDetailsT
okenTransfer
=
({
token
,
total
,
to
,
from
}:
Props
)
=>
{
const
isColumnLayout
=
token
.
type
===
'
ERC-1155
'
&&
Array
.
isArray
(
total
);
const
tokenSnippet
=
<
TokenSnippet
symbol=
{
token
.
symbol
}
hash=
{
token
.
address
}
name=
{
token
.
name
}
ml=
{
3
}
/>;
...
...
@@ -79,4 +79,4 @@ const TokenTransfer = ({ token, total, to, from }: Props) => {
);
};
export
default
React
.
memo
(
TokenTransfer
);
export
default
React
.
memo
(
T
xDetailsT
okenTransfer
);
ui/tx/TokenTransferList.tsx
→
ui/tx/
details/TxDetails
TokenTransferList.tsx
View file @
43ae60b4
...
...
@@ -3,7 +3,7 @@ import React from 'react';
import
type
{
TokenTransfer
as
TTokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
TokenTransfer
from
'
ui/tx/
TokenTransfer
'
;
import
TokenTransfer
from
'
./TxDetails
TokenTransfer
'
;
interface
Props
{
items
:
Array
<
TTokenTransfer
>
;
...
...
@@ -25,7 +25,7 @@ function getItemsNum(items: Array<TTokenTransfer>) {
return
nonErc1155items
+
erc1155items
;
}
const
TokenTransferList
=
({
items
}:
Props
)
=>
{
const
T
xDetailsT
okenTransferList
=
({
items
}:
Props
)
=>
{
const
itemsNum
=
getItemsNum
(
items
);
const
hasScroll
=
itemsNum
>
5
;
...
...
@@ -57,4 +57,4 @@ const TokenTransferList = ({ items }: Props) => {
);
};
export
default
React
.
memo
(
TokenTransferList
);
export
default
React
.
memo
(
T
xDetailsT
okenTransferList
);
ui/tx/details/TxDetailsTokenTransfers.tsx
0 → 100644
View file @
43ae60b4
import
{
Text
,
Icon
,
Link
,
GridItem
,
Show
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
React
from
'
react
'
;
import
type
{
TokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
tokenIcon
from
'
icons/token.svg
'
;
import
link
from
'
lib/link/link
'
;
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
TxDetailsTokenTransferList
from
'
./TxDetailsTokenTransferList
'
;
interface
Props
{
data
:
Array
<
TokenTransfer
>
;
txHash
:
string
;
}
const
TOKEN_TRANSFERS
=
[
{
title
:
'
Tokens Transferred
'
,
hint
:
'
List of tokens transferred in the transaction.
'
,
type
:
'
token_transfer
'
},
{
title
:
'
Tokens Minted
'
,
hint
:
'
List of tokens minted in the transaction.
'
,
type
:
'
token_minting
'
},
{
title
:
'
Tokens Burnt
'
,
hint
:
'
List of tokens burnt in the transaction.
'
,
type
:
'
token_burning
'
},
{
title
:
'
Tokens Created
'
,
hint
:
'
List of tokens created in the transaction.
'
,
type
:
'
token_spawning
'
},
];
const
TxDetailsTokenTransfers
=
({
data
,
txHash
}:
Props
)
=>
{
const
viewAllUrl
=
link
(
'
tx
'
,
{
id
:
txHash
},
{
tab
:
'
token_transfers
'
});
return
(
<>
{
TOKEN_TRANSFERS
.
map
(({
title
,
hint
,
type
})
=>
{
const
items
=
data
?.
filter
((
token
)
=>
token
.
type
===
type
)
||
[];
if
(
items
.
length
===
0
)
{
return
null
;
}
return
(
<
DetailsInfoItem
key=
{
type
}
title=
{
(
<>
<
Text
as=
"span"
>
{
title
}
</
Text
>
{
items
.
length
>
1
&&
<
Text
as=
"span"
whiteSpace=
"pre"
variant=
"secondary"
>
(
{
items
.
length
}
)
</
Text
>
}
</>
)
}
hint=
{
hint
}
position=
"relative"
>
<
TxDetailsTokenTransferList
items=
{
items
}
/>
</
DetailsInfoItem
>
);
})
}
<
Show
above=
"lg"
><
GridItem
></
GridItem
></
Show
>
<
GridItem
fontSize=
"sm"
alignItems=
"center"
display=
"inline-flex"
pl=
{
{
base
:
'
28px
'
,
lg
:
0
}
}
>
<
Icon
as=
{
tokenIcon
}
boxSize=
{
6
}
/>
<
NextLink
href=
{
viewAllUrl
}
passHref
>
<
Link
>
View all
</
Link
>
</
NextLink
>
<
Text
variant=
"secondary"
as=
"span"
whiteSpace=
"pre"
>
(15)
</
Text
>
</
GridItem
>
</>
);
};
export
default
React
.
memo
(
TxDetailsTokenTransfers
);
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