module Web.View.AgentDelegations.Show where import IHP.ViewPrelude import Web.View.AgentDelegations.Index (statusBadge) import Data.Aeson (Value) data ShowView = ShowView { delegation :: !AgentDelegation , delegatingAgent :: !AgentRegistration , receivingAgent :: !AgentRegistration , mParentProposal :: !(Maybe AgentProposal) } instance View ShowView where html ShowView { .. } = [hsx|

Delegation

{statusBadge delegation.status}

Delegating Agent

{delegatingAgent.name}

Receiving Agent

{receivingAgent.name}

Scope

{delegation.scope}

Token Budget

{show delegation.tokenBudget}

Tokens Used

{maybe "—" show delegation.tokensUsed}

{maybe mempty renderParentProposal mParentProposal} {maybe mempty renderDelegationResult delegation.result}
|] renderParentProposal :: AgentProposal -> Html renderParentProposal p = [hsx|

Parent Proposal

{p.proposalType} — {p.status}

|] renderDelegationResult :: Value -> Html renderDelegationResult r = [hsx|

Result

{show r}
|]