Skip to content

Commit

Permalink
Merge pull request #243 from spartan-protocol/issue-#242
Browse files Browse the repository at this point in the history
issue #242
  • Loading branch information
SamusElderg committed Nov 14, 2020
2 parents 196e274 + 50b8218 commit 102646e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/assets/scss/custom/components/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
border-radius: 10px;
}

.slider:focus {
outline:none;
}

.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
Expand Down
20 changes: 14 additions & 6 deletions src/pages/Swap.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {manageBodyClass} from "../components/common";

const NewSwap = (props) => {

const context = useContext(Context);

const [activeTab, setActiveTab] = useState('1');
const [notifyMessage, setNotifyMessage] = useState("");
const [notifyType, setNotifyType] = useState("dark");
Expand All @@ -40,7 +42,6 @@ const NewSwap = (props) => {
else {setActiveTab('1')}
}

const context = useContext(Context)
const [poolURL, setPoolURL] = useState('')
const [pool, setPool] = useState({
'symbol': 'XXX',
Expand Down Expand Up @@ -101,29 +102,36 @@ const NewSwap = (props) => {
const [startTx, setStartTx] = useState(false)
const [endTx, setEndTx] = useState(false)

const pause = (ms) => new Promise(resolve => setTimeout(resolve, ms))

useEffect(() => {
checkPoolReady()
// eslint-disable-next-line
}, []);
}, [context.poolsData])

useEffect(() => {
if (context.poolsDataComplete === true) {
getData()
}
// eslint-disable-next-line
}, [context.walletData]);
}, [context.walletData])

const checkPoolReady = async () => {
let params = queryString.parse(props.location.search)
if (context.poolsData && context.poolsDataLoading !== true) {
if (context.poolsData) {
var existsInPoolsData = await context.poolsData.some(e => (e.address === params.pool))
if (existsInPoolsData === true) {
await getData()
getData()
}
else {
await checkPoolReady()
await pause(3000)
checkPoolReady()
}
}
else {
await pause(3000)
checkPoolReady()
}
}

const getData = async () => {
Expand Down

0 comments on commit 102646e

Please sign in to comment.