diff --git a/index.html b/index.html index 6623a26..e2d885a 100644 --- a/index.html +++ b/index.html @@ -388,25 +388,19 @@ // append latest transactions renderTransactions('contract_transaction_container', contractTransactions) - // console.log(contractParticipants) - // let winners = [] - // for (const participant in contractParticipants) { - // if (contractParticipants[participant].winningAmount) - // winners.push(contractParticipants[participant]) - // } - // for (const participant in contractParticipants) { - // console.log(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) + console.log(contractParticipants) + let winners = [] + for (const participant in contractParticipants) { + if (contractParticipants[participant].winningAmount) + winners.push(contractParticipants[participant]) + } + renderElem(document.getElementById('participant_container'), html`${ + Object.keys(contractParticipants).map(participant => render.contractChoiceCard(contractParticipants[participant])) + }`) - // winners.forEach(winner => { - // let { participantFloAddress, tokenIdentification, userChoice, tokenAmount, winningAmount } = winner; - // frag.append(render.contractChoiceCard(participantFloAddress, tokenIdentification, userChoice, tokenAmount, winningAmount)) - // }) - // document.getElementById('winners_container').append(frag) + if(winners.length){ + renderElem(document.getElementById('winners_container'), html`${winners.map(winner => render.contractChoiceCard(winner))}`) + } }) router.addRoute('block', async state => { @@ -802,7 +796,7 @@ ${userChoices ? html`