generated from coulomb/repo-seed
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
Delivers the hub registry discovery UI, widget pattern library, governance template library, and marketplace dashboard. Key changes: - Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions, pattern_adoptions, governance_templates (categories JSONB, validated at controller), governance_template_clones — all GAAF-compliant, no bare TEXT type discriminators - Migration: 1743897600-ihf-phase10-hub-registry.sql - HubRegistry controller + views: browsable view over hub_capability_manifests, hub_health_snapshots, hubs with per-hub GAAF compliance indicator - WidgetPatterns controller + views: publish, version, adopt; adoption triggers manifest amendment draft when new types are introduced - GovernanceTemplates controller + views: CRUD, clone with category validation against annotation_category_registry - MarketplaceDashboard controller + view: full-text search, widget-type filter, sort, trending panel, autoRefresh - API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint) - OpenAPI spec updated with Phase 10 paths - GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong) - CLAUDE.md: Phase 10 complete; active workplan → Phase 11 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
64
Web/View/GovernanceTemplates/Index.hs
Normal file
64
Web/View/GovernanceTemplates/Index.hs
Normal file
@@ -0,0 +1,64 @@
|
||||
module Web.View.GovernanceTemplates.Index where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (Value(..), decode, encode)
|
||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||
|
||||
type TemplateIndexRow = (GovernanceTemplate, Int)
|
||||
|
||||
data IndexView = IndexView
|
||||
{ templates :: ![TemplateIndexRow]
|
||||
}
|
||||
|
||||
instance View IndexView where
|
||||
html IndexView { .. } = [hsx|
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold">Governance Template Library</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">Published reusable governance templates.</p>
|
||||
</div>
|
||||
<a href={NewGovernanceTemplateAction}
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
New Template
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
{forEach templates renderTemplateRow}
|
||||
{if null templates
|
||||
then [hsx|<p class="text-sm text-gray-400">No published templates yet.</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderTemplateRow :: TemplateIndexRow -> Html
|
||||
renderTemplateRow (template, cloneCount) = [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4 hover:border-indigo-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<a href={ShowGovernanceTemplateAction { governanceTemplateId = template.id }}
|
||||
class="font-medium text-indigo-700 hover:underline">
|
||||
{template.name}
|
||||
</a>
|
||||
{maybe mempty (\d -> [hsx|<p class="text-xs text-gray-500 mt-0.5">{d}</p>|]) template.description}
|
||||
</div>
|
||||
<span class="text-xs text-gray-400">{tshow cloneCount} clones</span>
|
||||
</div>
|
||||
<div class="mt-2 flex flex-wrap gap-1">
|
||||
{forEach (jsonArrayTexts template.categories) renderCategoryTag}
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderCategoryTag :: Text -> Html
|
||||
renderCategoryTag cat = [hsx|
|
||||
<span class="px-2 py-0.5 rounded text-xs bg-blue-100 text-blue-700 font-mono">{cat}</span>
|
||||
|]
|
||||
|
||||
jsonArrayTexts :: Value -> [Text]
|
||||
jsonArrayTexts val = case decode (encode val) of
|
||||
Just (arr :: [Text]) -> arr
|
||||
Nothing -> []
|
||||
73
Web/View/GovernanceTemplates/New.hs
Normal file
73
Web/View/GovernanceTemplates/New.hs
Normal file
@@ -0,0 +1,73 @@
|
||||
module Web.View.GovernanceTemplates.New where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
|
||||
data NewView = NewView
|
||||
{ template :: !GovernanceTemplate
|
||||
, hubs :: ![Hub]
|
||||
, categories :: ![(Text, Text)] -- (name, label)
|
||||
}
|
||||
|
||||
instance View NewView where
|
||||
html NewView { .. } = [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={GovernanceTemplatesAction} class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Governance Templates
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="text-2xl font-semibold mb-6">New Governance Template</h1>
|
||||
|
||||
<form method="POST" action={CreateGovernanceTemplateAction}>
|
||||
{csrfTokenFormField}
|
||||
<div class="space-y-4 max-w-lg">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
|
||||
<input type="text" name="name" value={template.name}
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Hub</label>
|
||||
<select name="hubId" class="w-full border border-gray-300 rounded px-3 py-2 text-sm">
|
||||
{forEach hubs (\h -> [hsx|
|
||||
<option value={tshow h.id}>{h.name}</option>
|
||||
|])}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
||||
<textarea name="description" rows="2"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm"
|
||||
>{fromMaybe "" template.description}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||
Categories <span class="text-xs text-gray-400">(select all that apply)</span>
|
||||
</label>
|
||||
<div class="space-y-1 border border-gray-200 rounded p-3">
|
||||
{forEach categories (\(n, l) -> [hsx|
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="categories" value={n} />
|
||||
<span class="font-mono text-xs text-gray-600">{n}</span>
|
||||
<span class="text-gray-700">{l}</span>
|
||||
</label>
|
||||
|])}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||
Template Body (JSON)
|
||||
</label>
|
||||
<textarea name="templateBody" rows="6"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm font-mono"
|
||||
placeholder='{"steps": [], "questions": []}'></textarea>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-4 py-2 rounded hover:bg-indigo-700">
|
||||
Create Template
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|]
|
||||
71
Web/View/GovernanceTemplates/Show.hs
Normal file
71
Web/View/GovernanceTemplates/Show.hs
Normal file
@@ -0,0 +1,71 @@
|
||||
module Web.View.GovernanceTemplates.Show where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (Value(..), decode, encode)
|
||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||
|
||||
data ShowView = ShowView
|
||||
{ template :: !GovernanceTemplate
|
||||
, hub :: !Hub
|
||||
, cloneCount :: !Int
|
||||
}
|
||||
|
||||
instance View ShowView where
|
||||
html ShowView { .. } = [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={GovernanceTemplatesAction} class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Governance Templates
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<h1 class="text-2xl font-semibold">{template.name}</h1>
|
||||
{if template.isPublished
|
||||
then [hsx|<span class="px-2 py-0.5 rounded text-xs bg-green-100 text-green-800">published</span>|]
|
||||
else [hsx|<span class="px-2 py-0.5 rounded text-xs bg-amber-100 text-amber-800">draft</span>|]}
|
||||
</div>
|
||||
|
||||
<p class="text-sm text-gray-500 mb-1">Hub: {hub.name}</p>
|
||||
<p class="text-sm text-gray-500 mb-4">{tshow cloneCount} clones</p>
|
||||
|
||||
{maybe mempty (\d -> [hsx|<p class="text-sm text-gray-600 mb-4">{d}</p>|]) template.description}
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2">Categories</h3>
|
||||
<div class="flex flex-wrap gap-1">
|
||||
{forEach (jsonArrayTexts template.categories) renderCategoryTag}
|
||||
{if null (jsonArrayTexts template.categories)
|
||||
then [hsx|<span class="text-xs text-gray-400">None</span>|]
|
||||
else mempty}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2">Template Body</h3>
|
||||
<pre class="bg-gray-50 rounded border border-gray-200 p-3 text-xs font-mono overflow-x-auto">
|
||||
{cs (BL.unpack (encode template.templateBody)) :: Text}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
{if template.isPublished
|
||||
then [hsx|
|
||||
<a href={CloneGovernanceTemplateAction { governanceTemplateId = template.id }}
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
Clone to My Hub
|
||||
</a>
|
||||
|]
|
||||
else mempty}
|
||||
|]
|
||||
|
||||
renderCategoryTag :: Text -> Html
|
||||
renderCategoryTag cat = [hsx|
|
||||
<span class="px-2 py-0.5 rounded text-xs bg-blue-100 text-blue-700 font-mono">{cat}</span>
|
||||
|]
|
||||
|
||||
jsonArrayTexts :: Value -> [Text]
|
||||
jsonArrayTexts val = case decode (encode val) of
|
||||
Just (arr :: [Text]) -> arr
|
||||
Nothing -> []
|
||||
84
Web/View/HubRegistry/Index.hs
Normal file
84
Web/View/HubRegistry/Index.hs
Normal file
@@ -0,0 +1,84 @@
|
||||
module Web.View.HubRegistry.Index where
|
||||
|
||||
import Web.Types
|
||||
import Web.Controller.HubRegistry (HubRegistryRow(..), GaafStatus(..), gaafStatus)
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (Value(..))
|
||||
import qualified Data.Vector as V
|
||||
|
||||
data IndexView = IndexView
|
||||
{ registryRows :: ![HubRegistryRow]
|
||||
}
|
||||
|
||||
instance View IndexView where
|
||||
html IndexView { .. } = [hsx|
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold">Hub Registry</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">
|
||||
All registered hubs with capability manifests and health status.
|
||||
</p>
|
||||
</div>
|
||||
<a href={MarketplaceDashboardAction}
|
||||
class="text-sm border border-indigo-300 text-indigo-700 px-3 py-1.5 rounded hover:bg-indigo-50">
|
||||
Marketplace
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
{forEach registryRows renderRow}
|
||||
{if null registryRows
|
||||
then [hsx|<p class="text-sm text-gray-400">No hubs registered yet.</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderRow :: HubRegistryRow -> Html
|
||||
renderRow row@HubRegistryRow { hub, mManifest, mLatestSnapshot } =
|
||||
let gs = gaafStatus mManifest
|
||||
wCount = maybe 0 (jsonArrayLen . (.declaredWidgetTypes)) mManifest
|
||||
eCount = maybe 0 (jsonArrayLen . (.declaredEventTypes)) mManifest
|
||||
cCount = maybe 0 (jsonArrayLen . (.declaredAnnotationCategories)) mManifest
|
||||
score = fmap (.healthScore) mLatestSnapshot
|
||||
in [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4 hover:border-indigo-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<a href={ShowHubRegistryAction { hubId = hub.id }}
|
||||
class="font-medium text-indigo-700 hover:underline">
|
||||
{hub.name}
|
||||
</a>
|
||||
<span class="text-xs text-gray-400 font-mono">{hub.hubKind}</span>
|
||||
{gaafBadge gs}
|
||||
</div>
|
||||
<div class="flex items-center gap-4 text-xs text-gray-500">
|
||||
{maybe mempty healthScoreBadge score}
|
||||
<span>{tshow wCount} widget types</span>
|
||||
<span>{tshow eCount} event types</span>
|
||||
<span>{tshow cCount} categories</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-xs text-gray-400 mt-1">{hub.domain}</p>
|
||||
</div>
|
||||
|]
|
||||
|
||||
gaafBadge :: GaafStatus -> Html
|
||||
gaafBadge GaafCompliant =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-green-100 text-green-800">GAAF compliant</span>|]
|
||||
gaafBadge GaafDraftOnly =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-amber-100 text-amber-800">draft manifest</span>|]
|
||||
gaafBadge GaafNoManifest =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-red-100 text-red-700">no manifest</span>|]
|
||||
|
||||
healthScoreBadge :: Int -> Html
|
||||
healthScoreBadge s =
|
||||
let cls = if s >= 80 then "bg-green-100 text-green-800"
|
||||
else if s >= 50 then "bg-amber-100 text-amber-800"
|
||||
else "bg-red-100 text-red-700"
|
||||
in [hsx|<span class={"px-2 py-0.5 rounded text-xs " <> cls}>health {tshow s}</span>|]
|
||||
|
||||
jsonArrayLen :: Value -> Int
|
||||
jsonArrayLen (Array v) = V.length v
|
||||
jsonArrayLen _ = 0
|
||||
179
Web/View/HubRegistry/Show.hs
Normal file
179
Web/View/HubRegistry/Show.hs
Normal file
@@ -0,0 +1,179 @@
|
||||
module Web.View.HubRegistry.Show where
|
||||
|
||||
import Web.Types
|
||||
import Web.Controller.HubRegistry (GaafStatus(..), gaafStatus)
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (Value(..), encode)
|
||||
import qualified Data.Vector as V
|
||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||
|
||||
-- | Row from the adopted patterns query.
|
||||
-- (patternId, patternName, widgetType, patternHubId, adoptionId, isVersionPinned, adoptedAt)
|
||||
type AdoptedPatternRow = (Id WidgetPattern, Text, Text, Id Hub, Id PatternAdoption, Bool, UTCTime)
|
||||
|
||||
data ShowView = ShowView
|
||||
{ hub :: !Hub
|
||||
, mManifest :: !(Maybe HubCapabilityManifest)
|
||||
, healthHistory :: ![HubHealthSnapshot]
|
||||
, adoptedPatterns :: ![AdoptedPatternRow]
|
||||
}
|
||||
|
||||
instance View ShowView where
|
||||
html ShowView { .. } =
|
||||
let gs = gaafStatus mManifest
|
||||
in [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={HubRegistryAction} class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Hub Registry
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 mb-6">
|
||||
<h1 class="text-2xl font-semibold">{hub.name}</h1>
|
||||
<span class="text-sm text-gray-400 font-mono">{hub.hubKind}</span>
|
||||
{gaafBadge gs}
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4 mb-6">
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4">
|
||||
<p class="text-xs text-gray-500 uppercase tracking-wide">Domain</p>
|
||||
<p class="font-medium mt-1">{hub.domain}</p>
|
||||
</div>
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4">
|
||||
<p class="text-xs text-gray-500 uppercase tracking-wide">Capability Manifest</p>
|
||||
{manifestCell mManifest hub.id}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{case mManifest of
|
||||
Nothing -> [hsx|
|
||||
<div class="bg-amber-50 border border-amber-200 rounded p-3 mb-6 text-sm text-amber-800">
|
||||
No active manifest. <a href={NewHubCapabilityManifestAction} class="underline">Create one</a> to register hub-owned types.
|
||||
</div>
|
||||
|]
|
||||
Just m -> [hsx|
|
||||
<div class="grid grid-cols-2 gap-4 mb-6">
|
||||
{jsonArraySection "Widget Types" m.declaredWidgetTypes}
|
||||
{jsonArraySection "Event Types" m.declaredEventTypes}
|
||||
{jsonArraySection "Annotation Categories" m.declaredAnnotationCategories}
|
||||
{jsonArraySection "Policy Scopes" m.declaredPolicyScopes}
|
||||
</div>
|
||||
|]}
|
||||
|
||||
<h2 class="text-lg font-semibold mb-3">Health History</h2>
|
||||
{if null healthHistory
|
||||
then [hsx|<p class="text-sm text-gray-400 mb-6">No snapshots recorded yet.</p>|]
|
||||
else [hsx|
|
||||
<div class="overflow-x-auto mb-6">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-xs text-gray-500 border-b border-gray-200">
|
||||
<th class="text-left py-2">Score</th>
|
||||
<th class="text-left py-2">Open Candidates</th>
|
||||
<th class="text-left py-2">Regressed Widgets</th>
|
||||
<th class="text-left py-2">Stale Decisions</th>
|
||||
<th class="text-left py-2">Active Bottlenecks</th>
|
||||
<th class="text-left py-2">Computed At</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{forEach healthHistory renderSnapshotRow}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|]}
|
||||
|
||||
<h2 class="text-lg font-semibold mb-3">Adopted Patterns</h2>
|
||||
{if null adoptedPatterns
|
||||
then [hsx|<p class="text-sm text-gray-400">No patterns adopted yet. <a href={WidgetPatternsAction} class="text-indigo-600 hover:underline">Browse patterns →</a></p>|]
|
||||
else [hsx|
|
||||
<div class="space-y-2">
|
||||
{forEach adoptedPatterns renderAdoptedPattern}
|
||||
</div>
|
||||
|]}
|
||||
|]
|
||||
|
||||
manifestCell :: Maybe HubCapabilityManifest -> Id Hub -> Html
|
||||
manifestCell Nothing hubId = [hsx|
|
||||
<div class="mt-1">
|
||||
<span class="text-sm text-gray-400">None</span>
|
||||
<a href={NewHubCapabilityManifestAction}
|
||||
class="ml-2 text-xs text-indigo-600 hover:underline">Create</a>
|
||||
</div>
|
||||
|]
|
||||
manifestCell (Just m) _ = [hsx|
|
||||
<div class="mt-1 flex items-center gap-2">
|
||||
<span class="font-mono text-sm">{m.manifestVersion}</span>
|
||||
<a href={ShowHubCapabilityManifestAction { hubCapabilityManifestId = m.id }}
|
||||
class="text-xs text-indigo-600 hover:underline">View</a>
|
||||
</div>
|
||||
|]
|
||||
|
||||
gaafBadge :: GaafStatus -> Html
|
||||
gaafBadge GaafCompliant =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-green-100 text-green-800">GAAF compliant</span>|]
|
||||
gaafBadge GaafDraftOnly =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-amber-100 text-amber-800">draft manifest</span>|]
|
||||
gaafBadge GaafNoManifest =
|
||||
[hsx|<span class="px-2 py-0.5 rounded text-xs bg-red-100 text-red-700">no manifest</span>|]
|
||||
|
||||
jsonArraySection :: Text -> Value -> Html
|
||||
jsonArraySection title val = [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2">
|
||||
{title} <span class="text-gray-400 font-normal ml-1">({arrayLen val})</span>
|
||||
</h3>
|
||||
{renderArrayItems val}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderArrayItems :: Value -> Html
|
||||
renderArrayItems (Array v) | V.null v =
|
||||
[hsx|<p class="text-xs text-gray-400">None declared</p>|]
|
||||
renderArrayItems (Array v) = [hsx|
|
||||
<ul class="space-y-1">
|
||||
{forEach (V.toList v) renderItem}
|
||||
</ul>
|
||||
|]
|
||||
renderArrayItems _ = [hsx|<p class="text-xs text-gray-400">—</p>|]
|
||||
|
||||
renderItem :: Value -> Html
|
||||
renderItem (String t) = [hsx|<li class="font-mono text-xs text-gray-700">{t}</li>|]
|
||||
renderItem v = [hsx|<li class="font-mono text-xs text-gray-500">{cs (BL.unpack (encode v)) :: Text}</li>|]
|
||||
|
||||
arrayLen :: Value -> Text
|
||||
arrayLen (Array v) = tshow (V.length v)
|
||||
arrayLen _ = "0"
|
||||
|
||||
renderSnapshotRow :: HubHealthSnapshot -> Html
|
||||
renderSnapshotRow s = [hsx|
|
||||
<tr class="border-b border-gray-100 text-sm">
|
||||
<td class="py-2 font-medium">{tshow s.healthScore}</td>
|
||||
<td class="py-2">{tshow s.openCandidates}</td>
|
||||
<td class="py-2">{tshow s.regressedWidgets}</td>
|
||||
<td class="py-2">{tshow s.staleDecisions}</td>
|
||||
<td class="py-2">{tshow s.activeBottlenecks}</td>
|
||||
<td class="py-2 text-gray-500">{tshow s.computedAt}</td>
|
||||
</tr>
|
||||
|]
|
||||
|
||||
renderAdoptedPattern :: AdoptedPatternRow -> Html
|
||||
renderAdoptedPattern (patternId, patternName, widgetType, _, _, isPinned, adoptedAt) = [hsx|
|
||||
<div class="bg-white rounded border border-gray-200 p-3 flex items-center justify-between">
|
||||
<div>
|
||||
<a href={ShowWidgetPatternAction { widgetPatternId = patternId }}
|
||||
class="font-medium text-sm text-indigo-700 hover:underline">
|
||||
{patternName}
|
||||
</a>
|
||||
<span class="ml-2 font-mono text-xs text-gray-400">{widgetType}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 text-xs text-gray-500">
|
||||
{if isPinned
|
||||
then [hsx|<span class="px-2 py-0.5 rounded bg-blue-100 text-blue-700">pinned</span>|]
|
||||
else [hsx|<span class="px-2 py-0.5 rounded bg-gray-100 text-gray-500">follow latest</span>|]}
|
||||
<span>{tshow adoptedAt}</span>
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
160
Web/View/MarketplaceDashboard/Show.hs
Normal file
160
Web/View/MarketplaceDashboard/Show.hs
Normal file
@@ -0,0 +1,160 @@
|
||||
module Web.View.MarketplaceDashboard.Show where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (Value(..), decode, encode)
|
||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||
|
||||
type PatternRow = (WidgetPattern, Int) -- pattern + adopter_count
|
||||
type TemplateRow = (GovernanceTemplate, Int) -- template + clone_count
|
||||
type TrendingRow = (Id WidgetPattern, Text, Text, Int) -- id, name, widget_type, recent_adoptions
|
||||
|
||||
data ShowView = ShowView
|
||||
{ patterns :: ![PatternRow]
|
||||
, templates :: ![TemplateRow]
|
||||
, trending :: ![TrendingRow]
|
||||
, widgetTypeOptions :: ![(Text, Text)] -- (name, label)
|
||||
, searchQuery :: !(Maybe Text)
|
||||
, selectedType :: !(Maybe Text)
|
||||
, sortOrder :: !Text
|
||||
}
|
||||
|
||||
instance View ShowView where
|
||||
html ShowView { .. } = [hsx|
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold">Marketplace</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">
|
||||
Discover and adopt reusable widget patterns and governance templates.
|
||||
<a href={HubRegistryAction} class="ml-2 text-indigo-600 hover:underline">Hub Registry →</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{searchBar searchQuery selectedType sortOrder widgetTypeOptions}
|
||||
|
||||
{if not (null trending)
|
||||
then [hsx|
|
||||
<div class="mb-6">
|
||||
<h2 class="text-sm font-semibold text-gray-600 uppercase tracking-wide mb-3">
|
||||
Trending (last 30 days)
|
||||
</h2>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{forEach trending renderTrendingChip}
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
else mempty}
|
||||
|
||||
<div class="grid grid-cols-2 gap-8">
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold mb-3">
|
||||
Widget Patterns
|
||||
<span class="text-sm font-normal text-gray-400 ml-1">({tshow (length patterns)})</span>
|
||||
</h2>
|
||||
<div class="space-y-2">
|
||||
{forEach patterns renderPatternRow}
|
||||
{if null patterns
|
||||
then [hsx|<p class="text-sm text-gray-400">No patterns match your search.</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold mb-3">
|
||||
Governance Templates
|
||||
<span class="text-sm font-normal text-gray-400 ml-1">({tshow (length templates)})</span>
|
||||
</h2>
|
||||
<div class="space-y-2">
|
||||
{forEach templates renderTemplateRow}
|
||||
{if null templates
|
||||
then [hsx|<p class="text-sm text-gray-400">No templates match your search.</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
|
||||
searchBar :: Maybe Text -> Maybe Text -> Text -> [(Text, Text)] -> Html
|
||||
searchBar mSearch mWType sortOrder wtOptions = [hsx|
|
||||
<form method="GET" action={MarketplaceDashboardAction} class="mb-6 flex items-end gap-3">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs text-gray-500 mb-1">Search</label>
|
||||
<input type="text" name="q" value={fromMaybe "" mSearch}
|
||||
placeholder="Search patterns and templates..."
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500 mb-1">Widget Type</label>
|
||||
<select name="widgetType" class="border border-gray-300 rounded px-3 py-2 text-sm font-mono">
|
||||
<option value="">All types</option>
|
||||
{forEach wtOptions (\(n, l) -> [hsx|
|
||||
<option value={n} selected={mWType == Just n}>{l}</option>
|
||||
|])}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500 mb-1">Sort</label>
|
||||
<select name="sort" class="border border-gray-300 rounded px-3 py-2 text-sm">
|
||||
<option value="adopted" selected={sortOrder == "adopted"}>Most adopted</option>
|
||||
<option value="recent" selected={sortOrder == "recent"}>Recently published</option>
|
||||
<option value="alpha" selected={sortOrder == "alpha"}>Alphabetical</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-4 py-2 rounded hover:bg-indigo-700">
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
|]
|
||||
|
||||
renderPatternRow :: PatternRow -> Html
|
||||
renderPatternRow (pattern, adopterCount) = [hsx|
|
||||
<div class="bg-white rounded border border-gray-200 p-3 hover:border-indigo-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<a href={ShowWidgetPatternAction { widgetPatternId = pattern.id }}
|
||||
class="font-medium text-sm text-indigo-700 hover:underline">
|
||||
{pattern.name}
|
||||
</a>
|
||||
<span class="text-xs text-gray-400">{tshow adopterCount} adopters</span>
|
||||
</div>
|
||||
<span class="font-mono text-xs text-gray-400">{pattern.widgetType}</span>
|
||||
{maybe mempty (\d -> [hsx|<p class="text-xs text-gray-500 mt-1 truncate">{d}</p>|]) pattern.description}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderTemplateRow :: TemplateRow -> Html
|
||||
renderTemplateRow (template, cloneCount) = [hsx|
|
||||
<div class="bg-white rounded border border-gray-200 p-3 hover:border-indigo-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<a href={ShowGovernanceTemplateAction { governanceTemplateId = template.id }}
|
||||
class="font-medium text-sm text-indigo-700 hover:underline">
|
||||
{template.name}
|
||||
</a>
|
||||
<span class="text-xs text-gray-400">{tshow cloneCount} clones</span>
|
||||
</div>
|
||||
{maybe mempty (\d -> [hsx|<p class="text-xs text-gray-500 mt-1 truncate">{d}</p>|]) template.description}
|
||||
<div class="mt-1 flex flex-wrap gap-1">
|
||||
{forEach (jsonArrayTexts template.categories) (\c -> [hsx|
|
||||
<span class="px-1.5 py-0.5 rounded text-xs bg-blue-50 text-blue-600 font-mono">{c}</span>
|
||||
|])}
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderTrendingChip :: TrendingRow -> Html
|
||||
renderTrendingChip (patternId, name, widgetType, count) = [hsx|
|
||||
<a href={ShowWidgetPatternAction { widgetPatternId = patternId }}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 bg-white rounded border border-gray-200 \
|
||||
\text-sm hover:border-indigo-300">
|
||||
<span class="font-medium">{name}</span>
|
||||
<span class="font-mono text-xs text-gray-400">{widgetType}</span>
|
||||
<span class="text-xs text-indigo-600">{tshow count} adoptions</span>
|
||||
</a>
|
||||
|]
|
||||
|
||||
jsonArrayTexts :: Value -> [Text]
|
||||
jsonArrayTexts val = case decode (encode val) of
|
||||
Just (arr :: [Text]) -> arr
|
||||
Nothing -> []
|
||||
49
Web/View/WidgetPatterns/Edit.hs
Normal file
49
Web/View/WidgetPatterns/Edit.hs
Normal file
@@ -0,0 +1,49 @@
|
||||
module Web.View.WidgetPatterns.Edit where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
|
||||
data EditView = EditView
|
||||
{ pattern :: !WidgetPattern
|
||||
, hubs :: ![Hub]
|
||||
, widgetTypes :: ![(Text, Text)]
|
||||
}
|
||||
|
||||
instance View EditView where
|
||||
html EditView { .. } = [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={ShowWidgetPatternAction { widgetPatternId = pattern.id }}
|
||||
class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Pattern
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="text-2xl font-semibold mb-6">Edit Pattern</h1>
|
||||
|
||||
<form method="POST" action={UpdateWidgetPatternAction { widgetPatternId = pattern.id }}>
|
||||
{csrfTokenFormField}
|
||||
<div class="space-y-4 max-w-lg">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
|
||||
<input type="text" name="name" value={pattern.name}
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Widget Type</label>
|
||||
<p class="font-mono text-sm text-gray-600">{pattern.widgetType}</p>
|
||||
<p class="text-xs text-gray-400">Widget type cannot be changed after creation.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
||||
<textarea name="description" rows="3"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm"
|
||||
>{fromMaybe "" pattern.description}</textarea>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-4 py-2 rounded hover:bg-indigo-700">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|]
|
||||
57
Web/View/WidgetPatterns/Index.hs
Normal file
57
Web/View/WidgetPatterns/Index.hs
Normal file
@@ -0,0 +1,57 @@
|
||||
module Web.View.WidgetPatterns.Index where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
|
||||
-- Row: WidgetPattern fields + adopter_count + latest_version
|
||||
type PatternIndexRow = (WidgetPattern, Int, Maybe Int)
|
||||
|
||||
data IndexView = IndexView
|
||||
{ patterns :: ![PatternIndexRow]
|
||||
}
|
||||
|
||||
instance View IndexView where
|
||||
html IndexView { .. } = [hsx|
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold">Widget Pattern Library</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">Published reusable widget patterns.</p>
|
||||
</div>
|
||||
<a href={NewWidgetPatternAction}
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
New Pattern
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
{forEach patterns renderPatternRow}
|
||||
{if null patterns
|
||||
then [hsx|<p class="text-sm text-gray-400">No published patterns yet.</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderPatternRow :: PatternIndexRow -> Html
|
||||
renderPatternRow (pattern, adopterCount, mVersion) = [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4 hover:border-indigo-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<a href={ShowWidgetPatternAction { widgetPatternId = pattern.id }}
|
||||
class="font-medium text-indigo-700 hover:underline">
|
||||
{pattern.name}
|
||||
</a>
|
||||
<span class="font-mono text-xs text-gray-400">{pattern.widgetType}</span>
|
||||
{if pattern.isCrossHub
|
||||
then [hsx|<span class="px-2 py-0.5 rounded text-xs bg-purple-100 text-purple-700">cross-hub</span>|]
|
||||
else mempty}
|
||||
</div>
|
||||
<div class="flex items-center gap-3 text-xs text-gray-500">
|
||||
<span>{tshow adopterCount} adopters</span>
|
||||
{maybe mempty (\v -> [hsx|<span class="font-mono">v{tshow v}</span>|]) mVersion}
|
||||
</div>
|
||||
</div>
|
||||
{maybe mempty (\d -> [hsx|<p class="text-xs text-gray-500 mt-1">{d}</p>|]) pattern.description}
|
||||
</div>
|
||||
|]
|
||||
64
Web/View/WidgetPatterns/New.hs
Normal file
64
Web/View/WidgetPatterns/New.hs
Normal file
@@ -0,0 +1,64 @@
|
||||
module Web.View.WidgetPatterns.New where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
|
||||
data NewView = NewView
|
||||
{ pattern :: !WidgetPattern
|
||||
, hubs :: ![Hub]
|
||||
, widgetTypes :: ![(Text, Text)] -- (name, label)
|
||||
}
|
||||
|
||||
instance View NewView where
|
||||
html NewView { .. } = [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={WidgetPatternsAction} class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Widget Patterns
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="text-2xl font-semibold mb-6">New Widget Pattern</h1>
|
||||
|
||||
{renderForm pattern hubs widgetTypes}
|
||||
|]
|
||||
|
||||
renderForm :: WidgetPattern -> [Hub] -> [(Text, Text)] -> Html
|
||||
renderForm pattern hubs widgetTypes = [hsx|
|
||||
<form method="POST" action={CreateWidgetPatternAction}>
|
||||
{csrfTokenFormField}
|
||||
<div class="space-y-4 max-w-lg">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
|
||||
<input type="text" name="name" value={pattern.name}
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Hub</label>
|
||||
<select name="hubId" class="w-full border border-gray-300 rounded px-3 py-2 text-sm">
|
||||
{forEach hubs (\h -> [hsx|
|
||||
<option value={tshow h.id}>{h.name}</option>
|
||||
|])}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Widget Type</label>
|
||||
<select name="widgetType" class="w-full border border-gray-300 rounded px-3 py-2 text-sm font-mono">
|
||||
{forEach widgetTypes (\(n, l) -> [hsx|
|
||||
<option value={n}>{l} ({n})</option>
|
||||
|])}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
||||
<textarea name="description" rows="3"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm"
|
||||
>{fromMaybe "" pattern.description}</textarea>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-4 py-2 rounded hover:bg-indigo-700">
|
||||
Create Pattern
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|]
|
||||
146
Web/View/WidgetPatterns/Show.hs
Normal file
146
Web/View/WidgetPatterns/Show.hs
Normal file
@@ -0,0 +1,146 @@
|
||||
module Web.View.WidgetPatterns.Show where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Data.Aeson (encode)
|
||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||
|
||||
data ShowView = ShowView
|
||||
{ pattern :: !WidgetPattern
|
||||
, hub :: !Hub
|
||||
, versions :: ![WidgetPatternVersion]
|
||||
, adopterCount :: !Int
|
||||
, anonCount :: !Int
|
||||
, meanFriction :: !(Maybe Double)
|
||||
, outcomeCount :: !Int
|
||||
}
|
||||
|
||||
instance View ShowView where
|
||||
html ShowView { .. } = [hsx|
|
||||
<div class="mb-4">
|
||||
<a href={WidgetPatternsAction} class="text-sm text-gray-500 hover:text-gray-700">
|
||||
← Widget Patterns
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<h1 class="text-2xl font-semibold">{pattern.name}</h1>
|
||||
<span class="font-mono text-sm text-gray-400">{pattern.widgetType}</span>
|
||||
{if pattern.isCrossHub
|
||||
then [hsx|<span class="px-2 py-0.5 rounded text-xs bg-purple-100 text-purple-700">cross-hub</span>|]
|
||||
else mempty}
|
||||
{if pattern.isPublished
|
||||
then [hsx|<span class="px-2 py-0.5 rounded text-xs bg-green-100 text-green-800">published</span>|]
|
||||
else [hsx|<span class="px-2 py-0.5 rounded text-xs bg-amber-100 text-amber-800">draft</span>|]}
|
||||
</div>
|
||||
|
||||
<p class="text-sm text-gray-500 mb-1">Hub: {hub.name}</p>
|
||||
<p class="text-sm text-gray-500 mb-4">{tshow adopterCount} adopters</p>
|
||||
|
||||
{maybe mempty (\d -> [hsx|<p class="text-sm text-gray-600 mb-4">{d}</p>|]) pattern.description}
|
||||
|
||||
{aggregatePanel adopterCount anonCount meanFriction outcomeCount}
|
||||
|
||||
<div class="flex gap-2 mb-6">
|
||||
{if not pattern.isPublished
|
||||
then [hsx|
|
||||
<a href={EditWidgetPatternAction { widgetPatternId = pattern.id }}
|
||||
class="text-sm border border-gray-300 text-gray-700 px-3 py-1.5 rounded hover:bg-gray-50">
|
||||
Edit
|
||||
</a>
|
||||
<a href={PublishWidgetPatternAction { widgetPatternId = pattern.id }}
|
||||
class="text-sm bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700">
|
||||
Publish
|
||||
</a>
|
||||
|]
|
||||
else [hsx|
|
||||
<a href={AdoptPatternAction { widgetPatternId = pattern.id }}
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
Adopt Pattern
|
||||
</a>
|
||||
|]}
|
||||
</div>
|
||||
|
||||
<h2 class="text-lg font-semibold mb-3">Version History</h2>
|
||||
{if null versions
|
||||
then [hsx|<p class="text-sm text-gray-400 mb-6">No versions published yet.</p>|]
|
||||
else [hsx|
|
||||
<div class="space-y-3 mb-6">
|
||||
{forEach versions renderVersionRow}
|
||||
</div>
|
||||
|]}
|
||||
|
||||
{if pattern.isPublished
|
||||
then [hsx|
|
||||
<div class="border-t border-gray-200 pt-4">
|
||||
<h2 class="text-base font-semibold mb-3">Publish New Version</h2>
|
||||
<form method="POST" action={PublishNewVersionAction { widgetPatternId = pattern.id }}>
|
||||
{csrfTokenFormField}
|
||||
<div class="mb-3">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||
Definition (JSON)
|
||||
</label>
|
||||
<textarea name="definition" rows="4"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm font-mono"
|
||||
placeholder='{"key": "value"}'></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Changelog</label>
|
||||
<input type="text" name="changelog"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm"
|
||||
placeholder="What changed in this version?" />
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
Publish Version
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|]
|
||||
else mempty}
|
||||
|]
|
||||
|
||||
-- | Aggregate friction/outcome panel (T07)
|
||||
aggregatePanel :: Int -> Int -> Maybe Double -> Int -> Html
|
||||
aggregatePanel adopterCount anonCount meanFriction outcomeCount = [hsx|
|
||||
<div class="bg-gray-50 rounded border border-gray-200 p-4 mb-6">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-3">Adoption Metrics</h3>
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
<div>
|
||||
<p class="text-xs text-gray-500">Total Adopters</p>
|
||||
<p class="text-lg font-semibold">{tshow adopterCount}</p>
|
||||
{if anonCount > 0
|
||||
then [hsx|<p class="text-xs text-gray-400">{tshow anonCount} opted out of aggregate feedback</p>|]
|
||||
else mempty}
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs text-gray-500">Mean Friction Score</p>
|
||||
<p class="text-lg font-semibold">
|
||||
{maybe "—" (\f -> tshow (round f :: Int)) meanFriction}
|
||||
</p>
|
||||
<p class="text-xs text-gray-400">non-anonymous adopters</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs text-gray-500">Outcome Signals</p>
|
||||
<p class="text-lg font-semibold">{tshow outcomeCount}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderVersionRow :: WidgetPatternVersion -> Html
|
||||
renderVersionRow v = [hsx|
|
||||
<div class="bg-white rounded border border-gray-200 p-3">
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<span class="font-mono text-sm font-medium">v{tshow v.versionNumber}</span>
|
||||
<span class="text-xs text-gray-400">{tshow v.publishedAt}</span>
|
||||
</div>
|
||||
{maybe mempty (\c -> [hsx|<p class="text-xs text-gray-600">{c}</p>|]) v.changelog}
|
||||
<details class="mt-2">
|
||||
<summary class="text-xs text-gray-400 cursor-pointer">Definition</summary>
|
||||
<pre class="text-xs text-gray-600 mt-1 overflow-x-auto">{cs (BL.unpack (encode v.definition)) :: Text}</pre>
|
||||
</details>
|
||||
</div>
|
||||
|]
|
||||
Reference in New Issue
Block a user