using Elternbeirat.Contracts;
using Microsoft.AspNetCore.Components;
namespace Elternbeirat.Web.Features.Events;
///
/// Renders one event as a card with a calendar sheet, time, place and note.
///
///
/// Shared by the events page and the home-page events embed, so both show events
/// the same way. They differ only in what the card leads to:
///
/// -
///
/// In the embed the whole card links to the events page
/// ( set).
///
///
/// -
///
/// On the events page itself a link back to the same page would lead
/// nowhere, so the card is no link ( is
/// ) and offers "In Kalender übernehmen" instead.
///
///
///
///
///
///
public partial class EventCard
{
///
/// The event to show.
///
[Parameter]
[EditorRequired]
public Event Value { get; set; } = null!;
///
/// Where the card links to, or for a card that is no link
/// and offers the event as a calendar file instead.
///
[Parameter]
public string? Href { get; set; }
///
/// The time line beside the sheet; empty for a single all-day event.
///
private string Span => EventDateFormat.Span(Value);
///
/// The address of this one event as a calendar file.
///
private string IcsHref => $"/events/{Uri.EscapeDataString(Value.Id)}.ics";
}