generated from coulomb/repo-seed
- 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>
57 lines
2.1 KiB
Haskell
57 lines
2.1 KiB
Haskell
module Web.View.Hubs.Index where
|
|
|
|
import Web.Types
|
|
import Generated.Types
|
|
import IHP.Prelude
|
|
import IHP.ViewPrelude
|
|
|
|
data IndexView = IndexView { hubs :: ![Hub] }
|
|
|
|
instance View IndexView where
|
|
html IndexView { .. } = [hsx|
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-2xl font-semibold">Hubs</h1>
|
|
<a href={NewHubAction}
|
|
class="bg-indigo-600 text-white text-sm font-medium px-4 py-2 rounded
|
|
hover:bg-indigo-700">
|
|
New Hub
|
|
</a>
|
|
</div>
|
|
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
|
<table class="w-full text-sm">
|
|
<thead class="bg-gray-50 border-b border-gray-200">
|
|
<tr>
|
|
<th class="text-left px-4 py-3 font-medium text-gray-700">Name</th>
|
|
<th class="text-left px-4 py-3 font-medium text-gray-700">Slug</th>
|
|
<th class="text-left px-4 py-3 font-medium text-gray-700">Domain</th>
|
|
<th class="px-4 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{forEach hubs renderHub}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|]
|
|
|
|
renderHub :: Hub -> Html
|
|
renderHub hub = [hsx|
|
|
<tr class="border-b border-gray-100 hover:bg-gray-50">
|
|
<td class="px-4 py-3">
|
|
<a href={ShowHubAction { hubId = hub.id }}
|
|
class="font-medium text-indigo-600 hover:text-indigo-800">
|
|
{hub.name}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-3 text-gray-500 font-mono text-xs">{hub.slug}</td>
|
|
<td class="px-4 py-3 text-gray-500">{hub.domain}</td>
|
|
<td class="px-4 py-3 text-right">
|
|
<a href={EditHubAction { hubId = hub.id }}
|
|
class="text-gray-500 hover:text-gray-700 text-xs mr-3">Edit</a>
|
|
<a href={DeleteHubAction { hubId = hub.id }}
|
|
class="text-red-500 hover:text-red-700 text-xs"
|
|
data-confirm="Delete this hub?">Delete</a>
|
|
</td>
|
|
</tr>
|
|
|]
|