show map info for matches
This commit is contained in:
parent
c80ce33279
commit
49a5735e07
3 changed files with 30 additions and 6 deletions
|
@ -15,6 +15,8 @@ use crate::{
|
|||
DatabaseConnection, GlobalConfig,
|
||||
};
|
||||
|
||||
use super::maps::ApiMap;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ApiMatch {
|
||||
id: i32,
|
||||
|
@ -22,6 +24,7 @@ pub struct ApiMatch {
|
|||
state: MatchState,
|
||||
players: Vec<ApiMatchPlayer>,
|
||||
winner: Option<i32>,
|
||||
map: Option<ApiMap>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -102,6 +105,7 @@ pub fn match_data_to_api(data: matches::FullMatchData) -> ApiMatch {
|
|||
})
|
||||
.collect(),
|
||||
winner: data.base.winner,
|
||||
map: data.map.map(|m| ApiMap { name: m.name }),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<th />
|
||||
<th />
|
||||
<th class="col-player-2">player 2</th>
|
||||
<th class="col-map">map</th>
|
||||
</tr>
|
||||
{#each matches as match}
|
||||
<tr class="match-table-row" on:click={() => goto(match_url(match))}>
|
||||
|
@ -38,6 +39,9 @@
|
|||
<td class="col-player-2">
|
||||
{match["players"][1]["bot_name"]}
|
||||
</td>
|
||||
<td class="col-map">
|
||||
{match["map"]?.name || ""}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
|
@ -84,6 +88,10 @@
|
|||
text-align: left;
|
||||
}
|
||||
|
||||
.col-map {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.matches-table {
|
||||
margin: 12px auto;
|
||||
border-collapse: collapse;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
import { debounce } from "$lib/utils";
|
||||
import SubmitPane from "$lib/components/SubmitPane.svelte";
|
||||
import OutputPane from "$lib/components/OutputPane.svelte";
|
||||
import BotName from "./bots/[bot_name].svelte";
|
||||
|
||||
enum ViewMode {
|
||||
Editor,
|
||||
|
@ -138,11 +139,12 @@
|
|||
on:click={() => selectMatch(match.id)}
|
||||
class:selected={match.id === selectedMatchId}
|
||||
>
|
||||
<span class="match-timestamp">{formatMatchTimestamp(match.timestamp)}</span>
|
||||
<!-- hex is hardcoded for now, don't show map name -->
|
||||
<!-- <span class="match-mapname">hex</span> -->
|
||||
<!-- ugly temporary hardcode -->
|
||||
<span class="match-opponent">{match["players"][1]["bot_name"]}</span>
|
||||
<div class="match-timestamp">{formatMatchTimestamp(match.timestamp)}</div>
|
||||
<div class="match-card-body">
|
||||
<!-- ugly temporary hardcode -->
|
||||
<div class="match-opponent">{match["players"][1]["bot_name"]}</div>
|
||||
<div class="match-map">{match["map"]?.name}</div>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
@ -221,14 +223,24 @@
|
|||
.match-card {
|
||||
padding: 10px 15px;
|
||||
font-size: 11pt;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.match-timestamp {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.match-card-body {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.match-opponent {
|
||||
padding: 0 0.5em;
|
||||
font-weight: 600;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.match-map {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
|
|
Loading…
Reference in a new issue