2025-03-03 00:56:32 +01:00
|
|
|
@using Blazorise
|
|
|
|
|
@using WatchIt.Website.Components.Subcomponents.Common
|
|
|
|
|
@using WatchIt.Website.Components.Panels.Common
|
|
|
|
|
|
|
|
|
|
@typeparam TItem
|
|
|
|
|
@typeparam TEntity where TEntity : class
|
|
|
|
|
@typeparam TQuery where TQuery : WatchIt.DTO.Query.IFilterQuery<TEntity>
|
|
|
|
|
|
|
|
|
|
@inherits Component
|
2024-10-02 01:08:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<CascadingValue Value="this">
|
|
|
|
|
<div class="vstack gap-3">
|
2025-03-03 00:56:32 +01:00
|
|
|
<div class="panel panel-section-header z-3">
|
2024-10-02 01:08:52 +02:00
|
|
|
<div class="container-grid">
|
|
|
|
|
<div class="row gx-3">
|
|
|
|
|
<div class="col">
|
2025-03-03 00:56:32 +01:00
|
|
|
<h3 class="fw-bold m-0">@(Title)</h3>
|
2024-10-02 01:08:52 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="col-auto align-self-center">
|
|
|
|
|
<div class="input-group input-group-sm">
|
|
|
|
|
<span class="input-group-text">Order by</span>
|
|
|
|
|
<select class="form-select" @onchange="SortingOptionChanged">
|
|
|
|
|
@foreach (KeyValuePair<string, string> sortingOption in SortingOptions)
|
|
|
|
|
{
|
|
|
|
|
<option value="@(sortingOption.Key)">@(sortingOption.Value)</option>
|
|
|
|
|
}
|
|
|
|
|
</select>
|
|
|
|
|
<input type="checkbox" class="btn-check" id="sortingAscending" autocomplete="off" @onchange="SortingAscendingChanged">
|
|
|
|
|
<label class="btn btn-outline-secondary" for="sortingAscending">↓︎</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-auto align-self-center">
|
|
|
|
|
<div class="d-flex">
|
|
|
|
|
<Dropdown RightAligned>
|
|
|
|
|
<DropdownToggle Color="Color.Secondary" Size="Size.Small">
|
|
|
|
|
<i class="fa fa-filter"></i>
|
|
|
|
|
</DropdownToggle>
|
|
|
|
|
<DropdownMenu Class="p-2">
|
|
|
|
|
<DropdownHeader>Filters</DropdownHeader>
|
|
|
|
|
<DropdownDivider/>
|
|
|
|
|
@(ChildContent)
|
|
|
|
|
<DropdownDivider/>
|
|
|
|
|
<button class="btn btn-secondary btn-sm w-100" @onclick="FilterApplied">Apply</button>
|
|
|
|
|
</DropdownMenu>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@if (_loaded)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_error))
|
|
|
|
|
{
|
2024-10-21 21:44:24 +02:00
|
|
|
if (_items.Count > 0)
|
2024-10-02 01:08:52 +02:00
|
|
|
{
|
2024-10-21 21:44:24 +02:00
|
|
|
foreach (TItem item in _items)
|
|
|
|
|
{
|
2025-03-03 00:56:32 +01:00
|
|
|
long id = IdFunc(item);
|
2024-10-24 23:15:09 +02:00
|
|
|
string url = string.Format(UrlIdTemplate, id);
|
|
|
|
|
<div class="panel p-2">
|
2025-03-03 00:56:32 +01:00
|
|
|
<VerticalListItem Name="@(NameFunc(item))"
|
|
|
|
|
AdditionalInfo="@(AdditionalNameInfoFunc(item))"
|
|
|
|
|
PicturePlaceholder="@(PicturePlaceholder)"
|
|
|
|
|
PictureFunc="@(() => PictureFunc(item))"
|
|
|
|
|
GlobalRating="@(GlobalRatingFunc(item))"
|
|
|
|
|
SecondaryRatingTitle="@(SecondaryRatingTitle)"
|
|
|
|
|
GetGlobalRatingMethod="@(() => GetGlobalRatingMethod(item))"
|
|
|
|
|
GetSecondaryRatingMethod="@(GetSecondaryRatingMethod is not null ? () => GetSecondaryRatingMethod(item) : null)"
|
|
|
|
|
GetYourRatingMethod="@(GetYourRatingMethod is not null ? async userId => (int?)(await GetYourRatingMethod(item, userId))?.Rating : null)"
|
|
|
|
|
PutYourRatingMethod="@(PutYourRatingMethod is not null ? request => PutYourRatingMethod(item, request) : null)"
|
|
|
|
|
DeleteYourRatingMethod="@(DeleteYourRatingMethod is not null ? () => DeleteYourRatingMethod(item) : null)"
|
|
|
|
|
ItemUrl="@(url)"/>
|
2024-10-21 21:44:24 +02:00
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
if (!_allItemsLoaded)
|
|
|
|
|
{
|
|
|
|
|
<div role="button" class="rounded-3 panel panel-regular p-3" @onclick="DownloadItems">
|
|
|
|
|
<div class="d-flex justify-content-center">
|
|
|
|
|
@if (!_itemsLoading)
|
|
|
|
|
{
|
|
|
|
|
<strong>Load more</strong>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
|
|
|
<strong>Loading...</strong>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
2024-10-02 01:08:52 +02:00
|
|
|
}
|
2024-10-21 21:44:24 +02:00
|
|
|
else
|
2024-10-02 01:08:52 +02:00
|
|
|
{
|
2024-10-21 21:44:24 +02:00
|
|
|
<div class="panel">
|
2024-10-02 01:08:52 +02:00
|
|
|
<div class="d-flex justify-content-center">
|
2024-10-21 21:44:24 +02:00
|
|
|
<span>No items found</span>
|
2024-10-02 01:08:52 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-03-03 00:56:32 +01:00
|
|
|
<ErrorPanel ErrorMessage="@_error"/>
|
2024-10-02 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="m-5">
|
2025-03-03 00:56:32 +01:00
|
|
|
<Loading/>
|
2024-10-02 01:08:52 +02:00
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
|