Bug fixes
This commit is contained in:
parent
38b631bb05
commit
e3998c8eb2
59
index.html
59
index.html
@ -388,25 +388,19 @@
|
|||||||
|
|
||||||
// append latest transactions
|
// append latest transactions
|
||||||
renderTransactions('contract_transaction_container', contractTransactions)
|
renderTransactions('contract_transaction_container', contractTransactions)
|
||||||
// console.log(contractParticipants)
|
console.log(contractParticipants)
|
||||||
// let winners = []
|
let winners = []
|
||||||
// for (const participant in contractParticipants) {
|
for (const participant in contractParticipants) {
|
||||||
// if (contractParticipants[participant].winningAmount)
|
if (contractParticipants[participant].winningAmount)
|
||||||
// winners.push(contractParticipants[participant])
|
winners.push(contractParticipants[participant])
|
||||||
// }
|
}
|
||||||
// for (const participant in contractParticipants) {
|
renderElem(document.getElementById('participant_container'), html`${
|
||||||
// console.log(contractParticipants[participant])
|
Object.keys(contractParticipants).map(participant => render.contractChoiceCard(contractParticipants[participant]))
|
||||||
// let { participantFloAddress, tokenIdentification, userChoice, tokenAmount } = contractParticipants[participant]
|
}`)
|
||||||
// if(userChoice)
|
|
||||||
// frag.append(render.contractChoiceCard(participantFloAddress, tokenIdentification, userChoice, tokenAmount))
|
|
||||||
// }
|
|
||||||
// document.getElementById('participant_container').append(frag)
|
|
||||||
|
|
||||||
// winners.forEach(winner => {
|
if(winners.length){
|
||||||
// let { participantFloAddress, tokenIdentification, userChoice, tokenAmount, winningAmount } = winner;
|
renderElem(document.getElementById('winners_container'), html`${winners.map(winner => render.contractChoiceCard(winner))}`)
|
||||||
// frag.append(render.contractChoiceCard(participantFloAddress, tokenIdentification, userChoice, tokenAmount, winningAmount))
|
}
|
||||||
// })
|
|
||||||
// document.getElementById('winners_container').append(frag)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.addRoute('block', async state => {
|
router.addRoute('block', async state => {
|
||||||
@ -802,7 +796,7 @@
|
|||||||
${userChoices ? html`
|
${userChoices ? html`
|
||||||
<h3 class="heading">User Choices</h3>
|
<h3 class="heading">User Choices</h3>
|
||||||
<ul type="circle" class="card">
|
<ul type="circle" class="card">
|
||||||
${object.keys(userChoices).map(choice => html`
|
${Object.keys(userChoices).map(choice => html`
|
||||||
<li>${userChoices[choice]}</li>
|
<li>${userChoices[choice]}</li>
|
||||||
`)}
|
`)}
|
||||||
</ul>
|
</ul>
|
||||||
@ -913,31 +907,32 @@
|
|||||||
<sm-chip value="0" selected>Transactions</sm-chip>
|
<sm-chip value="0" selected>Transactions</sm-chip>
|
||||||
<sm-chip value="1">Participants</sm-chip>
|
<sm-chip value="1">Participants</sm-chip>
|
||||||
${contractType === 'one-time-event' && contractSubtype === 'external-trigger' ? html`<sm-chip value="2">Winners</sm-chip>` : ''}
|
${contractType === 'one-time-event' && contractSubtype === 'external-trigger' ? html`<sm-chip value="2">Winners</sm-chip>` : ''}
|
||||||
|
${contractType === 'continuos-event' && contractSubtype === 'token-swap' ? html`<sm-chip value="2">Deposits</sm-chip>` : ''}
|
||||||
</sm-chips>
|
</sm-chips>
|
||||||
<div id="contract_views" class="view-wrapper">
|
<div id="contract_views" class="view-wrapper">
|
||||||
<div id="contract_transaction_container" class="transaction-container"></div>
|
<div id="contract_transaction_container" class="transaction-container"></div>
|
||||||
<ul id="participant_container" class="card"></ul>
|
<ul id="participant_container" class="card"></ul>
|
||||||
${contractType === 'one-time-event' && contractSubtype === 'external-trigger' ? html`<ul id="winners_container" class="card hidden"></ul>` : ''}
|
${contractType === 'one-time-event' && contractSubtype === 'external-trigger' ? html`<ul id="winners_container" class="card"></ul>` : ''}
|
||||||
|
${contractType === 'continuos-event' && contractSubtype === 'token-swap' ? html`<ul id="deposits_container" class="card"></ul>` : ''}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
contractChoiceCard(address, token, choice, amount, winningAmount) {
|
contractChoiceCard(details) {
|
||||||
let card = document.createElement('li'),
|
const { participantFloAddress, userChoice, tokenAmount, transactionHash, winningAmount} = details;
|
||||||
action;
|
let action;
|
||||||
card.classList.add('contract-choice')
|
|
||||||
if (winningAmount) {
|
if (winningAmount) {
|
||||||
action = 'Won'
|
action = 'Won'
|
||||||
amount = winningAmount
|
amount = winningAmount
|
||||||
}
|
}else
|
||||||
else
|
|
||||||
action = 'Invested'
|
action = 'Invested'
|
||||||
card.innerHTML = `
|
return html`
|
||||||
<a href=${`#/address/${address}`} class="address wrap-around">${address}</a>
|
<li class="contract-choice">
|
||||||
<h4>${choice}</h4>
|
<a href=${`#/address/${participantFloAddress}`} class="address wrap-around">${participantFloAddress}</a>
|
||||||
<h4>${formatAmount(amount, token.toLowerCase() === 'rupee' ? 'inr' : 'usd')} ${token} ${action}</h4>
|
<h4>${userChoice}</h4>
|
||||||
`
|
<h4>${formatAmount(tokenAmount, 'usd')} ${action}</h4>
|
||||||
return card;
|
</li>
|
||||||
|
`;
|
||||||
},
|
},
|
||||||
contractTransferCard(obj) {
|
contractTransferCard(obj) {
|
||||||
const { hash, token, sender, receiver, amount, contractName, userChoice, time } = obj;
|
const { hash, token, sender, receiver, amount, contractName, userChoice, time } = obj;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user