SharpRSS/WebSharpRSS/Shared/SyndicationListItem.razor

69 lines
3.3 KiB
Plaintext
Raw Normal View History

2023-05-26 21:54:12 +02:00
@using WebSharpRSS.Models
@using Serilog
@using ToolQit.Extensions
@inject IDialogService _dialogService
<MudStack Spacing="2" Class="ma-2">
@if (Items != null)
{
foreach (var feedItemData in Items)
{
<MudItem @onclick="@(() => Callback(feedItemData))">
<MudPaper Height="250" Width="300" Class="px-2">
<div style="justify-self: start;" class="d-flex align-center">
2023-06-23 19:36:58 +02:00
@if (feedItemData.SyndicationParent.Category != null && !feedItemData.SyndicationParent.Category.Icon.IsNullEmptyWhiteSpace())
{
<MudTooltip Text="@feedItemData.SyndicationParent.Category.Name">
<MudIcon Icon="@feedItemData.SyndicationParent.Category.Icon" Class="mr-1" Style="@($"color:{feedItemData.SyndicationParent.Category.HexColor}")"/>
</MudTooltip>
2023-06-23 19:36:58 +02:00
}
2023-06-17 14:34:49 +02:00
@if (feedItemData.SyndicationParent.ImageUrl != null)
2023-05-26 21:54:12 +02:00
{
<MudTooltip Text="@feedItemData.SyndicationParent.Title">
<MudImage Src="@feedItemData.SyndicationParent.ImageUrl" ObjectFit="ObjectFit.Contain" Width="20" Height="20"/>
</MudTooltip>
2023-05-26 21:54:12 +02:00
}
<div class="d-inline ma-2 align-center" style="font-size: 20px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical;">
2023-05-26 21:54:12 +02:00
@if (feedItemData.Title != null)
{
@((MarkupString)feedItemData.Title)
}
</div>
<MudText Typo="Typo.subtitle2" Color="Color.Secondary"> - @feedItemData.SyndicationParent.Title</MudText>
2023-05-26 21:54:12 +02:00
</div>
<div style="overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp:2; -webkit-box-orient: vertical;">
2023-05-26 21:54:12 +02:00
@if (feedItemData.Description != null && !feedItemData.Description.IsNullEmptyWhiteSpace())
{
@((MarkupString)feedItemData.Description)
}
else
{
<MudText Color="Color.Dark" Typo="Typo.body2">No description found!</MudText>
}
</div>
<MudText Typo="Typo.overline">@feedItemData.PublishingDate.ToString()</MudText>
</MudPaper>
</MudItem>
}
}
else
{
<MudAlert Severity="Severity.Info" Variant="Variant.Filled">No items to load!</MudAlert>
}
</MudStack>
@code {
[Parameter]
2023-06-16 22:53:26 +02:00
public HashSet<SyndicationItemData>? Items { get; set; }
2023-07-02 20:54:18 +02:00
DialogOptions _dialogOptions = new DialogOptions() { FullWidth = true, MaxWidth = MaxWidth.ExtraLarge, NoHeader = false, CloseButton = true, CloseOnEscapeKey = true };
2023-05-26 21:54:12 +02:00
2023-06-16 22:53:26 +02:00
private void Callback(SyndicationItemData syndicationItem)
2023-05-26 21:54:12 +02:00
{
var parameters = new DialogParameters();
2023-06-16 22:53:26 +02:00
parameters.Add("Data", syndicationItem);
2023-07-02 20:54:18 +02:00
_dialogService.Show<ReadDialog>("Custom", parameters, _dialogOptions);
2023-06-17 14:04:26 +02:00
Log.Verbose("Item: {ItemId} clicked", syndicationItem.Link);
2023-05-26 21:54:12 +02:00
}
}