Switched to net9 and finished event workflow

This commit is contained in:
2026-01-18 19:30:20 +01:00
parent 8d0573eb7e
commit 2d3c973d47
23 changed files with 142 additions and 40 deletions

View File

@@ -2,8 +2,10 @@
@using SpotiParty.Web.Components.Components
@rendermode InteractiveServer
<PageTitle>SpotiParty</PageTitle>
<header>
<h1>🎵 SpotiParty</h1>
<h1>@(_event?.Name ?? " ")</h1>
<p>Suche ein Lied und füge es zur Warteschlange hinzu</p>
</header>
@@ -27,7 +29,7 @@
</main>
<footer>
<p>SpotiParty © @_currentYear</p>
<p><a href="https://git.leon-hoppe.de/leon.hoppe/spotiparty" target="_blank">SpotiParty</a> © @_currentYear</p>
</footer>
<dialog class="confirm-dialog" style="display: @(_selectedTrack is null ? "none" : "block")">

View File

@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.EntityFrameworkCore;
using SpotifyAPI.Web;
using SpotiParty.Web.Models;
using SpotiParty.Web.Services;
namespace SpotiParty.Web.Components.Pages;
@@ -9,6 +10,8 @@ public partial class EnqueuePage(AuthorizationHandler authHandler, NavigationMan
[Parameter]
public string EventId { get; set; } = string.Empty;
private Event? _event;
private readonly int _currentYear = DateTime.Now.Year;
private SpotifyClient _client = null!;
@@ -28,22 +31,24 @@ public partial class EnqueuePage(AuthorizationHandler authHandler, NavigationMan
return;
}
var eventEntry = await context.Events
_event = await context.Events
.Include(e => e.Host)
.FirstOrDefaultAsync(e => e.Id == guid);
if (eventEntry is null) {
navigator.NavigateTo("/", forceLoad: true);
return;
}
var now = DateTime.Now;
if (eventEntry.Start > now || eventEntry.End < now) {
if (_event is null) {
navigator.NavigateTo("/", forceLoad: true);
return;
}
var client = await authHandler.ConfigureClient(eventEntry.Host.UserId);
StateHasChanged();
var now = DateTime.Now;
if (_event.Start > now || _event.End < now) {
navigator.NavigateTo("/", forceLoad: true);
return;
}
var client = await authHandler.ConfigureClient(_event.Host.UserId);
if (client is null) {
navigator.NavigateTo("/", forceLoad: true);

View File

@@ -8,6 +8,7 @@
header h1 {
margin: 0;
font-size: 2rem;
height: 2rem;
&:focus {
outline: none;
@@ -63,6 +64,10 @@ footer {
text-align: center;
padding: 0.5rem;
background: var(--color-primary);
a {
color: var(--color-text);
}
}
.confirm-dialog {

View File

@@ -0,0 +1,6 @@
@page "/"
<h3>HomePage</h3>
@code {
}

View File

@@ -0,0 +1 @@

View File

@@ -6,7 +6,7 @@
protected override void OnInitialized() {
base.OnInitialized();
Navigator.NavigateTo("/login", forceLoad: true);
Navigator.NavigateTo("/", forceLoad: true);
}
}