Files
2026-02-23 14:02:44 +01:00

63 lines
2.9 KiB
Plaintext

@{
ViewData["Title"] = "Start Page";
var pictureUrl = User.FindFirst("app.picture")?.Value
?? User.FindFirst(System.Security.Claims.ClaimTypes.Uri)?.Value;
var isSubscribed = ViewData["IsSubscribed"] as bool? ?? false;
var lastRun = ViewData["WorkerLastRun"] as string;
var nextRun = ViewData["WorkerNextRun"] as string;
var lastResult = ViewData["WorkerLastResult"] as string;
}
<div class="text-center">
<h1 class="display-4">Welcome to Hotline Planner</h1>
@if (User.Identity != null && User.Identity.IsAuthenticated)
{
@if (!string.IsNullOrEmpty(pictureUrl))
{
<img src="@pictureUrl" alt="Profile Picture" style="width: 80px; height: 80px; border-radius: 50%; margin-bottom: 15px;" />
}
else
{
<!-- Placeholder for users without a profile picture (e.g., from Microsoft login) -->
<div style="width: 80px; height: 80px; border-radius: 50%; background-color: #ddd; display: inline-block; margin-bottom: 15px;"></div>
}
<h4 class="lead">Hello, @User.Identity.Name!</h4>
<p>You have successfully logged in.</p>
<div class="mb-3">
<form asp-controller="Account" asp-action="ToggleSubscription" method="post" style="display:inline-block;">
<button type="submit" class="btn btn-outline-secondary">
@(isSubscribed ? "Deactivate Calendar" : "Activate Calendar")
</button>
</form>
<span class="ms-2">Status: <strong>@(isSubscribed ? "Active" : "Inactive")</strong></span>
</div>
<div class="mb-3">
<div>Last run: <strong>@(lastRun ?? "n/a")</strong></div>
<div>Next run: <strong>@(nextRun ?? "n/a")</strong></div>
<div>Last result: <strong>@(lastResult ?? "n/a")</strong></div>
</div>
<form asp-controller="Account" asp-action="CreateCalendarEvent" method="post">
<button type="submit" class="btn btn-outline-primary">Add Calendar Event</button>
</form>
<form asp-controller="Account" asp-action="Logout" method="post">
<button type="submit" class="btn btn-outline-danger">Log Out</button>
</form>
}
else
{
<p class="lead">Please sign in to continue.</p>
<div class="d-grid gap-2 col-md-4 mx-auto">
<form asp-controller="Account" asp-action="ExternalLogin" method="post">
<input type="hidden" name="provider" value="Microsoft" />
<button type="submit" class="btn btn-lg btn-primary w-100">Login with Microsoft</button>
</form>
<form asp-controller="Account" asp-action="ExternalLogin" method="post">
<input type="hidden" name="provider" value="Google" />
<button type="submit" class="btn btn-lg btn-success w-100">Login with Google</button>
</form>
</div>
}
</div>