2023-04-27 17:23:01 +02:00
|
|
|
@page "/"
|
2023-05-17 16:03:04 +02:00
|
|
|
@using CodeHollow.FeedReader;
|
|
|
|
@using SharpRss.Models;
|
|
|
|
@using WebSharpRSS.Models;
|
2023-05-18 01:27:11 +02:00
|
|
|
@using SharpRss.Services
|
2023-04-27 17:23:01 +02:00
|
|
|
|
2023-05-17 16:03:04 +02:00
|
|
|
@inject FeedStateContainer _stateContainer;
|
2023-05-07 18:37:25 +02:00
|
|
|
|
2023-05-19 14:40:57 +02:00
|
|
|
<MudStack Spacing="2" Class="ml-2 mr-2">
|
2023-05-20 00:04:45 +02:00
|
|
|
@*@foreach (var feedItemData in _itemDatas)
|
2023-05-17 16:03:04 +02:00
|
|
|
{
|
2023-05-19 14:40:57 +02:00
|
|
|
<MudItem>
|
2023-05-18 20:15:31 +02:00
|
|
|
<MudCard>
|
|
|
|
<MudCardContent>
|
2023-05-19 14:40:57 +02:00
|
|
|
<div style="justify-self: start;" class="d-flex align-center">
|
|
|
|
@if (feedItemData.Icon != null)
|
|
|
|
{
|
|
|
|
<MudIcon Icon="@feedItemData.Icon" Style="@($"color:{feedItemData.CategoryColorHex}")" />
|
|
|
|
}
|
|
|
|
@if (feedItemData.FaviconUrl != null)
|
|
|
|
{
|
|
|
|
<MudImage Src="@feedItemData.FaviconUrl" ObjectFit="ObjectFit.Contain" />
|
|
|
|
}
|
|
|
|
<MudText Class="d-inline pa-2 align-center">@feedItemData.FeedItem.Title</MudText>
|
|
|
|
</div>
|
|
|
|
<MudText Typo="Typo.body2">@feedItemData.FeedItem.Description</MudText>
|
|
|
|
<MudText Typo="Typo.overline">@feedItemData.FeedItem.PublishingDate.ToString()</MudText>
|
2023-05-18 20:15:31 +02:00
|
|
|
</MudCardContent>
|
|
|
|
</MudCard>
|
|
|
|
</MudItem>
|
2023-05-20 00:04:45 +02:00
|
|
|
}*@
|
2023-05-19 14:40:57 +02:00
|
|
|
</MudStack>
|
2023-04-27 17:23:01 +02:00
|
|
|
|
|
|
|
@code {
|
2023-05-18 20:15:31 +02:00
|
|
|
protected override void OnInitialized()
|
2023-05-17 16:03:04 +02:00
|
|
|
{
|
|
|
|
UpdateFeeds();
|
2023-05-20 00:35:43 +02:00
|
|
|
//_stateContainer.StateChanged += FeedsChanged;
|
2023-05-17 16:03:04 +02:00
|
|
|
}
|
|
|
|
private void FeedsChanged()
|
|
|
|
{
|
|
|
|
UpdateFeeds();
|
|
|
|
InvokeAsync(StateHasChanged);
|
|
|
|
}
|
2023-05-20 00:04:45 +02:00
|
|
|
//private HashSet<FeedItemData> _itemDatas = new HashSet<FeedItemData>();
|
|
|
|
//private TreeItemData? _treeItemData;
|
2023-05-17 16:03:04 +02:00
|
|
|
private void UpdateFeeds()
|
|
|
|
{
|
2023-05-20 00:04:45 +02:00
|
|
|
|
|
|
|
/*if (_stateContainer.TreeItem == null) return;
|
2023-05-19 14:40:57 +02:00
|
|
|
_treeItemData = _stateContainer.TreeItem;
|
|
|
|
if (_treeItemData.Feed != null)
|
|
|
|
{
|
|
|
|
Feed feed = _treeItemData.Feed;
|
|
|
|
_itemDatas = feed.Items.Select(x => new FeedItemData(x) { Icon = _treeItemData.Icon, FaviconUrl = _treeItemData.FaviconUrl, CategoryColorHex = _treeItemData.CategoryModel?.HexColor }).ToHashSet();
|
|
|
|
}
|
|
|
|
else if (_treeItemData.Feeds != null)
|
2023-05-17 16:03:04 +02:00
|
|
|
{
|
2023-05-19 14:40:57 +02:00
|
|
|
HashSet<FeedItemData> items = new HashSet<FeedItemData>();
|
|
|
|
foreach (var treeItem in _treeItemData.Feeds)
|
2023-05-18 20:15:31 +02:00
|
|
|
{
|
2023-05-19 14:40:57 +02:00
|
|
|
if (treeItem.Feed == null) continue;
|
|
|
|
items.UnionWith(treeItem.Feed.Items.Select(x => new FeedItemData(x) { Icon = treeItem.Icon, FaviconUrl = treeItem.FaviconUrl, CategoryColorHex = _treeItemData.CategoryModel?.HexColor }));
|
|
|
|
_itemDatas = items.OrderBy(x => x.FeedItem.PublishingDate).Reverse().ToHashSet();
|
2023-05-18 20:15:31 +02:00
|
|
|
}
|
2023-05-20 00:04:45 +02:00
|
|
|
}*/
|
2023-05-17 16:03:04 +02:00
|
|
|
}
|
2023-04-27 17:23:01 +02:00
|
|
|
}
|