generated from coulomb/repo-seed
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only trigger), annotations, users — single migration file - Web layer: Types, Routes, FrontController with auth + AutoRefresh layout - Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents (JSON capture, canonical event_type validation), Annotations (threaded, append-only) - Sessions controller for IHP auth - Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit), Annotations (index/new), Sessions (login) - widgetEnvelope helper with full data-* governance attributes - Integration tests: Hub CRUD, Widget versioning, event capture, append-only guard, annotation threading, validation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
57
Web/FrontController.hs
Normal file
57
Web/FrontController.hs
Normal file
@@ -0,0 +1,57 @@
|
||||
module Web.FrontController where
|
||||
|
||||
import IHP.RouterPrelude
|
||||
import IHP.LoginSupport.Middleware
|
||||
import Generated.Types
|
||||
import Web.Types
|
||||
import Web.Routes ()
|
||||
|
||||
-- Controllers
|
||||
import Web.Controller.Hubs ()
|
||||
import Web.Controller.Widgets ()
|
||||
import Web.Controller.InteractionEvents ()
|
||||
import Web.Controller.Annotations ()
|
||||
import Web.Controller.Sessions ()
|
||||
|
||||
instance FrontController WebApplication where
|
||||
controllers =
|
||||
[ parseRoute @SessionsController
|
||||
, parseRoute @HubsController
|
||||
, parseRoute @WidgetsController
|
||||
, parseRoute @InteractionEventsController
|
||||
, parseRoute @AnnotationsController
|
||||
]
|
||||
|
||||
instance InitControllerContext WebApplication where
|
||||
initContext = do
|
||||
setLayout defaultLayout
|
||||
initAuthentication @User
|
||||
|
||||
defaultLayout :: Layout
|
||||
defaultLayout inner = [hsx|
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>inter-hub</title>
|
||||
{autoRefreshMeta}
|
||||
<link rel="stylesheet" href="/app.css" />
|
||||
<script src="/vendor/morphdom.js"></script>
|
||||
<script src="/vendor/ihp-auto-refresh.js"></script>
|
||||
</head>
|
||||
<body class="bg-gray-50 text-gray-900">
|
||||
<nav class="bg-white border-b border-gray-200 px-6 py-3 flex items-center gap-6">
|
||||
<a href={HubsAction} class="font-semibold text-indigo-600">inter-hub</a>
|
||||
<a href={HubsAction} class="text-sm text-gray-600 hover:text-gray-900">Hubs</a>
|
||||
<a href={WidgetsAction} class="text-sm text-gray-600 hover:text-gray-900">Widgets</a>
|
||||
<div class="ml-auto">
|
||||
<a href={DeleteSessionAction} class="text-sm text-gray-500 hover:text-gray-700">Sign out</a>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="max-w-5xl mx-auto px-6 py-8">
|
||||
{inner}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|]
|
||||
Reference in New Issue
Block a user