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
6fac3485
Commit
6fac3485
authored
Aug 30, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom abi page
parent
e65edd64
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
15 deletions
+113
-15
CustomAbiListItem.tsx
ui/customAbi/CustomAbiTable/CustomAbiListItem.tsx
+42
-0
CustomAbiTableItem.tsx
ui/customAbi/CustomAbiTable/CustomAbiTableItem.tsx
+2
-7
CustomAbi.tsx
ui/pages/CustomAbi.tsx
+23
-7
AddressLinkWithTooltip.tsx
ui/shared/AddressLinkWithTooltip.tsx
+1
-0
AddressSnippet.tsx
ui/shared/AddressSnippet.tsx
+1
-1
TableItemActionButtons.tsx
ui/shared/TableItemActionButtons.tsx
+44
-0
No files found.
ui/customAbi/CustomAbiTable/CustomAbiListItem.tsx
0 → 100644
View file @
6fac3485
import
{
VStack
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
type
{
CustomAbi
}
from
'
types/api/account
'
;
import
AddressSnippet
from
'
ui/shared/AddressSnippet
'
;
import
TableItemActionButtons
from
'
ui/shared/TableItemActionButtons
'
;
interface
Props
{
item
:
CustomAbi
;
onEditClick
:
(
item
:
CustomAbi
)
=>
void
;
onDeleteClick
:
(
item
:
CustomAbi
)
=>
void
;
}
const
CustomAbiListItem
=
({
item
,
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
const
onItemEditClick
=
useCallback
(()
=>
{
return
onEditClick
(
item
);
},
[
item
,
onEditClick
]);
const
onItemDeleteClick
=
useCallback
(()
=>
{
return
onDeleteClick
(
item
);
},
[
item
,
onDeleteClick
]);
return
(
<
VStack
gap=
{
4
}
alignItems=
"flex-start"
paddingY=
{
6
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderTopWidth=
"1px"
_last=
{
{
borderBottomWidth
:
'
1px
'
,
}
}
>
<
AddressSnippet
address=
{
item
.
contract_address_hash
}
subtitle=
{
item
.
name
}
/>
<
TableItemActionButtons
onDeleteClick=
{
onItemDeleteClick
}
onEditClick=
{
onItemEditClick
}
/>
</
VStack
>
);
};
export
default
React
.
memo
(
CustomAbiListItem
);
ui/customAbi/CustomAbiTable/CustomAbiTableItem.tsx
View file @
6fac3485
import
{
import
{
Tr
,
Tr
,
Td
,
Td
,
HStack
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
type
{
CustomAbi
}
from
'
types/api/account
'
;
import
type
{
CustomAbi
}
from
'
types/api/account
'
;
import
AddressSnippet
from
'
ui/shared/AddressSnippet
'
;
import
AddressSnippet
from
'
ui/shared/AddressSnippet
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
import
TableItemActionButtons
from
'
ui/shared/TableItemActionButtons
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
interface
Props
{
interface
Props
{
item
:
CustomAbi
;
item
:
CustomAbi
;
...
@@ -33,10 +31,7 @@ const CustomAbiTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -33,10 +31,7 @@ const CustomAbiTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
<
AddressSnippet
address=
{
item
.
contract_address_hash
}
subtitle=
{
item
.
name
}
/>
<
AddressSnippet
address=
{
item
.
contract_address_hash
}
subtitle=
{
item
.
name
}
/>
</
Td
>
</
Td
>
<
Td
>
<
Td
>
<
HStack
spacing=
{
6
}
>
<
TableItemActionButtons
onDeleteClick=
{
onItemDeleteClick
}
onEditClick=
{
onItemEditClick
}
/>
<
EditButton
onClick=
{
onItemEditClick
}
/>
<
DeleteButton
onClick=
{
onItemDeleteClick
}
/>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
);
);
...
...
ui/pages/CustomAbi.tsx
View file @
6fac3485
...
@@ -5,7 +5,9 @@ import React, { useCallback, useState } from 'react';
...
@@ -5,7 +5,9 @@ import React, { useCallback, useState } from 'react';
import
type
{
CustomAbi
,
CustomAbis
}
from
'
types/api/account
'
;
import
type
{
CustomAbi
,
CustomAbis
}
from
'
types/api/account
'
;
import
fetch
from
'
lib/client/fetch
'
;
import
fetch
from
'
lib/client/fetch
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
CustomAbiModal
from
'
ui/customAbi/CustomAbiModal/CustomAbiModal
'
;
import
CustomAbiModal
from
'
ui/customAbi/CustomAbiModal/CustomAbiModal
'
;
import
CustomAbiListItem
from
'
ui/customAbi/CustomAbiTable/CustomAbiListItem
'
;
import
CustomAbiTable
from
'
ui/customAbi/CustomAbiTable/CustomAbiTable
'
;
import
CustomAbiTable
from
'
ui/customAbi/CustomAbiTable/CustomAbiTable
'
;
import
DeleteCustomAbiModal
from
'
ui/customAbi/DeleteCustomAbiModal
'
;
import
DeleteCustomAbiModal
from
'
ui/customAbi/DeleteCustomAbiModal
'
;
import
AccountPageHeader
from
'
ui/shared/AccountPageHeader
'
;
import
AccountPageHeader
from
'
ui/shared/AccountPageHeader
'
;
...
@@ -17,6 +19,7 @@ import DataFetchAlert from '../shared/DataFetchAlert';
...
@@ -17,6 +19,7 @@ import DataFetchAlert from '../shared/DataFetchAlert';
const
CustomAbiPage
:
React
.
FC
=
()
=>
{
const
CustomAbiPage
:
React
.
FC
=
()
=>
{
const
customAbiModalProps
=
useDisclosure
();
const
customAbiModalProps
=
useDisclosure
();
const
deleteModalProps
=
useDisclosure
();
const
deleteModalProps
=
useDisclosure
();
const
isMobile
=
useIsMobile
();
const
[
customAbiModalData
,
setCustomAbiModalData
]
=
useState
<
CustomAbi
>
();
const
[
customAbiModalData
,
setCustomAbiModalData
]
=
useState
<
CustomAbi
>
();
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
CustomAbi
>
();
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
CustomAbi
>
();
...
@@ -64,16 +67,29 @@ const CustomAbiPage: React.FC = () => {
...
@@ -64,16 +67,29 @@ const CustomAbiPage: React.FC = () => {
return
<
DataFetchAlert
/>;
return
<
DataFetchAlert
/>;
}
}
return
(
const
list
=
isMobile
?
(
<>
<
Box
>
{
d
escription
}
{
d
ata
.
map
((
item
)
=>
(
{
data
.
length
>
0
&&
(
<
CustomAbiListItem
<
CustomAbiTable
item=
{
item
}
data=
{
data
}
key=
{
item
.
id
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
)
}
))
}
</
Box
>
)
:
(
<
CustomAbiTable
data=
{
data
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
/>
);
return
(
<>
{
description
}
{
data
.
length
>
0
&&
list
}
<
HStack
marginTop=
{
8
}
spacing=
{
5
}
>
<
HStack
marginTop=
{
8
}
spacing=
{
5
}
>
<
Button
<
Button
variant=
"primary"
variant=
"primary"
...
...
ui/shared/AddressLinkWithTooltip.tsx
View file @
6fac3485
...
@@ -19,6 +19,7 @@ const AddressLinkWithTooltip = ({ address }: {address: string}) => {
...
@@ -19,6 +19,7 @@ const AddressLinkWithTooltip = ({ address }: {address: string}) => {
overflow=
"hidden"
overflow=
"hidden"
fontWeight=
{
FONT_WEIGHT
}
fontWeight=
{
FONT_WEIGHT
}
lineHeight=
"24px"
lineHeight=
"24px"
whiteSpace=
"nowrap"
>
>
<
AddressWithDots
address=
{
address
}
fontWeight=
{
FONT_WEIGHT
}
/>
<
AddressWithDots
address=
{
address
}
fontWeight=
{
FONT_WEIGHT
}
/>
</
Link
>
</
Link
>
...
...
ui/shared/AddressSnippet.tsx
View file @
6fac3485
...
@@ -11,7 +11,7 @@ interface Props {
...
@@ -11,7 +11,7 @@ interface Props {
const
AddressSnippet
=
({
address
,
subtitle
}:
Props
)
=>
{
const
AddressSnippet
=
({
address
,
subtitle
}:
Props
)
=>
{
return
(
return
(
<
HStack
spacing=
{
4
}
key=
{
address
}
overflow=
"hidden"
alignItems=
"start"
>
<
HStack
spacing=
{
4
}
key=
{
address
}
overflow=
"hidden"
alignItems=
"start"
maxW=
"100%"
>
<
AddressIcon
address=
{
address
}
/>
<
AddressIcon
address=
{
address
}
/>
<
Box
overflow=
"hidden"
>
<
Box
overflow=
"hidden"
>
<
AddressLinkWithTooltip
address=
{
address
}
/>
<
AddressLinkWithTooltip
address=
{
address
}
/>
...
...
ui/shared/TableItemActionButtons.tsx
0 → 100644
View file @
6fac3485
import
{
Tooltip
,
IconButton
,
Icon
,
HStack
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
DeleteIcon
from
'
icons/delete.svg
'
;
import
EditIcon
from
'
icons/edit.svg
'
;
type
Props
=
{
onEditClick
:
()
=>
void
;
onDeleteClick
:
()
=>
void
;
}
const
TableItemActionButtons
=
({
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
// prevent set focus on button when closing modal
const
onFocusCapture
=
useCallback
((
e
:
React
.
SyntheticEvent
)
=>
e
.
stopPropagation
(),
[]);
return
(
<
HStack
spacing=
{
6
}
alignSelf=
"flex-end"
>
<
Tooltip
label=
"Edit"
>
<
IconButton
aria
-
label=
"edit"
variant=
"icon"
w=
"30px"
h=
"30px"
onClick=
{
onEditClick
}
icon=
{
<
Icon
as=
{
EditIcon
}
w=
"20px"
h=
"20px"
/>
}
onFocusCapture=
{
onFocusCapture
}
/>
</
Tooltip
>
<
Tooltip
label=
"Delete"
>
<
IconButton
aria
-
label=
"delete"
variant=
"icon"
w=
"30px"
h=
"30px"
onClick=
{
onDeleteClick
}
icon=
{
<
Icon
as=
{
DeleteIcon
}
w=
"20px"
h=
"20px"
/>
}
onFocusCapture=
{
onFocusCapture
}
/>
</
Tooltip
>
</
HStack
>
);
};
export
default
React
.
memo
(
TableItemActionButtons
);
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