Add "Browse Depot" button when library is empty

This commit is contained in:
Pat Hartl 2025-02-28 23:59:18 -06:00
parent 61b30021ef
commit 887b381b43
2 changed files with 38 additions and 19 deletions

View file

@ -26,6 +26,7 @@
z-index: 500;
width: 320px;
margin-top: 74px;
min-height: calc(100% - 74px);
flex-shrink: 0;
.ant-collapse {
@ -105,6 +106,14 @@
flex-grow: 1;
}
}
.ant-empty {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
background: rgba(255, 255, 255, 0.04);
}
.ant-collapse-header-text {
cursor: pointer;

View file

@ -4,31 +4,41 @@
@inject LibraryService LibraryService
@inject ImportService ImportService
@inject MessageBusService MessageBusService
@inject NavigationManager NavigationManager
<Flex Vertical Class="library-list">
<Collapse>
@if (Groups.Count > 1)
{
foreach (var group in Groups.OrderByTitle(g => g))
@if (LibraryItems == null || !LibraryItems.Any())
{
<Empty Simple Description="false">
<Button Type="ButtonType.Primary" OnClick="@(() => NavigationManager.NavigateTo("/Depot"))">Browse Depot</Button>
</Empty>
}
else
{
<Collapse>
@if (Groups.Count > 1)
{
<Panel Header="@group" Key="@group">
<AntList DataSource="@(LibraryItems.Where(i => i.Groups.Contains(group) || (group == "Uncategorized" && !i.Groups.Any())))" TItem="Models.ListItem" Class="ant-list-clickable" Size="ListSize.Small">
<LibraryListItem Model="@context" OnClick="() => SelectItem(context)" @bind-SelectedItem="SelectedItem" />
foreach (var group in Groups.OrderByTitle(g => g))
{
<Panel Header="@group" Key="@group">
<AntList DataSource="@(LibraryItems.Where(i => i.Groups.Contains(group) || (group == "Uncategorized" && !i.Groups.Any())))" TItem="Models.ListItem" Class="ant-list-clickable" Size="ListSize.Small">
<LibraryListItem Model="@context" OnClick="() => SelectItem(context)" @bind-SelectedItem="SelectedItem"/>
</AntList>
</Panel>
}
}
else
{
<Panel Class="no-header">
<AntList DataSource="LibraryItems" TItem="Models.ListItem" Class="ant-list-clickable" Size="ListSize.Small">
<LibraryListItem Model="@context" OnClick="() => SelectItem(context)" @bind-SelectedItem="SelectedItem"/>
</AntList>
</Panel>
}
}
else
{
<Panel Class="no-header">
<AntList DataSource="LibraryItems" TItem="Models.ListItem" Class="ant-list-clickable" Size="ListSize.Small">
<LibraryListItem Model="@context" OnClick="() => SelectItem(context)" @bind-SelectedItem="SelectedItem" />
</AntList>
</Panel>
}
</Collapse>
<LibraryItemFilter />
</Collapse>
<LibraryItemFilter/>
}
</Flex>
@code {