Working on guide

This commit is contained in:
Max 2023-04-28 21:58:36 +02:00
parent 098cd7bac3
commit 40a61d5396
9 changed files with 91 additions and 9 deletions

View File

@ -0,0 +1,10 @@
namespace SharpRss.Models
{
public class CategoryItem
{
public string CategoryId { get; set; }
public string CategoryName { get; set; }
public string CategoryIcon { get; set; }
}
}

View File

@ -5,6 +5,10 @@ namespace SharpRss
{ {
public class RssService public class RssService
{ {
public RssService()
{
//TODO: Check if db exists else create.
}
public async void GetFeeds() public async void GetFeeds()
{ {
//TODO: Load from db or something. //TODO: Load from db or something.
@ -20,5 +24,10 @@ namespace SharpRss
} }
private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" }; private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" };
private void CheckDbExist()
{
}
} }
} }

View File

@ -11,9 +11,7 @@
<MudText Typo="Typo.h6">SharpRSS</MudText> <MudText Typo="Typo.h6">SharpRSS</MudText>
</MudAppBar> </MudAppBar>
<MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always"> <MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
<MudNavMenu Color="Color.Primary"> <SideGuide/>
<MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
</MudNavMenu>
</MudDrawer> </MudDrawer>
<MudMainContent> <MudMainContent>
@Body @Body

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
using CodeHollow.FeedReader;
namespace WebSharpRSS.Models
{
public class CategoryTreeItem
{
public string CategoryTitle { get; set; }
public string CategoryIcon { get; set; }
public bool IsExpanded { get; set; }
public HashSet<Feed> Feeds { get; set; } = new HashSet<Feed>() { FeedReader.ReadAsync("http://fedoramagazine.org/feed/").Result };
}
}

View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
using CodeHollow.FeedReader;
namespace WebSharpRSS.Models
{
public class FeedTreeItem
{
public FeedTreeItem(Feed feed)
{
_feed = feed;
}
private readonly Feed _feed;
}
}

View File

@ -1,7 +1,7 @@
@page "/" @page "/"
@inject RssService _rssService @inject RssService _rssService
<MudGrid Style="margin-left: 5px; margin-top: 5px"> @*<MudGrid Style="margin-left: 5px; margin-top: 5px">
@for (int i = 0; i < 10; i++) @for (int i = 0; i < 10; i++)
{ {
<MudCard Style="margin: 3px"> <MudCard Style="margin: 3px">
@ -18,7 +18,7 @@
</MudCard> </MudCard>
} }
</MudGrid> </MudGrid>*@
@code { @code {

View File

@ -0,0 +1,41 @@
@using WebSharpRSS.Models
@using MudBlazor.Utilities
<MudList DisableGutters="true">
<MudListItem>
<MudNavMenu>
<MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
</MudNavMenu>
</MudListItem>
<MudDivider/>
<MudListItem>
<MudTreeView Items="Categories" Hover="true" ExpandOnClick="true" @bind-SelectedValue="SelectedItem">
<ItemTemplate>
<MudTreeViewItem @bind-Expanded="@context.IsExpanded" Icon="@context.CategoryIcon" Text="@context.CategoryTitle" Value="@context">
<ChildContent>
<MudTable Items="@context.Feeds">
<RowTemplate Context="feedContext">
<MudTd>
<MudText>@feedContext.Title</MudText>
</MudTd>
</RowTemplate>
</MudTable>
</ChildContent>
</MudTreeViewItem>
</ItemTemplate>
</MudTreeView>
</MudListItem>
</MudList>
@code {
public HashSet<CategoryTreeItem> Categories = new HashSet<CategoryTreeItem>();
protected override void OnInitialized()
{
Categories.Add(new CategoryTreeItem() { CategoryTitle = "Test cat.", 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 = "News", CategoryIcon = Icons.Material.Filled.Newspaper });
}
CategoryTreeItem SelectedItem { get; set; }
}

View File

@ -15,8 +15,4 @@
<ProjectReference Include="..\SharpRss\SharpRss.csproj" /> <ProjectReference Include="..\SharpRss\SharpRss.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Shared" />
</ItemGroup>
</Project> </Project>

View File

@ -4,3 +4,4 @@
@using WebSharpRSS @using WebSharpRSS
@using MudBlazor @using MudBlazor
@using SharpRss @using SharpRss
@using WebSharpRSS.Shared