142 lines
4.9 KiB
Plaintext
142 lines
4.9 KiB
Plaintext
@using JSMR.Application.VoiceWorks.Queries.Search
|
|
@using JSMR.Domain.Enums
|
|
@using JSMR.UI.Blazor.Services
|
|
@using System.Globalization
|
|
|
|
<div class=@GetCardClasses(Product)>
|
|
<div class="j-voice-work-image-container">
|
|
<JImage OverlayClass="j-voice-work-image-overlay" ImageClass="j-voice-work-image" Source="@ImageUrlProvider.GetImageUrl(Product, "main")"></JImage>
|
|
</div>
|
|
<div class="j-voice-work-content">
|
|
<div class="j-product-title">
|
|
<a href="@Product.ProductUrl" target="_blank">@Product.ProductName</a>
|
|
</div>
|
|
<div class="j-product-contributors">
|
|
<span class="j-circle">
|
|
<MudChip T="string"
|
|
Href=@($"https://www.dlsite.com/maniax/circle/profile/=/maker_id/{Product.MakerId}.html")
|
|
Target="_blank"
|
|
Variant="MudBlazor.Variant.Filled"
|
|
Icon="@Icons.Material.Outlined.Circle">@Product.Maker</MudChip>
|
|
@foreach (var creator in Product.Creators)
|
|
{
|
|
<MudChip T="string"
|
|
Href=@($"https://www.dlsite.com/maniax/fsr/=/keyword_creater/{creator.Name}")
|
|
Target="_blank"
|
|
Variant="MudBlazor.Variant.Filled"
|
|
Icon="@Icons.Material.Filled.Person">@creator.Name</MudChip>
|
|
}
|
|
</span>
|
|
</div>
|
|
<div class="j-product-description">@Product.Description</div>
|
|
<div class="j-tags">
|
|
@foreach (var tag in Product.Tags)
|
|
{
|
|
<div class="j-tag">@tag.Name</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="j-voice-work-info">
|
|
<div class="j-release-date-container">
|
|
<span class="j-icon j-icon-calendar"></span>
|
|
<span>@GetReleaseDateText(Product)</span>
|
|
</div>
|
|
<div class="j-wishlist-container">
|
|
<span class="j-icon j-icon-star j-icon-color-yellow"></span>
|
|
<span>@((Product.WishlistCount ?? 0).ToString("n0"))</span>
|
|
</div>
|
|
@if (Product.SalesDate is not null)
|
|
{
|
|
<div class="j-downloads-container">
|
|
<span class="j-icon j-icon-bag-fill j-icon-color-green"></span>
|
|
<span>@((Product.Downloads ?? 0).ToString("n0"))</span>
|
|
</div>
|
|
}
|
|
@* <div class="j-icon-2 j-icon-2-flag-@GetFlagClassSuffix(Product)"></div> *@
|
|
<div class="j-spacer"></div>
|
|
<div class="j-product-indicators">
|
|
@if (Product.IsValid != true)
|
|
{
|
|
<div class="j-product-indicator j-product-indicator-invalid">
|
|
<div class="j-icon j-icon-warning-fill"></div>
|
|
</div>
|
|
}
|
|
@if (Product.Favorite)
|
|
{
|
|
<div class="j-product-indicator j-product-indicator-favorite">
|
|
<div class="j-icon j-icon-heart-fill"></div>
|
|
</div>
|
|
}
|
|
@if (Product.HasTrial || Product.HasChobit)
|
|
{
|
|
<div class="j-trial-container">
|
|
<div class="j-icon j-icon-headphones"></div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public required VoiceWorkSearchResult Product { get; set; }
|
|
|
|
private string GetCardClasses(VoiceWorkSearchResult voiceWork)
|
|
{
|
|
List<string> classNames = ["j-card", "j-voice-work-card"];
|
|
|
|
if (voiceWork.Status == (byte)VoiceWorkStatus.NewRelease)
|
|
{
|
|
classNames.Add("type-sale");
|
|
}
|
|
else if (voiceWork.Status == (byte)VoiceWorkStatus.NewAndUpcoming)
|
|
{
|
|
classNames.Add("type-new");
|
|
}
|
|
|
|
return string.Join(" ", classNames);
|
|
}
|
|
|
|
private string GetReleaseDateText(VoiceWorkSearchResult voiceWork)
|
|
{
|
|
if (voiceWork.SalesDate.HasValue)
|
|
{
|
|
return voiceWork.SalesDate.Value.ToString("MMMM d, yyyy", CultureInfo.CurrentCulture);
|
|
}
|
|
|
|
if (voiceWork.PlannedReleaseDate.HasValue)
|
|
{
|
|
return voiceWork.PlannedReleaseDate.Value.ToString("MMMM d, yyyy", CultureInfo.CurrentCulture);
|
|
}
|
|
|
|
if (voiceWork.ExpectedDate.HasValue)
|
|
{
|
|
string part = voiceWork.ExpectedDate.Value.Day switch
|
|
{
|
|
21 => "Late",
|
|
11 => "Middle",
|
|
_ => "Early"
|
|
};
|
|
|
|
return $"{part} {voiceWork.ExpectedDate.Value.ToString("MMMM yyyy")}";
|
|
}
|
|
|
|
return "Unknown";
|
|
}
|
|
|
|
private string GetFlagClassSuffix(VoiceWorkSearchResult voiceWork)
|
|
{
|
|
switch (voiceWork.SubtitleLanguage)
|
|
{
|
|
case 1:
|
|
return "us";
|
|
case 2:
|
|
return "cn";
|
|
case 3:
|
|
return "kr";
|
|
default:
|
|
return "jp";
|
|
}
|
|
}
|
|
}
|