diff --git a/index.html b/index.html index f65fcc2..b29efe2 100644 --- a/index.html +++ b/index.html @@ -389,10 +389,6 @@ // append latest transactions renderTransactions('contract_transaction_container', contractTransactions) console.log(contractParticipants) - renderElem( - document.getElementById('participant_container'), - html`${Object.keys(contractParticipants).map(participant => render.contractChoiceCard(contractParticipants[participant]))}` - ) switch (contractInfo.contractType) { case 'one-time-event': let winners = [] @@ -405,9 +401,30 @@ } else { renderElem(document.getElementById('winners_container'), html`
No winners found
`) } + renderElem( + document.getElementById('participant_container'), + html`${Object.keys(contractParticipants).map(participant => render.contractChoiceCard(contractParticipants[participant]))}` + ) break; case 'continuos-event': console.log('should render continuos-event') + switch (contractInfo.contractSubtype) { + case 'tokenswap': + renderElem( + document.getElementById('participant_container'), + html`${ + Object.keys(contractParticipants) + .map(participant => render.participantCard({ + accepting_token: contractInfo.accepting_token, + selling_token: contractInfo.selling_token, + ...contractParticipants[participant]} + )) + }` + ) + break; + default: + break; + } break; } }) @@ -927,6 +944,17 @@ `; }, + participantCard(details){ + const {participantFloAddress, participationAmount,swapAmount,swapPrice,transactionHash,accepting_token, selling_token} = details; + return html` +
  • + ${participantFloAddress} swapped +

    ${formatAmount(participationAmount, 'usd')} ${accepting_token}

    to +

    ${formatAmount(swapAmount, 'usd')} ${selling_token}

    @ +

    ${formatAmount(swapPrice, 'usd')} ${accepting_token}

    /token +
  • + `; + }, contractChoiceCard(details) { const { participantFloAddress, userChoice, tokenAmount, transactionHash, winningAmount } = details; let action;