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
45f8d4af
Commit
45f8d4af
authored
Sep 21, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base implementation
parent
a35ccaa3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
12 deletions
+115
-12
txInternal.ts
data/txInternal.ts
+5
-3
tx.ts
types/api/tx.ts
+1
-0
FilterButton.tsx
ui/shared/FilterButton.tsx
+36
-0
TxInternals.tsx
ui/tx/TxInternals.tsx
+18
-9
TxInternalsFilter.tsx
ui/tx/internals/TxInternalsFilter.tsx
+55
-0
No files found.
data/txInternal.ts
View file @
45f8d4af
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
export
const
data
=
[
export
const
data
=
[
{
{
id
:
1
,
id
:
1
,
type
:
'
call
'
,
type
:
'
call
'
as
TxInternalsType
,
status
:
'
success
'
as
const
,
status
:
'
success
'
as
const
,
from
:
'
0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01
'
,
from
:
'
0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01
'
,
to
:
'
0xF7A558692dFB5F456e291791da7FAE8Dd046574e
'
,
to
:
'
0xF7A558692dFB5F456e291791da7FAE8Dd046574e
'
,
...
@@ -10,7 +12,7 @@ export const data = [
...
@@ -10,7 +12,7 @@ export const data = [
},
},
{
{
id
:
2
,
id
:
2
,
type
:
'
delegate
call
'
,
type
:
'
delegate
_call
'
as
TxInternalsType
,
status
:
'
error
'
as
const
,
status
:
'
error
'
as
const
,
from
:
'
0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45
'
,
from
:
'
0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45
'
,
to
:
'
0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01
'
,
to
:
'
0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01
'
,
...
@@ -19,7 +21,7 @@ export const data = [
...
@@ -19,7 +21,7 @@ export const data = [
},
},
{
{
id
:
3
,
id
:
3
,
type
:
'
static
call
'
,
type
:
'
static
_call
'
as
TxInternalsType
,
status
:
'
success
'
as
const
,
status
:
'
success
'
as
const
,
from
:
'
0x97Aa2EfcF35c0f4c9AaDDCa8c2330fa7A9533830
'
,
from
:
'
0x97Aa2EfcF35c0f4c9AaDDCa8c2330fa7A9533830
'
,
to
:
'
0x35317007D203b8a86CA727ad44E473E40450E378
'
,
to
:
'
0x35317007D203b8a86CA727ad44E473E40450E378
'
,
...
...
types/api/tx.ts
0 → 100644
View file @
45f8d4af
export
type
TxInternalsType
=
'
call
'
|
'
delegate_call
'
|
'
static_call
'
|
'
create
'
|
'
create2
'
|
'
self_destruct
'
|
'
reward
'
ui/shared/FilterButton.tsx
0 → 100644
View file @
45f8d4af
import
{
Button
,
Circle
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
filterIcon
from
'
icons/filter.svg
'
;
const
FilterIcon
=
<
Icon
as=
{
filterIcon
}
boxSize=
{
5
}
/>;
interface
Props
{
isActive
:
boolean
;
isCollapsed
?:
boolean
;
appliedFiltersNum
?:
number
;
onClick
:
()
=>
void
;
}
const
FilterButton
=
({
isActive
,
appliedFiltersNum
,
onClick
,
isCollapsed
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
)
=>
{
const
badgeColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
badgeBgColor
=
useColorModeValue
(
'
blue.700
'
,
'
gray.50
'
);
return
(
<
Button
ref=
{
ref
}
leftIcon=
{
isCollapsed
?
undefined
:
FilterIcon
}
rightIcon=
{
appliedFiltersNum
?
<
Circle
bg=
{
badgeBgColor
}
size=
{
5
}
color=
{
badgeColor
}
>
{
appliedFiltersNum
}
</
Circle
>
:
undefined
}
size=
"sm"
variant=
"outline"
colorScheme=
"gray-dark"
onClick=
{
onClick
}
isActive=
{
isActive
}
px=
{
1.5
}
>
{
isCollapsed
?
FilterIcon
:
'
Filter
'
}
</
Button
>
);
};
export
default
React
.
forwardRef
(
FilterButton
);
ui/tx/TxInternals.tsx
View file @
45f8d4af
import
{
Box
,
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Flex
,
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
{
data
}
from
'
data/txInternal
'
;
import
{
data
}
from
'
data/txInternal
'
;
import
Filters
from
'
ui/shared/Filters
'
;
import
TxInternalsFilter
from
'
ui/tx/internals/TxInternalsFilter
'
;
import
TxInternalsTableItem
from
'
ui/tx/internals/TxInternalsTableItem
'
;
import
TxInternalsTableItem
from
'
ui/tx/internals/TxInternalsTableItem
'
;
const
DEFAULT_FILTERS
:
Array
<
TxInternalsType
>
=
[
'
call
'
,
'
delegate_call
'
,
'
static_call
'
,
'
create
'
,
'
create2
'
,
'
self_destruct
'
,
'
reward
'
];
const
TxInternals
=
()
=>
{
const
TxInternals
=
()
=>
{
const
[
filters
,
setFilters
]
=
React
.
useState
<
Array
<
TxInternalsType
>>
(
DEFAULT_FILTERS
);
const
handleFilterChange
=
React
.
useCallback
((
nextValue
:
Array
<
TxInternalsType
>
)
=>
{
setFilters
(
nextValue
);
},
[]);
return
(
return
(
<
Box
>
<
Box
>
<
Filters
/>
<
Flex
>
<
TxInternalsFilter
onFilterChange=
{
handleFilterChange
}
defaultFilters=
{
filters
}
appliedFiltersNum=
{
filters
.
length
}
/>
</
Flex
>
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
<
Thead
>
<
Thead
>
...
@@ -21,12 +33,9 @@ const TxInternals = () => {
...
@@ -21,12 +33,9 @@ const TxInternals = () => {
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
<
TxInternalsTableItem
.
filter
(({
type
})
=>
filters
.
includes
(
type
))
key=
{
item
.
id
}
.
map
((
item
)
=>
<
TxInternalsTableItem
key=
{
item
.
id
}
{
...
item
}
/>)
}
{
...
item
}
/>
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
</
TableContainer
>
...
...
ui/tx/internals/TxInternalsFilter.tsx
0 → 100644
View file @
45f8d4af
import
{
Popover
,
PopoverTrigger
,
PopoverContent
,
PopoverBody
,
CheckboxGroup
,
Checkbox
,
Text
,
useDisclosure
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
interface
Filter
{
title
:
string
;
id
:
TxInternalsType
;
}
const
FILTERS
:
Array
<
Filter
>
=
[
{
title
:
'
Call
'
,
id
:
'
call
'
},
{
title
:
'
Delegate call
'
,
id
:
'
delegate_call
'
},
{
title
:
'
Static call
'
,
id
:
'
static_call
'
},
{
title
:
'
Create
'
,
id
:
'
create
'
},
{
title
:
'
Create2
'
,
id
:
'
create2
'
},
{
title
:
'
Self-destruct
'
,
id
:
'
self_destruct
'
},
{
title
:
'
Reward
'
,
id
:
'
reward
'
},
];
interface
Props
{
appliedFiltersNum
?:
number
;
defaultFilters
:
Array
<
TxInternalsType
>
;
onFilterChange
:
(
nextValue
:
Array
<
TxInternalsType
>
)
=>
void
;
}
const
TxInternalsFilter
=
({
onFilterChange
,
defaultFilters
,
appliedFiltersNum
}:
Props
)
=>
{
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
isMobile
=
useIsMobile
();
return
(
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
PopoverTrigger
>
<
FilterButton
isActive=
{
isOpen
||
Number
(
appliedFiltersNum
)
>
0
}
isCollapsed=
{
isMobile
}
onClick=
{
onToggle
}
appliedFiltersNum=
{
appliedFiltersNum
}
/>
</
PopoverTrigger
>
<
PopoverContent
w=
"438px"
>
<
PopoverBody
px=
{
4
}
py=
{
6
}
display=
"grid"
gridTemplateColumns=
"1fr 1fr"
rowGap=
{
5
}
>
<
CheckboxGroup
size=
"lg"
onChange=
{
onFilterChange
}
defaultValue=
{
defaultFilters
}
>
{
FILTERS
.
map
(({
title
,
id
})
=>
<
Checkbox
key=
{
id
}
value=
{
id
}
><
Text
fontSize=
"md"
>
{
title
}
</
Text
></
Checkbox
>)
}
</
CheckboxGroup
>
</
PopoverBody
>
</
PopoverContent
>
</
Popover
>
);
};
export
default
TxInternalsFilter
;
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