features/loading-data-by-source #3

Merged
jtom38 merged 8 commits from features/loading-data-by-source into main 2023-06-15 21:55:19 -07:00
Showing only changes of commit 4fd51e24d0 - Show all commits

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()
{ {