module Web.View.Annotations.Show where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Web.Routes () data ShowView = ShowView { widget :: !Widget , annotation :: !Annotation , mCandidate :: !(Maybe RequirementCandidate) } instance View ShowView where html ShowView { .. } = [hsx|
Widgets / {widget.name} / Annotations / Detail
{annotation.category} {annotation.severity} {if isJust annotation.retractedAt then retractedBadge else mempty} {show annotation.createdAt}

{annotation.body}

Escalation

{renderEscalation annotation mCandidate}
|] renderEscalation :: Annotation -> Maybe RequirementCandidate -> Html renderEscalation annotation Nothing = [hsx|

This annotation has not been escalated yet.

|] renderEscalation _ (Just candidate) = [hsx|

Escalated to:

{candidate.title} → " ml-3 text-xs px-2 py-0.5 rounded"}> {candidate.status} |] retractedBadge :: Html retractedBadge = [hsx|retracted|] severityClass :: Text -> Text severityClass "low" = "text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-500" severityClass "medium" = "text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700" severityClass "high" = "text-xs px-2 py-0.5 rounded bg-yellow-100 text-yellow-800" severityClass "critical" = "text-xs px-2 py-0.5 rounded bg-red-100 text-red-800 font-semibold" severityClass _ = "text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-500" candidateStatusClass :: Text -> Text candidateStatusClass "open" = "bg-blue-100 text-blue-700" candidateStatusClass "in_review" = "bg-yellow-100 text-yellow-800" candidateStatusClass "accepted" = "bg-green-100 text-green-800" candidateStatusClass "rejected" = "bg-red-100 text-red-800" candidateStatusClass "deferred" = "bg-gray-100 text-gray-600" candidateStatusClass _ = "bg-gray-100 text-gray-600"