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
4add4ee7
Commit
4add4ee7
authored
Jun 15, 2022
by
Natalia Stus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
cb7f22e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
WatchListTableItem.tsx
components/WatchlistTable/WatchListTableItem.tsx
+13
-5
WatchlistTable.tsx
components/WatchlistTable/WatchlistTable.tsx
+6
-6
watchlist.tsx
pages/watchlist.tsx
+4
-4
No files found.
components/WatchlistTable/WatchListTableItem.tsx
View file @
4add4ee7
import
React
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
{
import
{
Tag
,
Tag
,
...
@@ -17,11 +17,19 @@ import WatchListAddressItem from './WatchListAddressItem';
...
@@ -17,11 +17,19 @@ import WatchListAddressItem from './WatchListAddressItem';
interface
Props
{
interface
Props
{
item
:
TWatchlistItem
;
item
:
TWatchlistItem
;
onEditClick
:
()
=>
void
;
onEditClick
:
(
data
:
TWatchlistItem
)
=>
void
;
onDeleteClick
:
()
=>
void
;
onDeleteClick
:
(
data
:
TWatchlistItem
)
=>
void
;
}
}
const
WatchlistTableItem
=
({
item
,
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
const
WatchlistTableItem
=
({
item
,
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
const
onItemEditClick
=
useCallback
(()
=>
{
return
onEditClick
(
item
);
},
[
item
,
onEditClick
]);
const
onItemDeleteClick
=
useCallback
(()
=>
{
return
onDeleteClick
(
item
);
},
[
item
,
onDeleteClick
]);
return
(
return
(
<
Tr
alignItems=
"top"
key=
{
item
.
address
}
>
<
Tr
alignItems=
"top"
key=
{
item
.
address
}
>
<
Td
><
WatchListAddressItem
item=
{
item
}
/></
Td
>
<
Td
><
WatchListAddressItem
item=
{
item
}
/></
Td
>
...
@@ -29,8 +37,8 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -29,8 +37,8 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
<
Td
><
Switch
colorScheme=
"green"
size=
"md"
isChecked=
{
item
.
notification
}
/></
Td
>
<
Td
><
Switch
colorScheme=
"green"
size=
"md"
isChecked=
{
item
.
notification
}
/></
Td
>
<
Td
>
<
Td
>
<
HStack
spacing=
"30px"
>
<
HStack
spacing=
"30px"
>
<
Icon
as=
{
FaEdit
}
w=
"20px"
h=
"20px"
cursor=
"pointer"
color=
"blue.500"
onClick=
{
onEditClick
}
/>
<
Icon
as=
{
FaEdit
}
w=
"20px"
h=
"20px"
cursor=
"pointer"
color=
"blue.500"
onClick=
{
on
Item
EditClick
}
/>
<
Icon
as=
{
FaTrash
}
w=
"20px"
h=
"20px"
cursor=
"pointer"
color=
"red.200"
onClick=
{
onDeleteClick
}
/>
<
Icon
as=
{
FaTrash
}
w=
"20px"
h=
"20px"
cursor=
"pointer"
color=
"red.200"
onClick=
{
on
Item
DeleteClick
}
/>
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
...
...
components/WatchlistTable/WatchlistTable.tsx
View file @
4add4ee7
...
@@ -9,14 +9,14 @@ import {
...
@@ -9,14 +9,14 @@ import {
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
import
type
{
TWatchlist
}
from
'
../../data/watchlist
'
;
import
type
{
TWatchlist
,
TWatchlistItem
}
from
'
../../data/watchlist
'
;
import
WatchlistTableItem
from
'
./WatchListTableItem
'
;
import
WatchlistTableItem
from
'
./WatchListTableItem
'
;
interface
Props
{
interface
Props
{
data
:
TWatchlist
;
data
:
TWatchlist
;
onEditClick
:
(
index
:
number
)
=>
(
)
=>
void
;
onEditClick
:
(
data
:
TWatchlistItem
)
=>
void
;
onDeleteClick
:
(
index
:
number
)
=>
(
)
=>
void
;
onDeleteClick
:
(
data
:
TWatchlistItem
)
=>
void
;
}
}
const
WatchlistTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
const
WatchlistTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
...
@@ -32,12 +32,12 @@ const WatchlistTable = ({ data, onDeleteClick, onEditClick }: Props) => {
...
@@ -32,12 +32,12 @@ const WatchlistTable = ({ data, onDeleteClick, onEditClick }: Props) => {
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
,
index
)
=>
(
{
data
.
map
((
item
)
=>
(
<
WatchlistTableItem
<
WatchlistTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
address
}
key=
{
item
.
address
}
onDeleteClick=
{
onDeleteClick
(
index
)
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
(
index
)
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
...
...
pages/watchlist.tsx
View file @
4add4ee7
...
@@ -19,8 +19,8 @@ const WatchList: NextPage = () => {
...
@@ -19,8 +19,8 @@ const WatchList: NextPage = () => {
const
[
addressModalData
,
setAddressModalData
]
=
useState
<
TWatchlistItem
>
();
const
[
addressModalData
,
setAddressModalData
]
=
useState
<
TWatchlistItem
>
();
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
string
>
();
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
string
>
();
const
onEditClick
=
useCallback
((
index
:
number
)
=>
(
)
=>
{
const
onEditClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
setAddressModalData
(
watchlist
[
index
]
);
setAddressModalData
(
data
);
addressModalProps
.
onOpen
();
addressModalProps
.
onOpen
();
},
[
addressModalProps
])
},
[
addressModalProps
])
...
@@ -29,8 +29,8 @@ const WatchList: NextPage = () => {
...
@@ -29,8 +29,8 @@ const WatchList: NextPage = () => {
addressModalProps
.
onClose
();
addressModalProps
.
onClose
();
},
[
addressModalProps
]);
},
[
addressModalProps
]);
const
onDeleteClick
=
useCallback
((
index
:
number
)
=>
(
)
=>
{
const
onDeleteClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
setDeleteModalData
(
watchlist
[
index
]?
.
address
);
setDeleteModalData
(
data
.
address
);
deleteModalProps
.
onOpen
();
deleteModalProps
.
onOpen
();
},
[
deleteModalProps
])
},
[
deleteModalProps
])
...
...
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