Added tags to sources
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
James Tombleson 2023-06-15 21:54:17 -07:00
parent ac5efe3113
commit 4fd51e24d0

View File

@ -1,4 +1,4 @@
@page "/sources/list"
@page "/sources"
@using Newsbot.Collector.Client
@using Newsbot.Collector.Client.Domain.Dto
@ -8,6 +8,7 @@
<tr>
<td>Title</td>
<td>Publish Date</td>
<td>Tags</td>
</tr>
@foreach (var item in Data ??= new List<SourcesDto>())
{
@ -21,12 +22,34 @@
<a href="@item.Url" target="_blank">@item.Name</a><br/>
</td>
<td>@item.Source</td>
<td>@FlattenTags(@item.Tags ??= new List<string>())</td>
<td>
<a href="/articles/sources/@item.Id">View News</a>
</td>
</tr>
}
</table>
@code {
private List<SourcesDto> Data { get; set; }
private List<SourcesDto>? Data { get; set; }
private string FlattenTags(List<string> tags)
{
string res = "";
foreach (var tag in tags)
{
if (res == "")
{
res = tag;
}
else
{
res += $", {tag}";
}
}
return res;
}
protected override async Task OnInitializedAsync()
{