aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components/matches/BotMatchCard.svelte
blob: 2f501737aedff6ded5dec604ea5799a9e284415a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<script lang="ts">
  import type { BotMatch } from "$lib/matches";
  import dayjs from "dayjs";

  export let botMatch: BotMatch;
</script>

<a class="bot-match-card-wrapper" href={`/matches/${botMatch.id}`}>
  <div class="bot-match-card">
    <div class="bot-match-outcome">
      {botMatch.outcome}
    </div>
    <div class="bot-match-card-main">
      <div class="opponent-name">
        <a class="bot-link" href={`/bots/${botMatch.opponent.bot_name}`}
          >{botMatch.opponent.bot_name}</a
        >
      </div>
      <div class="map-name">
        {botMatch.map.name}
      </div>
    </div>
    <div class="bot-card-right">
      <div class="match-timestamp">
        {dayjs(botMatch.timestamp).format("YYYY-MM-DD HH:mm")}
      </div>
      <div class="match-errors">
        {#if botMatch.hadErrors}
          ! Had errors
        {/if}
      </div>
    </div>
  </div>
</a>

<style lang="scss">
  @use "src/styles/variables";

  .bot-match-card {
    margin: 4px;
    padding: 12px;
    display: flex;
    border: 1px solid variables.$light-grey;
  }

  .bot-match-outcome {
    font-size: 24pt;
    font-weight: 600;
    font-family: "Open Sans", sans-serif;
    text-transform: uppercase;
    color: #333;
    width: 75px;
    display: flex;
    justify-content: center;
    margin-top: -4px;
  }

  .bot-match-card-main {
    flex-grow: 1;
    padding: 0 25px;
  }

  .bot-card-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
  }

  .opponent-name {
    font-size: 18pt;
    color: variables.$blue-primary;
    padding-bottom: 4px;
  }

  .match-errors {
    color: red;
    font-weight: 600;
    text-align: right;
  }

  .match-timestamp {
    text-align: right;
  }

  .bot-link {
    color: variables.$blue-primary;
    text-decoration: none;
  }

  .bot-link:hover {
    text-decoration: underline;
  }

  .bot-match-card:hover {
    background-color: rgb(246, 248, 250);
  }

  .bot-match-card-wrapper {
    text-decoration: none;
    color: black;
    display: block;
  }
</style>