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
53197e00
Commit
53197e00
authored
Jan 05, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add conditions for tabs
parent
288fa1ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
21 deletions
+49
-21
address.ts
types/api/address.ts
+11
-1
Address.tsx
ui/pages/Address.tsx
+38
-20
No files found.
types/api/address.ts
View file @
53197e00
...
@@ -12,8 +12,18 @@ export interface Address {
...
@@ -12,8 +12,18 @@ export interface Address {
creator_address_hash
:
string
|
null
;
creator_address_hash
:
string
|
null
;
creation_tx_hash
:
string
|
null
;
creation_tx_hash
:
string
|
null
;
exchange_rate
:
string
|
null
;
exchange_rate
:
string
|
null
;
hash
:
string
;
has_custom_methods_read
:
boolean
;
has_custom_methods_write
:
boolean
;
has_decompiled_code
:
boolean
;
has_logs
:
boolean
;
has_methods_read
:
boolean
;
has_methods_read_proxy
:
boolean
;
has_methods_write
:
boolean
;
has_methods_write_proxy
:
boolean
;
has_token_transfers
:
boolean
;
has_tokens
:
boolean
;
has_validated_blocks
:
boolean
;
has_validated_blocks
:
boolean
;
hash
:
string
;
implementation_address
:
string
|
null
;
implementation_address
:
string
|
null
;
implementation_name
:
string
|
null
;
implementation_name
:
string
|
null
;
is_contract
:
boolean
;
is_contract
:
boolean
;
...
...
ui/pages/Address.tsx
View file @
53197e00
...
@@ -21,15 +21,6 @@ import PageTitle from 'ui/shared/Page/PageTitle';
...
@@ -21,15 +21,6 @@ import PageTitle from 'ui/shared/Page/PageTitle';
import
RoutedTabs
from
'
ui/shared/RoutedTabs/RoutedTabs
'
;
import
RoutedTabs
from
'
ui/shared/RoutedTabs/RoutedTabs
'
;
import
SkeletonTabs
from
'
ui/shared/skeletons/SkeletonTabs
'
;
import
SkeletonTabs
from
'
ui/shared/skeletons/SkeletonTabs
'
;
const
CONTRACT_TABS
=
[
{
id
:
'
contact_code
'
,
title
:
'
Code
'
,
component
:
<
ContractCode
/>
},
{
id
:
'
contact_decompiled_code
'
,
title
:
'
Decompiled code
'
,
component
:
<
div
>
Decompiled code
</
div
>
},
{
id
:
'
read_contract
'
,
title
:
'
Read contract
'
,
component
:
<
div
>
Read contract
</
div
>
},
{
id
:
'
read_proxy
'
,
title
:
'
Read proxy
'
,
component
:
<
div
>
Read proxy
</
div
>
},
{
id
:
'
write_contract
'
,
title
:
'
Write contract
'
,
component
:
<
div
>
Write contract
</
div
>
},
{
id
:
'
write_proxy
'
,
title
:
'
Write proxy
'
,
component
:
<
div
>
Write proxy
</
div
>
},
];
const
AddressPageContent
=
()
=>
{
const
AddressPageContent
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
...
@@ -44,27 +35,54 @@ const AddressPageContent = () => {
...
@@ -44,27 +35,54 @@ const AddressPageContent = () => {
...(
addressQuery
.
data
?.
watchlist_names
||
[]),
...(
addressQuery
.
data
?.
watchlist_names
||
[]),
].
map
((
tag
)
=>
<
Tag
key=
{
tag
.
label
}
>
{
tag
.
display_name
}
</
Tag
>);
].
map
((
tag
)
=>
<
Tag
key=
{
tag
.
label
}
>
{
tag
.
display_name
}
</
Tag
>);
const
isContract
=
addressQuery
.
data
?.
is_contract
;
const
contractTabs
=
React
.
useMemo
(()
=>
{
return
[
{
id
:
'
contact_code
'
,
title
:
'
Code
'
,
component
:
<
ContractCode
/>
},
addressQuery
.
data
?.
has_decompiled_code
?
{
id
:
'
contact_decompiled_code
'
,
title
:
'
Decompiled code
'
,
component
:
<
div
>
Decompiled code
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_methods_read
?
{
id
:
'
read_contract
'
,
title
:
'
Read contract
'
,
component
:
<
div
>
Read contract
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_methods_read_proxy
?
{
id
:
'
read_proxy
'
,
title
:
'
Read proxy
'
,
component
:
<
div
>
Read proxy
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_custom_methods_read
?
{
id
:
'
read_custom_methods
'
,
title
:
'
Read custom methods
'
,
component
:
<
div
>
Read custom methods
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_methods_write
?
{
id
:
'
write_contract
'
,
title
:
'
Write contract
'
,
component
:
<
div
>
Write contract
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_methods_write_proxy
?
{
id
:
'
write_proxy
'
,
title
:
'
Write proxy
'
,
component
:
<
div
>
Write proxy
</
div
>
}
:
undefined
,
addressQuery
.
data
?.
has_custom_methods_write
?
{
id
:
'
write_custom_methods
'
,
title
:
'
Write custom methods
'
,
component
:
<
div
>
Write custom methods
</
div
>
}
:
undefined
,
].
filter
(
notEmpty
);
},
[
addressQuery
.
data
]);
const
tabs
:
Array
<
RoutedTab
>
=
React
.
useMemo
(()
=>
{
const
tabs
:
Array
<
RoutedTab
>
=
React
.
useMemo
(()
=>
{
return
[
return
[
{
id
:
'
txs
'
,
title
:
'
Transactions
'
,
component
:
<
AddressTxs
/>
},
{
id
:
'
txs
'
,
title
:
'
Transactions
'
,
component
:
<
AddressTxs
/>
},
{
id
:
'
token_transfers
'
,
title
:
'
Token transfers
'
,
component
:
<
AddressTokenTransfers
/>
},
addressQuery
.
data
?.
has_token_transfers
?
{
id
:
'
tokens
'
,
title
:
'
Tokens
'
,
component
:
null
},
{
id
:
'
token_transfers
'
,
title
:
'
Token transfers
'
,
component
:
<
AddressTokenTransfers
/>
}
:
undefined
,
addressQuery
.
data
?.
has_tokens
?
{
id
:
'
tokens
'
,
title
:
'
Tokens
'
,
component
:
null
}
:
undefined
,
{
id
:
'
internal_txns
'
,
title
:
'
Internal txns
'
,
component
:
<
AddressInternalTxs
/>
},
{
id
:
'
internal_txns
'
,
title
:
'
Internal txns
'
,
component
:
<
AddressInternalTxs
/>
},
{
id
:
'
coin_balance_history
'
,
title
:
'
Coin balance history
'
,
component
:
<
AddressCoinBalance
/>
},
{
id
:
'
coin_balance_history
'
,
title
:
'
Coin balance history
'
,
component
:
<
AddressCoinBalance
/>
},
// temporary show this tab in all address
addressQuery
.
data
?.
has_validated_blocks
?
// later api will return info about available tabs
{
id
:
'
blocks_validated
'
,
title
:
'
Blocks validated
'
,
component
:
<
AddressBlocksValidated
/>
}
:
{
id
:
'
blocks_validated
'
,
title
:
'
Blocks validated
'
,
component
:
<
AddressBlocksValidated
/>
}
,
undefined
,
isContract
?
{
id
:
'
logs
'
,
title
:
'
Logs
'
,
component
:
<
AddressLogs
/>
}
:
undefined
,
addressQuery
.
data
?.
has_logs
?
{
id
:
'
logs
'
,
title
:
'
Logs
'
,
component
:
<
AddressLogs
/>
}
:
undefined
,
isC
ontract
?
{
addressQuery
.
data
?.
is_c
ontract
?
{
id
:
'
contract
'
,
id
:
'
contract
'
,
title
:
'
Contract
'
,
title
:
'
Contract
'
,
component
:
<
AddressContract
tabs=
{
CONTRACT_TABS
}
/>,
component
:
<
AddressContract
tabs=
{
contractTabs
}
/>,
subTabs
:
CONTRACT_TABS
,
subTabs
:
contractTabs
,
}
:
undefined
,
}
:
undefined
,
].
filter
(
notEmpty
);
].
filter
(
notEmpty
);
},
[
isContract
]);
},
[
addressQuery
.
data
,
contractTabs
]);
const
tagsNode
=
tags
.
length
>
0
?
<
Flex
columnGap=
{
2
}
>
{
tags
}
</
Flex
>
:
null
;
const
tagsNode
=
tags
.
length
>
0
?
<
Flex
columnGap=
{
2
}
>
{
tags
}
</
Flex
>
:
null
;
...
...
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