module Web.View.EnvelopeEmissionContracts.Show where
import Web.Types
import Generated.Types
import IHP.Prelude
import IHP.ViewPrelude
import Application.Helper.View (adapterStatusBadge)
data ShowView = ShowView
{ contract :: !EnvelopeEmissionContract
}
instance View ShowView where
html ShowView { .. } = [hsx|
Envelope Contract v{contract.contractVersion}
" text-xs px-2 py-0.5 rounded font-medium"}>
{contract.status}
{maturityBadge contract.maturity}
{forEach (contractDescription contract) (\d -> [hsx|
{d}
|])}
Required Attributes
{tshow contract.requiredAttributes}
Optional Attributes
{tshow contract.optionalAttributes}
Validation Rules
{tshow contract.validationRules}
Created: {show contract.createdAt}
|]
contractDescription :: EnvelopeEmissionContract -> [Text]
contractDescription c = case c.description of
Just d -> [d]
Nothing -> []
maturityBadge :: Text -> Html
maturityBadge "stable" = [hsx|Stable|]
maturityBadge "beta" = [hsx|Beta|]
maturityBadge "experimental" = [hsx|Experimental|]
maturityBadge "deprecated" = [hsx|Deprecated|]
maturityBadge m = [hsx|{m}|]