feat(web): add Razor Pages scaffolding to API project
Register Razor Pages services and middleware in Program.cs, removing UseDefaultFiles() since Razor Pages handles routing. Add shared layout with dark-themed app shell (header, nav links, search/new-task buttons) and vendor script references for htmx, Sortable, and Chart.js. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
62
TaskTracker.Api/Pages/Shared/_Layout.cshtml
Normal file
62
TaskTracker.Api/Pages/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>TaskTracker</title>
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
</head>
|
||||||
|
<body class="app">
|
||||||
|
<header class="app-header">
|
||||||
|
<div class="header-left">
|
||||||
|
<a href="/board" class="logo">
|
||||||
|
<span class="logo-icon">T</span>
|
||||||
|
<span class="logo-text">TaskTracker</span>
|
||||||
|
</a>
|
||||||
|
<nav class="nav">
|
||||||
|
<a href="/board"
|
||||||
|
class="nav-link @(ViewContext.HttpContext.Request.Path.StartsWithSegments("/board") ? "nav-link--active" : "")">
|
||||||
|
Board
|
||||||
|
</a>
|
||||||
|
<a href="/analytics"
|
||||||
|
class="nav-link @(ViewContext.HttpContext.Request.Path.StartsWithSegments("/analytics") ? "nav-link--active" : "")">
|
||||||
|
Analytics
|
||||||
|
</a>
|
||||||
|
<a href="/mappings"
|
||||||
|
class="nav-link @(ViewContext.HttpContext.Request.Path.StartsWithSegments("/mappings") ? "nav-link--active" : "")">
|
||||||
|
Mappings
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="header-right">
|
||||||
|
<button type="button" class="btn btn-search" id="search-trigger">
|
||||||
|
<svg class="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<circle cx="11" cy="11" r="8" />
|
||||||
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
||||||
|
</svg>
|
||||||
|
<span class="btn-search__hint">Ctrl+K</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="new-task-trigger">
|
||||||
|
<svg class="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<line x1="12" y1="5" x2="12" y2="19" />
|
||||||
|
<line x1="5" y1="12" x2="19" y2="12" />
|
||||||
|
</svg>
|
||||||
|
New Task
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="app-main">
|
||||||
|
@RenderBody()
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div id="search-modal"></div>
|
||||||
|
<div id="detail-panel"></div>
|
||||||
|
|
||||||
|
<script src="~/lib/htmx.min.js"></script>
|
||||||
|
<script src="~/lib/Sortable.min.js"></script>
|
||||||
|
<script src="~/lib/chart.umd.min.js"></script>
|
||||||
|
<script src="~/js/app.js"></script>
|
||||||
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
4
TaskTracker.Api/Pages/_ViewImports.cshtml
Normal file
4
TaskTracker.Api/Pages/_ViewImports.cshtml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@using TaskTracker.Core.Entities
|
||||||
|
@using TaskTracker.Core.Enums
|
||||||
|
@using TaskTracker.Core.DTOs
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
3
TaskTracker.Api/Pages/_ViewStart.cshtml
Normal file
3
TaskTracker.Api/Pages/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
@@ -37,6 +37,9 @@ builder.Services.AddCors(options =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Razor Pages
|
||||||
|
builder.Services.AddRazorPages();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Auto-migrate on startup in development
|
// Auto-migrate on startup in development
|
||||||
@@ -51,8 +54,8 @@ app.UseSwagger();
|
|||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
|
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
app.UseDefaultFiles();
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
app.MapRazorPages();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
Reference in New Issue
Block a user