Implementing side guide.

This commit is contained in:
Max 2023-04-29 19:40:16 +02:00
parent 40a61d5396
commit fd72011480
2 changed files with 46 additions and 27 deletions

View File

@ -9,6 +9,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.6" /> <PackageReference Include="CodeHollow.FeedReader" Version="1.2.6" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,41 +1,58 @@
@using WebSharpRSS.Models @using WebSharpRSS.Models
@using MudBlazor.Utilities @using MudBlazor.Utilities
@using CodeHollow.FeedReader
@using Serilog
<MudList DisableGutters="true"> <MudStack Spacing="2">
<MudListItem> <MudNavMenu>
<MudNavMenu> <MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
<MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink> </MudNavMenu>
</MudNavMenu> <MudList DisableGutters="true" Clickable="true" Color="Color.Warning" SelectedItemChanged="Callback">
</MudListItem> <MudListSubheader>
<MudDivider/> Categories
<MudListItem> </MudListSubheader>
<MudTreeView Items="Categories" Hover="true" ExpandOnClick="true" @bind-SelectedValue="SelectedItem"> @foreach (CategoryTreeItem cat in Categories)
<ItemTemplate> {
<MudTreeViewItem @bind-Expanded="@context.IsExpanded" Icon="@context.CategoryIcon" Text="@context.CategoryTitle" Value="@context"> /* Category item*/
<ChildContent> <MudListItem Class="pl-4" Text="@cat.CategoryTitle" Icon="@cat.CategoryIcon" @bind-Expanded="@cat.IsExpanded">
<MudTable Items="@context.Feeds"> <NestedList>
<RowTemplate Context="feedContext"> @if (cat.IsExpanded)
<MudTd> {
<MudText>@feedContext.Title</MudText> foreach (Feed feed in cat.Feeds)
</MudTd> {
</RowTemplate> /* Feed item */
</MudTable> <MudListItem Value="feed">
</ChildContent> <MudImage ObjectFit="ObjectFit.ScaleDown" Height="16" Width="16" Class="d-inline" Src="https://fedoramagazine.org/wp-content/themes/fedoramagazine-1.15/favicon.ico"/>
</MudTreeViewItem> <MudText Class="d-inline">@feed.Title</MudText>
</ItemTemplate> </MudListItem>
</MudTreeView> }
</MudListItem> }
</MudList> </NestedList>
</MudListItem>
}
</MudList>
</MudStack>
@code { @code {
public HashSet<CategoryTreeItem> Categories = new HashSet<CategoryTreeItem>(); public HashSet<CategoryTreeItem> Categories = new HashSet<CategoryTreeItem>();
protected override void OnInitialized() protected override void OnInitialized()
{ {
Categories.Add(new CategoryTreeItem() { CategoryTitle = "Test cat.", CategoryIcon = Icons.Material.Filled.RssFeed }); Log.Verbose("Setting up test data");
Categories.Add(new CategoryTreeItem() { CategoryTitle = "Social", CategoryIcon = Icons.Material.Filled.People });
Categories.Add(new CategoryTreeItem() { CategoryTitle = "Blogs", CategoryIcon = Icons.Material.Filled.RssFeed }); Categories.Add(new CategoryTreeItem() { CategoryTitle = "Blogs", CategoryIcon = Icons.Material.Filled.RssFeed });
Categories.Add(new CategoryTreeItem() { CategoryTitle = "Tech", CategoryIcon = Icons.Material.Filled.Computer }); Categories.Add(new CategoryTreeItem() { CategoryTitle = "Tech", CategoryIcon = Icons.Material.Filled.Computer });
Categories.Add(new CategoryTreeItem() { CategoryTitle = "News", CategoryIcon = Icons.Material.Filled.Newspaper }); Categories.Add(new CategoryTreeItem() { CategoryTitle = "News", CategoryIcon = Icons.Material.Filled.Newspaper });
} }
CategoryTreeItem SelectedItem { get; set; } private void Callback(MudListItem obj)
{
switch (obj.Value)
{
case CategoryTreeItem catTreeItem:
break;
case Feed feed:
break;
}
}
} }