Utilized more BitBlazor components. Added enhancements to voice work search.
This commit is contained in:
@@ -6,6 +6,11 @@
|
||||
@using JSMR.UI.Blazor.Filters
|
||||
@using JSMR.UI.Blazor.Services
|
||||
|
||||
<div class="search-toolbar">
|
||||
<BitMenuButton TItem="BitMenuButtonItem" Text="Presets" Items="presets" Variant="BitVariant.Outline" OnClick="test" />
|
||||
<BitToggleButton @bind-IsChecked="showAdvancedFilters" Text="@(showAdvancedFilters ? "Advanced" : "Basic")" Variant="BitVariant.Outline" />
|
||||
</div>
|
||||
|
||||
<div class="search-filter-control-container">
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitTextField Prefix="Keywords"
|
||||
@@ -69,94 +74,97 @@
|
||||
Value="@Value.CreatorStatus"
|
||||
ValueChanged="@(value => Update(Value with { CreatorStatus = value }))" />
|
||||
</div>
|
||||
<!-- Row 3 -->
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Tags"
|
||||
Items="tags"
|
||||
MultiSelect
|
||||
Virtualize
|
||||
ShowSearchBox
|
||||
AutoFocusSearchBox
|
||||
Chips
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<int>"
|
||||
TValue="int"
|
||||
Values="@Value.TagIds"
|
||||
ValuesChanged="@(values => Update(Value with { TagIds = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Include All Tags"
|
||||
Value="@Value.IncludeAllTags"
|
||||
ValueChanged="@(value => Update(Value with { IncludeAllTags = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1"></div>
|
||||
<!-- Row 4 -->
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Creators"
|
||||
Items="creators"
|
||||
MultiSelect
|
||||
Virtualize
|
||||
ShowSearchBox
|
||||
AutoFocusSearchBox
|
||||
Chips
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<int>"
|
||||
TValue="int"
|
||||
Values="@Value.CreatorIds"
|
||||
ValuesChanged="@(values => Update(Value with { CreatorIds = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Include All Creators"
|
||||
Value="@Value.IncludeAllCreators"
|
||||
ValueChanged="@(value => Update(Value with { IncludeAllCreators = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1"></div>
|
||||
<!-- Row 5 -->
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Show Only Favorite Works"
|
||||
Value="@Value.ShowFavorite"
|
||||
ValueChanged="@(value => Update(Value with { ShowFavorite = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Show Only Invalid Works"
|
||||
Value="@Value.ShowInvalid"
|
||||
ValueChanged="@(value => Update(Value with { ShowInvalid = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-2"></div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDropdown Label="Age Ratings"
|
||||
MultiSelect
|
||||
Items="ageRatings"
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<AgeRating>"
|
||||
TValue="AgeRating"
|
||||
Values="@Value.AgeRatings"
|
||||
ValuesChanged="@(values => Update(Value with { AgeRatings = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDatePicker Label="Release Date Start"
|
||||
ShowClearButton="true"
|
||||
Value="@ToDto(Value.ReleaseDateStart)"
|
||||
ValueChanged="@(value => Update(Value with { ReleaseDateStart = FromDto(value) }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDatePicker Label="Release Date End"
|
||||
ShowClearButton="true"
|
||||
Value="@ToDto(Value.ReleaseDateEnd)"
|
||||
ValueChanged="@(value => Update(Value with { ReleaseDateEnd = FromDto(value) }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Sort"
|
||||
Items="sortOptions"
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<VoiceWorkSort>"
|
||||
TValue="VoiceWorkSort"
|
||||
Value="@Value.Sort"
|
||||
ValueChanged="@(value => Update(Value with { Sort = value }))" />
|
||||
</div>
|
||||
@* <div class="search-filter-control-span-1">
|
||||
@if (showAdvancedFilters)
|
||||
{
|
||||
<!-- Row 3 -->
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Tags"
|
||||
Items="tags"
|
||||
MultiSelect
|
||||
Virtualize
|
||||
ShowSearchBox
|
||||
AutoFocusSearchBox
|
||||
Chips
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<int>"
|
||||
TValue="int"
|
||||
Values="@Value.TagIds"
|
||||
ValuesChanged="@(values => Update(Value with { TagIds = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Include All Tags"
|
||||
Value="@Value.IncludeAllTags"
|
||||
ValueChanged="@(value => Update(Value with { IncludeAllTags = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1"></div>
|
||||
<!-- Row 4 -->
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Creators"
|
||||
Items="creators"
|
||||
MultiSelect
|
||||
Virtualize
|
||||
ShowSearchBox
|
||||
AutoFocusSearchBox
|
||||
Chips
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<int>"
|
||||
TValue="int"
|
||||
Values="@Value.CreatorIds"
|
||||
ValuesChanged="@(values => Update(Value with { CreatorIds = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Include All Creators"
|
||||
Value="@Value.IncludeAllCreators"
|
||||
ValueChanged="@(value => Update(Value with { IncludeAllCreators = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1"></div>
|
||||
<!-- Row 5 -->
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Show Only Favorite Works"
|
||||
Value="@Value.ShowFavorite"
|
||||
ValueChanged="@(value => Update(Value with { ShowFavorite = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitCheckbox Label="Show Only Invalid Works"
|
||||
Value="@Value.ShowInvalid"
|
||||
ValueChanged="@(value => Update(Value with { ShowInvalid = value }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-2"></div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDropdown Label="Age Ratings"
|
||||
MultiSelect
|
||||
Items="ageRatings"
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<AgeRating>"
|
||||
TValue="AgeRating"
|
||||
Values="@Value.AgeRatings"
|
||||
ValuesChanged="@(values => Update(Value with { AgeRatings = [.. values] }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDatePicker Label="Release Date Start"
|
||||
ShowClearButton="true"
|
||||
Value="@ToDto(Value.ReleaseDateStart)"
|
||||
ValueChanged="@(value => Update(Value with { ReleaseDateStart = FromDto(value) }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-1">
|
||||
<BitDatePicker Label="Release Date End"
|
||||
ShowClearButton="true"
|
||||
Value="@ToDto(Value.ReleaseDateEnd)"
|
||||
ValueChanged="@(value => Update(Value with { ReleaseDateEnd = FromDto(value) }))" />
|
||||
</div>
|
||||
<div class="search-filter-control-span-2">
|
||||
<BitDropdown Prefix="Sort"
|
||||
Items="sortOptions"
|
||||
Placeholder="Select..."
|
||||
TItem="BitDropdownItem<VoiceWorkSort>"
|
||||
TValue="VoiceWorkSort"
|
||||
Value="@Value.Sort"
|
||||
ValueChanged="@(value => Update(Value with { Sort = value }))" />
|
||||
</div>
|
||||
@* <div class="search-filter-control-span-1">
|
||||
<BitSlider Label="Downloads" Min="0" Max="100000" Value="MinDownloads" ValueChanged="OnMinDownloadsChanged" />
|
||||
</div> *@
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
@@ -169,6 +177,8 @@
|
||||
[Parameter]
|
||||
public EventCallback<VoiceWorkFilterState> ValueChanged { get; set; }
|
||||
|
||||
private bool showAdvancedFilters { get; set; }
|
||||
|
||||
List<BitDropdownItem<Locale>> locales = [];
|
||||
List<BitDropdownItem<SaleStatus?>> saleStatuses = [];
|
||||
List<BitDropdownItem<CircleStatus?>> circleStatuses = [];
|
||||
@@ -180,6 +190,16 @@
|
||||
List<BitDropdownItem<int>> tags = [];
|
||||
List<BitDropdownItem<int>> creators = [];
|
||||
|
||||
private List<BitMenuButtonItem> presets =
|
||||
[
|
||||
new() { Text = "Default", Key = "Default" },
|
||||
new() { Text = "Released English", Key = "Released-English" },
|
||||
new() { Text = "Popular Upcoming", Key = "Favorite-Upcoming" },
|
||||
new() { Text = "Popular This Week", Key = "Popular-ThisWeek" },
|
||||
new() { Text = "Popular This Month", Key = "Popular-ThisMonth" },
|
||||
new() { Text = "Popular This Year", Key = "Popular-ThisYear" },
|
||||
];
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
locales = Lookups.GetLocales();
|
||||
@@ -205,4 +225,89 @@
|
||||
// Map DateTimeOffset? -> DateOnly?
|
||||
private static DateOnly? FromDto(DateTimeOffset? dto) =>
|
||||
dto is null ? null : DateOnly.FromDateTime(dto.Value.Date);
|
||||
|
||||
private async Task test(BitMenuButtonItem? item)
|
||||
{
|
||||
if (item is null)
|
||||
return;
|
||||
|
||||
if (item.Key == "Default")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Available,
|
||||
CircleStatus = CircleStatus.NotBlacklisted,
|
||||
TagStatus = TagStatus.NotBlacklisted,
|
||||
CreatorStatus = CreatorStatus.NotBlacklisted,
|
||||
SupportedLanguages = [Language.Japanese, Language.English],
|
||||
Locale = Locale.English
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
else if (item.Key == "Released-English")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Available,
|
||||
SupportedLanguages = [Language.English],
|
||||
Locale = Locale.English,
|
||||
Sort = VoiceWorkSort.ReleaseDateNewToOld
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
else if (item.Key == "Favorite-Upcoming")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Upcoming,
|
||||
CircleStatus = CircleStatus.Favorited,
|
||||
SupportedLanguages = [Language.Japanese, Language.English],
|
||||
Locale = Locale.English,
|
||||
Sort = VoiceWorkSort.MostFavorited
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
else if (item.Key == "Popular-ThisWeek")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Available,
|
||||
SupportedLanguages = [Language.Japanese, Language.English],
|
||||
Locale = Locale.English,
|
||||
Sort = VoiceWorkSort.BestSelling,
|
||||
ReleaseDateStart = DateOnly.FromDateTime(DateTime.Now.AddDays(-8))
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
else if (item.Key == "Popular-ThisMonth")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Available,
|
||||
SupportedLanguages = [Language.Japanese, Language.English],
|
||||
Locale = Locale.English,
|
||||
Sort = VoiceWorkSort.BestSelling,
|
||||
ReleaseDateStart = DateOnly.FromDateTime(DateTime.Now.AddDays(-29))
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
else if (item.Key == "Popular-ThisYear")
|
||||
{
|
||||
Value = new()
|
||||
{
|
||||
SaleStatus = SaleStatus.Available,
|
||||
SupportedLanguages = [Language.Japanese, Language.English],
|
||||
Locale = Locale.English,
|
||||
Sort = VoiceWorkSort.BestSelling,
|
||||
ReleaseDateStart = DateOnly.FromDateTime(DateTime.Now.AddDays(-366))
|
||||
};
|
||||
|
||||
_ = Update(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user