More changes from feedback.

This commit is contained in:
Unnoen
2022-01-28 16:27:31 +11:00
parent 2c99f1f4f8
commit 95f9263984
4 changed files with 15 additions and 9 deletions

View File

@ -4,7 +4,10 @@
<div id="content"> <div id="content">
<div class="install-background"> <div class="install-background">
<img id="background-image" src="@ModlistImage" alt=""/> @if (ModlistImage is not null)
{
<img id="background-image" src="@ModlistImage" alt=""/>
}
</div> </div>
<div class="list"> <div class="list">
@if (Modlist is not null) @if (Modlist is not null)
@ -13,7 +16,10 @@
<InfoBlock Title="@Modlist.Name" Subtitle="@Modlist.Author" Comment="@Modlist.Version.ToString()" Description="@Modlist.Description"/> <InfoBlock Title="@Modlist.Name" Subtitle="@Modlist.Author" Comment="@Modlist.Version.ToString()" Description="@Modlist.Description"/>
</div> </div>
<div class="right-side"> <div class="right-side">
<InfoImage Image="@ModlistImage"/> @if (ModlistImage is not null)
{
<InfoImage Image="@ModlistImage"/>
}
</div> </div>
} }
</div> </div>

View File

@ -27,7 +27,7 @@ public partial class Configure
[Inject] private IToastService toastService { get; set; } [Inject] private IToastService toastService { get; set; }
private ModList? Modlist => StateContainer.Modlist; private ModList? Modlist => StateContainer.Modlist;
private string ModlistImage => StateContainer.ModlistImage; private string? ModlistImage => StateContainer.ModlistImage;
private AbsolutePath ModlistPath => StateContainer.ModlistPath; private AbsolutePath ModlistPath => StateContainer.ModlistPath;
private AbsolutePath InstallPath => StateContainer.InstallPath; private AbsolutePath InstallPath => StateContainer.InstallPath;
private AbsolutePath DownloadPath => StateContainer.DownloadPath; private AbsolutePath DownloadPath => StateContainer.DownloadPath;
@ -81,7 +81,7 @@ public partial class Configure
{ {
var imageStream = await StandardInstaller.ModListImageStream(ModlistPath); var imageStream = await StandardInstaller.ModListImageStream(ModlistPath);
var dotnetImageStream = new DotNetStreamReference(imageStream); var dotnetImageStream = new DotNetStreamReference(imageStream);
StateContainer.ModlistImage = new string(await JSRuntime.InvokeAsync<string>("getBlobUrlFromStream", dotnetImageStream)); StateContainer.ModlistImage = await JSRuntime.InvokeAsync<string>("getBlobUrlFromStream", dotnetImageStream);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -26,8 +26,8 @@ public interface IStateContainer
IObservable<ModList?> ModlistObservable { get; } IObservable<ModList?> ModlistObservable { get; }
ModList? Modlist { get; set; } ModList? Modlist { get; set; }
IObservable<string> ModlistImageObservable { get; } IObservable<string?> ModlistImageObservable { get; }
string ModlistImage { get; set; } string? ModlistImage { get; set; }
IObservable<InstallState> InstallStateObservable { get; } IObservable<InstallState> InstallStateObservable { get; }
InstallState InstallState { get; set; } InstallState InstallState { get; set; }

View File

@ -79,9 +79,9 @@ public class StateContainer : IStateContainer
set => _modlistObservable.Value = value; set => _modlistObservable.Value = value;
} }
private readonly CustomObservable<string> _modlistImageObservable = new(string.Empty); private readonly CustomObservable<string?> _modlistImageObservable = new(string.Empty);
public IObservable<string> ModlistImageObservable => _modlistImageObservable; public IObservable<string?> ModlistImageObservable => _modlistImageObservable;
public string ModlistImage public string? ModlistImage
{ {
get => _modlistImageObservable.Value; get => _modlistImageObservable.Value;
set => _modlistImageObservable.Value = value; set => _modlistImageObservable.Value = value;