[frontend] Cleanup template assets, add placeholders
This commit is contained in:
parent
530e4ac65d
commit
8811e3c2b9
13 changed files with 32 additions and 147 deletions
|
@ -2,7 +2,6 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NpgsqlTypes;
|
||||
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||
|
||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ using Iceshrimp.Backend.Controllers.Mastodon.Renderers;
|
|||
using Iceshrimp.Backend.Controllers.Mastodon.Schemas;
|
||||
using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities;
|
||||
using Iceshrimp.Backend.Controllers.Schemas;
|
||||
using Iceshrimp.Shared.Schemas;
|
||||
using Iceshrimp.Backend.Core.Database;
|
||||
using Iceshrimp.Backend.Core.Database.Tables;
|
||||
using Iceshrimp.Backend.Core.Middleware;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
<p role="alert">Page not found.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
|
@ -4,5 +4,5 @@ namespace Iceshrimp.Frontend.Core.Services;
|
|||
|
||||
internal class ApiService(HttpClient client)
|
||||
{
|
||||
internal NoteControllerModel Notes = new(client);
|
||||
internal readonly NoteControllerModel Notes = new(client);
|
||||
}
|
|
@ -26,6 +26,7 @@
|
|||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="wwwroot\assets\logo.png" />
|
||||
<_ContentIncludedByDefault Remove="wwwroot\assets\transparent.png" />
|
||||
<_ContentIncludedByDefault Remove="wwwroot\sample-data\weather.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -15,13 +15,8 @@
|
|||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="weather">
|
||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
|
||||
<NavLink class="nav-link" href="hub">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Hub demo
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -29,10 +29,6 @@
|
|||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.bi-list-nested-nav-menu {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
@page "/counter"
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count (edited): @_currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int _currentCount;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
_currentCount++;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
<h1>Placeholder</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
A frontend is being constructed here. This page will soon be more interesting.
|
|
@ -5,68 +5,69 @@
|
|||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group mb-3">
|
||||
<label>
|
||||
User:
|
||||
<input @bind="userInput" />
|
||||
<input class="form-control" @bind="_userInput"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group mb-3">
|
||||
<label>
|
||||
Message:
|
||||
<input @bind="messageInput" size="50" />
|
||||
<input class="form-control" @bind="_messageInput" size="50"/>
|
||||
</label>
|
||||
</div>
|
||||
<button @onclick="Send" disabled="@(!IsConnected)">Send</button>
|
||||
<button class="btn btn-primary" @onclick="Send" disabled="@(!IsConnected)">Send</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<ul id="messagesList">
|
||||
@foreach (var message in messages)
|
||||
@foreach (var message in _messages)
|
||||
{
|
||||
<li>@message</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
@code {
|
||||
private HubConnection? hubConnection;
|
||||
private List<string> messages = [];
|
||||
private string? userInput;
|
||||
private string? messageInput;
|
||||
private HubConnection? _hubConnection;
|
||||
private List<string> _messages = [];
|
||||
private string? _userInput;
|
||||
private string? _messageInput;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
hubConnection = new HubConnectionBuilder()
|
||||
.WithUrl(Navigation.ToAbsoluteUri("/hubs/example"))
|
||||
.AddMessagePackProtocol()
|
||||
.Build();
|
||||
_hubConnection = new HubConnectionBuilder()
|
||||
.WithUrl(Navigation.ToAbsoluteUri("/hubs/example"))
|
||||
.AddMessagePackProtocol()
|
||||
.Build();
|
||||
|
||||
hubConnection.On<string, string>("ReceiveMessage", (user, message) =>
|
||||
_hubConnection.On<string, string>("ReceiveMessage", (user, message) =>
|
||||
{
|
||||
var encodedMsg = $"{user}: {message}";
|
||||
messages.Add(encodedMsg);
|
||||
_messages.Add(encodedMsg);
|
||||
InvokeAsync(StateHasChanged);
|
||||
});
|
||||
|
||||
await hubConnection.StartAsync();
|
||||
await _hubConnection.StartAsync();
|
||||
}
|
||||
|
||||
private async Task Send()
|
||||
{
|
||||
if (hubConnection is not null)
|
||||
if (_hubConnection is not null)
|
||||
{
|
||||
await hubConnection.SendAsync("SendMessage", userInput, messageInput);
|
||||
await _hubConnection.SendAsync("SendMessage", _userInput, _messageInput);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsConnected =>
|
||||
hubConnection?.State == HubConnectionState.Connected;
|
||||
_hubConnection?.State == HubConnectionState.Connected;
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (hubConnection is not null)
|
||||
if (_hubConnection is not null)
|
||||
{
|
||||
await hubConnection.DisposeAsync();
|
||||
await _hubConnection.DisposeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
@page "/TestNote/{id}"
|
||||
@page "/notes/{id}"
|
||||
@using Iceshrimp.Frontend.Core.Miscellaneous
|
||||
@using Iceshrimp.Frontend.Core.Services
|
||||
@using Iceshrimp.Shared.Schemas
|
||||
@inject ApiService Api
|
||||
<h3>TestNote</h3>
|
||||
<h3>Authenticated note preview</h3>
|
||||
|
||||
@if (_note != null)
|
||||
{
|
|
@ -1,60 +0,0 @@
|
|||
@page "/weather"
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
@if (_forecasts == null)
|
||||
{
|
||||
<p>
|
||||
<em>Loading...</em>
|
||||
</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in _forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? _forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
}
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public string? Summary { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
[
|
||||
{
|
||||
"date": "2022-01-06",
|
||||
"temperatureC": 1,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-07",
|
||||
"temperatureC": 14,
|
||||
"summary": "Bracing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-08",
|
||||
"temperatureC": -13,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-09",
|
||||
"temperatureC": -16,
|
||||
"summary": "Balmy"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-10",
|
||||
"temperatureC": -2,
|
||||
"summary": "Chilly"
|
||||
}
|
||||
]
|
Loading…
Add table
Reference in a new issue