Skip to content

Commit cb73df3

Browse files
committed
Loading and Layout improvements
1 parent 0116bc5 commit cb73df3

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

Damselfly.Core.ScopedServices/BaseSearchService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ public string SearchBreadcrumbs
433433
{
434434
get
435435
{
436-
var hints = new List<string>();
436+
var hints = SearchHints;
437437

438438
if( hints.Any() )
439-
return string.Join(", ", hints);
439+
return string.Join(", ", hints.Select( x => x.Description));
440440

441441
return "No Filter";
442442
}

Damselfly.Web.Client/Components/ImageBrowser/ImageGrid.razor

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@
1313
<div class="imagegrid" id="scroll-area">
1414
@if ( !gridImages.Any() )
1515
{
16-
<ProgressSpinner ProgressText="@ResultsMessage"/>
16+
@if( NoResultsFound )
17+
{
18+
<div class="no-results">
19+
<text>No images were found that match the filter:</text>
20+
<text>@searchService.SearchBreadcrumbs</text>
21+
</div>
22+
}
23+
else
24+
{
25+
<ProgressSpinner ProgressText="@ResultsMessage"/>
26+
}
1727
}
1828
else
1929
{
@@ -87,7 +97,8 @@
8797

8898
[Parameter] public GridImageSize CurrentGridSize { get; set; }
8999

90-
public string ResultsMessage { get; set; }
100+
private string ResultsMessage { get; set; }
101+
private bool NoResultsFound { get; set; } = true;
91102

92103
async Task AddGroupToBasket(ImageGrouping grouping)
93104
{
@@ -252,13 +263,17 @@
252263

253264
private async Task AddImagesToGrid(bool moreDataAvaiable)
254265
{
266+
NoResultsFound = true;
267+
255268
if ( searchService.SearchResults.Any() )
256269
{
257270
ResultsMessage = $"Loading {searchService.SearchResults.Count()} images...";
258-
StateHasChanged();
271+
NoResultsFound = false;
259272

260273
foreach( var set in searchService.SearchResults.Chunk(25) )
261274
{
275+
StateHasChanged();
276+
262277
var toAdd = set.ExceptBy(gridImages.Select(x => x.ImageId), x => x).ToList();
263278

264279
var images = await imageCache.GetCachedImages(toAdd);
@@ -267,17 +282,13 @@
267282
{
268283
gridImages.AddRange(images);
269284
configService.Set(ConfigSettings.LoadedImages, gridImages.Count.ToString());
270-
StateHasChanged();
271285
}
272286
}
273287
}
274-
else
275-
{
276-
ResultsMessage = $"No images were found that match the filter:\n{searchService.SearchBreadcrumbs}";
277-
}
278288

279289
// Flag the 'more' div if we loaded at least as many as we requested.
280290
endOfImages = !moreDataAvaiable;
291+
StateHasChanged();
281292
}
282293

283294
}

Damselfly.Web.Client/Components/ImageBrowser/ImageGrid.razor.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
margin: 20px;
1414
}
1515

16+
.no-results {
17+
display: flex;
18+
flex-direction: column;
19+
justify-content: center;
20+
align-items: center;
21+
width: 100%;
22+
margin-top: 20px;
23+
}
24+
1625
.damselfly-searchmsg {
1726
display: flex;
1827
width: 100%;
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
.progress-spinner {
22
display: flex;
33
flex-direction: column;
4-
row-gap: 15px;
4+
row-gap: 10px;
55
align-items: center;
66
justify-content: space-around;
77
align-content: center;
8-
margin-top: 20px;
9-
margin-bottom: 20px;
108
width: 100%;
9+
height: 100%;
1110
animation: fadeIn ease 1s;
1211
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const CACHE_VERSION='4.2.1-20241230130224'
1+
const CACHE_VERSION='4.2.1-20241230143627'

0 commit comments

Comments
 (0)