MatchTable.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="match-table-container">
  3. <table>
  4. <tr>
  5. <th>Submission 1</th>
  6. <th>Submission 2</th>
  7. </tr>
  8. <tr>
  9. <th>File 1</th>
  10. <th>File 2</th>
  11. <th>Tokens</th>
  12. </tr>
  13. <tr v-for="( match, index ) in matches" :key="String(index).concat(match.startInFirst).concat(match.startInSecond)"
  14. @click="$emit('matchSelected', $event, match)"
  15. :style="{ background : match.color }">
  16. <td>
  17. <div class="td-content">
  18. <p>{{ match.firstFile }}</p>
  19. <p>({{ match.startInFirst }} - {{ match.endInFirst }})</p>
  20. </div>
  21. </td>
  22. <td>
  23. <div class="td-content">
  24. <p>{{ match.secondFile }}</p>
  25. <p>({{ match.startInSecond }} - {{ match.endInSecond }})</p>
  26. </div>
  27. </td>
  28. <td>{{ match.tokens }}</td>
  29. </tr>
  30. </table>
  31. </div>
  32. </template>
  33. <script>
  34. import { defineComponent } from "vue";
  35. export default defineComponent({
  36. name: "MatchTable",
  37. props: {
  38. /**
  39. * Matches of the comparison.
  40. * type: Array<Match>
  41. */
  42. matches : {
  43. type: Array
  44. },
  45. /**
  46. * ID of first submission
  47. */
  48. id1: {
  49. type: String
  50. },
  51. /**
  52. * ID of second submission
  53. */
  54. id2: {
  55. type: String
  56. }
  57. },
  58. setup() {
  59. return {}
  60. }
  61. })
  62. </script>
  63. <style scoped>
  64. .match-table-container {
  65. width: 100%;
  66. margin-top: 2%;
  67. padding: 1%;
  68. background: var(--primary-color-dark);
  69. border-radius: 10px;
  70. overflow: auto;
  71. }
  72. .td-content {
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. flex-wrap: nowrap;
  77. padding: 5%;
  78. }
  79. .td-content > p {
  80. margin: 0;
  81. }
  82. table {
  83. border-collapse: collapse;
  84. width: 100%;
  85. }
  86. th {
  87. color: var(--on-primary-color);
  88. text-align: center;
  89. }
  90. td {
  91. font-size: small;
  92. text-align: center;
  93. padding: 2%;
  94. }
  95. </style>