ContestEntry.svelte 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script>
  2. export let contest = {};
  3. export let index = 0;
  4. let visible = false;
  5. function toggleView() {
  6. visible = !visible;
  7. }
  8. </script>
  9. <style>
  10. h3 {
  11. @apply .font-bold;
  12. }
  13. </style>
  14. <tr class="entry" data-nth={index % 2 == 0 ? 'even' : 'odd'}>
  15. <td>{contest.id}</td>
  16. <td>
  17. <pre>{contest.channel}</pre>
  18. </td>
  19. <td>{contest.started.toISOString()}</td>
  20. <td>{contest.entryDuration}</td>
  21. <td>{contest.voteDuration}</td>
  22. <td>
  23. <button class="btn" on:click={toggleView}>View info and actions</button>
  24. </td>
  25. </tr>
  26. {#if visible}
  27. <tr class="info">
  28. <td colspan="6">
  29. <h3>Actions</h3>
  30. <div class="py-1 pb-4">
  31. <button class="btn" disabled="disabled">End entry phase</button>
  32. <button class="btn">Start voting</button>
  33. <button class="btn">End vote phase</button>
  34. <button class="btn">Announce winners</button>
  35. </div>
  36. {#if contest.winners}
  37. <h3>Winners</h3>
  38. <div class="py-1">
  39. <ol class="list-decimal list-inside">
  40. {#each contest.winners as winner}
  41. <li>{winner}</li>
  42. {/each}
  43. </ol>
  44. </div>
  45. {/if}
  46. </td>
  47. </tr>
  48. {/if}