mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 12:54:20 +01:00
Working on guide
This commit is contained in:
parent
098cd7bac3
commit
40a61d5396
10
SharpRss/Models/CategoryItem.cs
Normal file
10
SharpRss/Models/CategoryItem.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
|
@ -5,6 +5,10 @@ namespace SharpRss
|
|||
{
|
||||
public class RssService
|
||||
{
|
||||
public RssService()
|
||||
{
|
||||
//TODO: Check if db exists else create.
|
||||
}
|
||||
public async void GetFeeds()
|
||||
{
|
||||
//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 void CheckDbExist()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,9 +11,7 @@
|
|||
<MudText Typo="Typo.h6">SharpRSS</MudText>
|
||||
</MudAppBar>
|
||||
<MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
|
||||
<MudNavMenu Color="Color.Primary">
|
||||
<MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
|
||||
</MudNavMenu>
|
||||
<SideGuide/>
|
||||
</MudDrawer>
|
||||
<MudMainContent>
|
||||
@Body
|
||||
|
|
13
WebSharpRSS/Models/CategoryTreeItem.cs
Normal file
13
WebSharpRSS/Models/CategoryTreeItem.cs
Normal 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 };
|
||||
}
|
||||
}
|
14
WebSharpRSS/Models/FeedTreeItem.cs
Normal file
14
WebSharpRSS/Models/FeedTreeItem.cs
Normal 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;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
@page "/"
|
||||
@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++)
|
||||
{
|
||||
<MudCard Style="margin: 3px">
|
||||
|
@ -18,7 +18,7 @@
|
|||
</MudCard>
|
||||
}
|
||||
|
||||
</MudGrid>
|
||||
</MudGrid>*@
|
||||
|
||||
@code {
|
||||
|
||||
|
|
41
WebSharpRSS/Shared/SideGuide.razor
Normal file
41
WebSharpRSS/Shared/SideGuide.razor
Normal 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; }
|
||||
}
|
|
@ -15,8 +15,4 @@
|
|||
<ProjectReference Include="..\SharpRss\SharpRss.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Shared" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
@using WebSharpRSS
|
||||
@using MudBlazor
|
||||
@using SharpRss
|
||||
@using WebSharpRSS.Shared
|
Loading…
Reference in New Issue
Block a user