Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #245 from bandprotocol/fixModalDelay
Browse files Browse the repository at this point in the history
add delay
  • Loading branch information
prin-r committed Sep 16, 2019
2 parents 70cedf5 + 0ef4327 commit 9b5d161
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/package.json
Expand Up @@ -25,13 +25,13 @@
"moment": "^2.24.0",
"prismjs": "^1.17.1",
"query-string": "^6.8.2",
"react": "^16.7.0",
"react": "^16.9.0",
"react-autosuggest": "^9.4.3",
"react-chartjs-2": "^2.7.4",
"react-click-outside": "tj/react-click-outside",
"react-content-loader": "^4.2.1",
"react-datepicker": "^2.8.0",
"react-dom": "^16.7.0",
"react-dom": "^16.9.0",
"react-dropzone": "9.0.0",
"react-flip-move": "^3.0.3",
"react-google-charts": "^3.0.13",
Expand All @@ -40,13 +40,13 @@
"react-mailchimp-subscribe": "^2.0.2",
"react-mathjax": "^1.0.1",
"react-redux": "^6.0.1",
"react-router-dom": "^4.3.1",
"react-router-dom": "^5.0.1",
"react-scripts": "2.1.3",
"react-select": "^2.4.4",
"react-share": "^3.0.0",
"react-tooltip": "^3.10.0",
"react-virtualized-auto-sizer": "^1.0.2",
"rebass": "^3.0.1",
"rebass": "^3.2.0",
"redux": "^4.0.4",
"redux-immutable": "^4.0.0",
"redux-saga": "^1.0.5",
Expand Down
15 changes: 12 additions & 3 deletions app/src/reducers/current.js
Expand Up @@ -34,6 +34,8 @@ const handleSaveBalance = (state, { balances }) =>
),
)

window.lastOpenModal = Date.now()

const handleSaveBandClient = (state, { client }) =>
state.setIn(['client', 'band'], client)

Expand All @@ -43,16 +45,23 @@ const handleSaveCommunityClient = (state, { address, client }) =>
const handleSaveTCDClient = (state, { address, client }) =>
state.setIn(['client', 'tcds', address], client)

const handleShowModal = (state, { modalName, data }) =>
state.set(
const handleShowModal = (state, { modalName, data }) => {
if (Date.now() - window.lastOpenModal < 500) return state
window.lastOpenModal = Date.now()
return state.set(
'modal',
fromJS({
name: modalName,
data,
}),
)
}

const handleHideModal = (state, _) => state.delete('modal')
const handleHideModal = (state, _) => {
if (Date.now() - window.lastOpenModal < 500) return state
window.lastOpenModal = Date.now()
return state.delete('modal')
}

export default createReducer({
[SET_USER_ADDRESS]: handleSetUserAddress,
Expand Down

0 comments on commit 9b5d161

Please sign in to comment.