using a card view to show the posts
This commit is contained in:
parent
7a7cd9966b
commit
ac5efe3113
@ -1,7 +1,9 @@
|
||||
@page "/articles/newest"
|
||||
@page "/articles/latest"
|
||||
@using Newsbot.Collector.Client
|
||||
@using Newsbot.Collector.Client.Domain.Dto
|
||||
<h3>List Articles</h3>
|
||||
|
||||
<PageTitle>Latest</PageTitle>
|
||||
<h3>Latest Posts</h3>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@ -11,7 +13,10 @@
|
||||
<div class="card" style="width: 18rem;">
|
||||
<img src="@item.Thumbnail" class="card-img-top" alt="...">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">@item.Title</h5>
|
||||
<h5 class="card-title">
|
||||
<a href="@item.Url" target="_blank">@item.Title</a>
|
||||
</h5>
|
||||
<p class="card-text">@item.PubDate</p>
|
||||
<p class="card-text">@item.Description</p>
|
||||
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
|
||||
</div>
|
@ -2,32 +2,42 @@
|
||||
@using Newsbot.Collector.Client.Domain.Dto
|
||||
@using Newsbot.Collector.Client
|
||||
|
||||
<h3>ListBySource</h3>
|
||||
<PageTitle>@Record?.Name</PageTitle>
|
||||
<h3>@Record?.Name</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Title</td>
|
||||
<td>Publish Date</td>
|
||||
</tr>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@foreach (var item in Data ??= new List<ArticlesDto>())
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<a href="@item.Url" target="_blank">@item.Title</a><br/>
|
||||
</td>
|
||||
<td>@item.PubDate</td>
|
||||
</tr>
|
||||
<div class="col-sm">
|
||||
<div class="card" style="width: 18rem;">
|
||||
<img src="@item.Thumbnail" class="card-img-top" alt="...">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="@item.Url" target="_blank">@item.Title</a>
|
||||
</h5>
|
||||
<p class="card-text">@item.PubDate</p>
|
||||
<p class="card-text">@item.Description</p>
|
||||
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? Id { get; set; }
|
||||
|
||||
List<ArticlesDto>? Data { get; set; }
|
||||
SourcesDto? Record { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var s = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||
Record = await s.GetAsync(Guid.Parse(Id ?? ""));
|
||||
|
||||
var c = new ArticlesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||
var items = await c.ListBySourceAsync(Guid.Parse(Id ?? ""));
|
||||
Data = items;
|
||||
|
@ -1,33 +0,0 @@
|
||||
@page "/articles/sources"
|
||||
@using Newsbot.Collector.Client
|
||||
@using Newsbot.Collector.Client.Domain.Dto
|
||||
<h3>Select Source</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Source</td>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
</tr>
|
||||
@foreach (var item in Items ??= new List<SourcesDto>())
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Source</td>
|
||||
<td>
|
||||
<a href="/articles/sources/@item.Id">@item.Name</a>
|
||||
</td>
|
||||
<td>@item.Type</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
||||
@code {
|
||||
private List<SourcesDto>? Items { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var c = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||
Items = await c.ListAsync();
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user