1
0

Replace ul with table for server items.

This commit is contained in:
Kevin Matsubara 2025-03-28 21:07:32 +01:00
parent e4ac3ab0d9
commit 2c8b50e8c5
2 changed files with 68 additions and 43 deletions

View File

@ -4,12 +4,31 @@
@if (Server != null)
{
<li @key="Server.Id" style="background-color: @GetBackgroundColor();">
@Server.Name in @Server.City is
<tr @key="Server.Id" style="background-color: @GetBackgroundColor();">
<td>
@Server.Name
</td>
<td>
@Server.City
</td>
<td>
<span style="color:@(Server.IsOnline ? "green" : "red")">
@(Server.IsOnline ? "online" : "offline")
</span>;
&nbsp;
</span>
</td>
<td>
@if (Server.IsOnline)
{
Random random = new Random();
int randomNumber = random.Next(0, 500);
<text>@randomNumber users online</text>
}
else
{
<text>N/A</text>
}
</td>
<td>
@if (Server.IsOnline)
{
<button type="button" class="btn btn-outline-danger"
@ -25,26 +44,17 @@
</button>
}
&nbsp;
@if (Server.IsOnline)
{
Random random = new Random();
int randomNumber = random.Next(0, 500);
<text>@randomNumber users online</text>
}
else
{
<text>N/A</text>
}
&nbsp;
<a href="@($"/servers/{Server.Id}")" class="btn btn-primary">Edit</a>
&nbsp;
</td>
<td>
<EditForm
Model="Server"
FormName="@($"formDeleteServer{Server.Id}")"
OnValidSubmit="@(() => { DeleteServer(Server.Id); })">
<button type="submit" class="btn btn-danger">Delete</button>
</EditForm>
</li>
</td>
</tr>
}
@code {

View File

@ -1,10 +1,25 @@
<ul class="list-unstyled">
<table class="table table-striped">
<RepeaterComponent Items="this.servers">
<Header>
<thead>
<tr>
<th>Name</th>
<th>City</th>
<th>Status</th>
<th>People online</th>
<th></th>
<th></th>
</tr>
</thead>
</Header>
<Row Context="server">
<ServerComponent server="server"></ServerComponent>
</Row>
<Footer>
</Footer>
</RepeaterComponent>
</ul>
</table>
@code {
private List<Server>? servers;