feat(web): add real-time activity feed via SignalR

- Add ActivityHub and wire up SignalR in Program.cs
- Broadcast new context events from ContextController
- Connect SignalR client on Analytics page for live feed updates
- Restructure activity feed HTML to support live prepending
- Add slide-in animation for new activity items
- Update CORS to allow credentials for SignalR

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 23:30:01 -05:00
parent 5a273ba667
commit d784f9fea8
8 changed files with 125 additions and 29 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using TaskTracker.Api.Hubs;
using TaskTracker.Core.Interfaces;
using TaskTracker.Infrastructure.Data;
using TaskTracker.Infrastructure.Repositories;
@@ -31,12 +32,16 @@ builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.AllowAnyOrigin()
policy.SetIsOriginAllowed(_ => true)
.AllowAnyHeader()
.AllowAnyMethod();
.AllowAnyMethod()
.AllowCredentials();
});
});
// SignalR
builder.Services.AddSignalR();
// Razor Pages
builder.Services.AddRazorPages();
@@ -57,5 +62,6 @@ app.UseCors();
app.UseStaticFiles();
app.MapRazorPages();
app.MapControllers();
app.MapHub<ActivityHub>("/hubs/activity");
app.Run();