Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
6de3a6ec
Unverified
Commit
6de3a6ec
authored
Jun 03, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid duplicate popups for mined transactions
parent
c1d35cc8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
16 deletions
+14
-16
actions.ts
src/state/application/actions.ts
+1
-1
hooks.ts
src/state/application/hooks.ts
+3
-3
reducer.ts
src/state/application/reducer.ts
+3
-2
updater.tsx
src/state/transactions/updater.tsx
+7
-10
No files found.
src/state/application/actions.ts
View file @
6de3a6ec
...
...
@@ -23,5 +23,5 @@ export type PopupContent =
export
const
updateBlockNumber
=
createAction
<
{
chainId
:
number
;
blockNumber
:
number
}
>
(
'
updateBlockNumber
'
)
export
const
toggleWalletModal
=
createAction
<
void
>
(
'
toggleWalletModal
'
)
export
const
addPopup
=
createAction
<
{
content
:
PopupContent
}
>
(
'
addPopup
'
)
export
const
addPopup
=
createAction
<
{
key
?:
string
;
content
:
PopupContent
}
>
(
'
addPopup
'
)
export
const
removePopup
=
createAction
<
{
key
:
string
}
>
(
'
removePopup
'
)
src/state/application/hooks.ts
View file @
6de3a6ec
...
...
@@ -20,12 +20,12 @@ export function useWalletModalToggle(): () => void {
}
// returns a function that allows adding a popup
export
function
useAddPopup
():
(
content
:
PopupContent
)
=>
void
{
export
function
useAddPopup
():
(
content
:
PopupContent
,
key
?:
string
)
=>
void
{
const
dispatch
=
useDispatch
()
return
useCallback
(
(
content
:
PopupContent
)
=>
{
dispatch
(
addPopup
({
content
}))
(
content
:
PopupContent
,
key
?:
string
)
=>
{
dispatch
(
addPopup
({
content
,
key
}))
},
[
dispatch
]
)
...
...
src/state/application/reducer.ts
View file @
6de3a6ec
...
...
@@ -28,9 +28,10 @@ export default createReducer(initialState, builder =>
.
addCase
(
toggleWalletModal
,
state
=>
{
state
.
walletModalOpen
=
!
state
.
walletModalOpen
})
.
addCase
(
addPopup
,
(
state
,
{
payload
:
{
content
}
})
=>
{
.
addCase
(
addPopup
,
(
state
,
{
payload
:
{
content
,
key
}
})
=>
{
if
(
key
&&
state
.
popupList
.
some
(
popup
=>
popup
.
key
===
key
))
return
state
.
popupList
.
push
({
key
:
nanoid
(),
key
:
key
||
nanoid
(),
show
:
true
,
content
})
...
...
src/state/transactions/updater.tsx
View file @
6de3a6ec
...
...
@@ -44,20 +44,17 @@ export default function Updater() {
}
})
)
// add success or failure popup
if
(
receipt
.
status
===
1
)
{
addPopup
(
{
addPopup
(
{
txn
:
{
hash
,
success
:
true
,
success
:
receipt
.
status
===
1
,
summary
:
allTransactions
[
hash
]?.
summary
}
})
}
else
{
addPopup
({
txn
:
{
hash
,
success
:
false
,
summary
:
allTransactions
[
hash
]?.
summary
}
})
}
},
hash
)
}
})
.
catch
(
error
=>
{
...
...
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