generated from coulomb/repo-seed
Some checks failed
Test / test (push) Has been cancelled
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins. - TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest) - HubCapabilityManifest entity with validation and registry linkage - ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts - Alembic migration 1743724800, fitness tests (Test/Architecture/) - GAAF spec, Operational Architecture spec, domain hub extension guide - Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.5 KiB
Haskell
47 lines
1.5 KiB
Haskell
module Web.View.Annotations.New where
|
|
|
|
import Web.Types
|
|
import Generated.Types
|
|
import IHP.Prelude
|
|
import IHP.ViewPrelude
|
|
|
|
data NewView = NewView
|
|
{ widget :: !Widget
|
|
, annotation :: !Annotation
|
|
, categories :: ![AnnotationCategoryRegistry]
|
|
}
|
|
|
|
instance View NewView where
|
|
html NewView { .. } = [hsx|
|
|
<div class="max-w-lg">
|
|
<div class="flex items-center gap-2 text-sm text-gray-500 mb-4">
|
|
<a href={ShowWidgetAction { widgetId = widget.id }} class="hover:text-gray-700">{widget.name}</a>
|
|
<span>/</span>
|
|
<a href={WidgetAnnotationsAction { widgetId = widget.id }} class="hover:text-gray-700">Annotations</a>
|
|
<span>/</span>
|
|
<span>New</span>
|
|
</div>
|
|
<h1 class="text-2xl font-semibold mb-6">Add Annotation</h1>
|
|
{renderForm annotation widget.id categories}
|
|
</div>
|
|
|]
|
|
|
|
renderForm :: Annotation -> Id Widget -> [AnnotationCategoryRegistry] -> Html
|
|
renderForm annotation widgetId categories = formFor annotation [hsx|
|
|
{(textareaField #body) { fieldLabel = "Comment" }}
|
|
{selectField #category (categoryOptions categories)}
|
|
{selectField #severity severityOptions}
|
|
{submitButton}
|
|
|]
|
|
|
|
categoryOptions :: [AnnotationCategoryRegistry] -> [(Text, Text)]
|
|
categoryOptions = map (\r -> (r.label, r.name))
|
|
|
|
severityOptions :: [(Text, Text)]
|
|
severityOptions =
|
|
[ ("Low", "low")
|
|
, ("Medium", "medium")
|
|
, ("High", "high")
|
|
, ("Critical", "critical")
|
|
]
|