update
This commit is contained in:
40
RobotApp.Client/Pages/Components/Mapping/MapPreview.razor
Normal file
40
RobotApp.Client/Pages/Components/Mapping/MapPreview.razor
Normal file
@@ -0,0 +1,40 @@
|
||||
@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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user