41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
@inject HttpClient Http
|
|
|
|
<div class="d-flex flex-column h-100 w-100">
|
|
<span Class="title">@MapName</span>
|
|
<div class="d-flex flex-grow-1 w-100 flex-column">
|
|
<div class="map-item">
|
|
<img src="@imageSrc" alt="map image" onerror="this.onerror=null; this.src='/images/Image-not-found.png';" />
|
|
</div>
|
|
<MudButton StartIcon="@Icons.Material.Filled.FileDownload" Class="m-2" Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary" Disabled="Disable">
|
|
DOWNLOAD
|
|
</MudButton>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private bool Disable = true;
|
|
private string imageSrc = "/images/Image-not-found.png";
|
|
private string MapName = "Map preview";
|
|
private Guid MapId = Guid.Empty;
|
|
|
|
|
|
public void SetMapPreview(MapDto? map)
|
|
{
|
|
if (map is null)
|
|
{
|
|
Disable = true;
|
|
MapName = "Map preview";
|
|
imageSrc = "/images/Image-not-found.png";
|
|
MapId = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
imageSrc = $"api/Images/map/{map.Id}?t={DateTime.Now}";
|
|
MapName = map.Name;
|
|
MapId = map.Id;
|
|
Disable = false;
|
|
}
|
|
StateHasChanged();
|
|
}
|
|
}
|