Files
inter-hub/Web/View/HubRoutingRules/RoutedCandidates.hs
Bernd Worsch c40f11d657 fix(WP-0017/E3): Layer 3 error fixes — controllers and views
Fix compilation errors across 6 controllers and 29 views: import cleanup,
ResponseException pattern for API auth, type fixes, unused import removal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 23:40:31 +00:00

63 lines
2.5 KiB
Haskell

module Web.View.HubRoutingRules.RoutedCandidates where
import Web.View.Prelude
import Web.Routes ()
data RoutedCandidatesView = RoutedCandidatesView
{ hub :: !Hub
, candidates :: ![RequirementCandidate]
}
instance View RoutedCandidatesView where
html RoutedCandidatesView { .. } = [hsx|
<div class="flex items-center gap-3 mb-6">
<a href={HubRoutingRulesAction} class="text-sm text-gray-500 hover:underline">Routing Rules</a>
<span class="text-gray-300">/</span>
<h1 class="text-2xl font-semibold">Routed In: {hub.name}</h1>
</div>
<p class="text-sm text-gray-500 mb-4">
Requirement candidates routed to this hub from other hubs.
</p>
{renderRoutedCandidates candidates}
|]
renderRoutedCandidates :: [RequirementCandidate] -> Html
renderRoutedCandidates [] = [hsx|<p class="text-sm text-gray-400">No candidates routed to this hub yet.</p>|]
renderRoutedCandidates candidates = [hsx|
<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">Summary</th>
<th class="text-left px-4 py-3 font-medium text-gray-700">Category</th>
<th class="text-left px-4 py-3 font-medium text-gray-700">Status</th>
<th class="text-left px-4 py-3 font-medium text-gray-700">Created</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
{forEach candidates renderCandidateRow}
</tbody>
</table>
</div>
|]
renderCandidateRow :: RequirementCandidate -> Html
renderCandidateRow c = [hsx|
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-gray-800">{c.title}</td>
<td class="px-4 py-3 text-gray-500">{c.category}</td>
<td class="px-4 py-3">
<span class="text-xs bg-yellow-100 text-yellow-800 px-2 py-0.5 rounded font-medium">
{c.status}
</span>
</td>
<td class="px-4 py-3 text-xs text-gray-400">{show c.createdAt}</td>
<td class="px-4 py-3 text-right">
<a href={ShowRequirementCandidateAction (c.id)}
class="text-xs text-blue-600 hover:underline">View</a>
</td>
</tr>
|]