Added tags to sources
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
James Tombleson 2023-06-15 21:54:17 -07:00
parent ac5efe3113
commit 4fd51e24d0
1 changed files with 25 additions and 2 deletions

View File

@ -1,4 +1,4 @@
@page "/sources/list" @page "/sources"
@using Newsbot.Collector.Client @using Newsbot.Collector.Client
@using Newsbot.Collector.Client.Domain.Dto @using Newsbot.Collector.Client.Domain.Dto
@ -8,6 +8,7 @@
<tr> <tr>
<td>Title</td> <td>Title</td>
<td>Publish Date</td> <td>Publish Date</td>
<td>Tags</td>
</tr> </tr>
@foreach (var item in Data ??= new List<SourcesDto>()) @foreach (var item in Data ??= new List<SourcesDto>())
{ {
@ -21,12 +22,34 @@
<a href="@item.Url" target="_blank">@item.Name</a><br/> <a href="@item.Url" target="_blank">@item.Name</a><br/>
</td> </td>
<td>@item.Source</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> </tr>
} }
</table> </table>
@code { @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() protected override async Task OnInitializedAsync()
{ {