Add home hero with intro and buttons from the body, next-event card and page tiles

This commit is contained in:
tleininger committed 2026-10-01 14:05:25 +02:00
1 parent b737f57ef7
commit e51afeb34b
23 files changed
+1262 -65

No files matched your search

@@ -20,6 +20,9 @@ public partial class EventList
[Inject]
private ILogger<EventList> Logger { get; set; } = null!;
[Inject]
private TimeProvider Time { get; set; } = null!;
[CascadingParameter]
private HttpContext? HttpContext { get; set; }
@@ -62,13 +65,8 @@ public partial class EventList
// Split into upcoming and past by date, so an event earlier today still
// counts as upcoming. Upcoming earliest first, past most recent first.
var today = DateOnly.FromDateTime(DateTime.Today);
_upcomingEvents =
[
.. events
.Where(@event => DateOnly.FromDateTime(@event.Start) >= today)
.OrderBy(@event => @event.Start)
];
var today = BerlinClock.Today(Time);
_upcomingEvents = [.. UpcomingEvents.From(events, today)];
_pastEvents =
[
.. events
@@ -0,0 +1,30 @@
using Elternbeirat.Contracts;
namespace Elternbeirat.Web.Features.Events;
/// <summary>
/// Picks the events that still lie ahead.
/// </summary>
/// <remarks>
/// The events page, the events embed and the "next event" card on the home page
/// all need the same answer to "what is coming up?". Keeping the rule here means a
/// change to it (e.g. hiding an event once it has ended) reaches all three.
/// </remarks>
/// <seealso cref="Shared.BerlinClock"/>
public static class UpcomingEvents
{
/// <summary>
/// Returns the events on or after <paramref name="today"/>, earliest first.
/// </summary>
/// <param name="events">All events, in any order.</param>
/// <param name="today">The current day, from <see cref="Shared.BerlinClock.Today"/>.</param>
/// <returns>The upcoming events, ordered by start.</returns>
/// <remarks>
/// Compared by day, not by the minute: an event earlier today still counts as
/// upcoming, so a visitor who checks during the evening's meeting still finds it.
/// </remarks>
public static IEnumerable<Event> From(IEnumerable<Event> events, DateOnly today) =>
events
.Where(@event => DateOnly.FromDateTime(@event.Start) >= today)
.OrderBy(@event => @event.Start);
}