module Web.View.EnvelopeEmissionContracts.Show where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Web.Routes () import Application.Helper.View (adapterStatusBadge) data ShowView = ShowView { contract :: !EnvelopeEmissionContract } instance View ShowView where html ShowView { .. } = [hsx|
← Envelope Contracts

Envelope Contract v{contract.contractVersion}

" text-xs px-2 py-0.5 rounded font-medium"}> {contract.status} {maturityBadge contract.maturity}
{forEach (contractDescription contract) renderContractDescription}

Required Attributes

{tshow contract.requiredAttributes}

Optional Attributes

{tshow contract.optionalAttributes}

Validation Rules

{tshow contract.validationRules}
Created: {show contract.createdAt}
|] renderContractDescription :: Text -> Html renderContractDescription d = [hsx|

{d}

|] 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}|]