Added voice work image fallback. Added tag/creator/circle chip components. Updated voice work search response to include favorite/blacklisted flags for tags/creators/circles.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div class="@ContainerClassees">
|
||||
<div class="@OverlayClasses"></div>
|
||||
<img class="@ImageClasses" loading="@LoadingAttribute" src="@Source" @onload="OnImageLoaded">
|
||||
<img class="@ImageClasses" loading="@LoadingAttribute" src="@currentSource" @onload="OnImageLoaded" @onerror="OnImageError">
|
||||
</div>
|
||||
|
||||
@code {
|
||||
@@ -8,7 +8,7 @@
|
||||
public required string Source { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string FallbackSource { get; set; } = "images/home/no_img_main.gif";
|
||||
public string FallbackSource { get; set; } = "images/web/home/not_found_img_main.png"; // "images/web/home/no_img_main.gif";
|
||||
|
||||
[Parameter]
|
||||
public bool LazyLoading { get; set; } = true;
|
||||
@@ -22,6 +22,10 @@
|
||||
[Parameter]
|
||||
public string? ImageClass { get; set; }
|
||||
|
||||
private string? currentSource;
|
||||
private bool hasSourceErrored = false;
|
||||
private bool hasFallbackSourceErrored = false;
|
||||
|
||||
private bool _isLoaded;
|
||||
private string? _lastSource;
|
||||
|
||||
@@ -33,6 +37,10 @@
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
currentSource = Source;
|
||||
hasSourceErrored = false;
|
||||
hasFallbackSourceErrored = false;
|
||||
|
||||
if (!string.Equals(_lastSource, Source, StringComparison.Ordinal))
|
||||
{
|
||||
_lastSource = Source;
|
||||
@@ -103,4 +111,20 @@
|
||||
{
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void OnImageError()
|
||||
{
|
||||
if (!hasSourceErrored && !string.IsNullOrEmpty(FallbackSource))
|
||||
{
|
||||
hasSourceErrored = true;
|
||||
currentSource = FallbackSource;
|
||||
StateHasChanged();
|
||||
}
|
||||
else if (!hasFallbackSourceErrored)
|
||||
{
|
||||
hasFallbackSourceErrored = true;
|
||||
currentSource = "images/web/home/not_found_img_main.png";
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user