Skip to content

Commit

Permalink
SCB: Improved display of contract headings.
Browse files Browse the repository at this point in the history
You can now copy the UUID to the clipboard easily.
  • Loading branch information
Kris Jenkins authored and krisajenkins committed Aug 3, 2020
1 parent 69520e0 commit d035460
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
10 changes: 8 additions & 2 deletions plutus-scb-client/src/MainFrame.purs
Expand Up @@ -8,9 +8,10 @@ module MainFrame
import Prelude hiding (div)
import Animation (class MonadAnimate, animate)
import Chain.Eval (handleAction) as Chain
import Chain.Types (Action(..), AnnotatedBlockchain(..), _chainFocusAppearing)
import Chain.Types (Action(FocusTx), AnnotatedBlockchain(..), _chainFocusAppearing)
import Chain.Types (initialState) as Chain
import Clipboard (class MonadClipboard)
import Clipboard as Clipboard
import Control.Monad.Reader (runReaderT)
import Control.Monad.State (class MonadState)
import Control.Monad.State.Extra (zoomStateT)
Expand Down Expand Up @@ -131,7 +132,10 @@ handleAction Init = handleAction LoadFullReport

handleAction (ChangeView view) = assign _currentView view

handleAction (ActivateContract contract) = activateContract contract
handleAction (ActivateContract contract) = do
modifying _contractSignatures Stream.refreshing
activateContract contract
modifying _contractSignatures Stream.refreshed

handleAction LoadFullReport = do
assignFullReportData Loading
Expand Down Expand Up @@ -163,6 +167,8 @@ handleAction (ChainAction subaction) = do
$ zoomStateT _chainState
$ Chain.handleAction subaction mAnnotatedBlockchain

handleAction (ClipboardAction subaction) = Clipboard.handleAction subaction

handleAction (ChangeContractEndpointCall contractInstanceId endpointIndex subaction) = do
modifying
( _contractStates
Expand Down
2 changes: 2 additions & 0 deletions plutus-scb-client/src/Types.purs
Expand Up @@ -2,6 +2,7 @@ module Types where

import Prelude
import Chain.Types as Chain
import Clipboard as Clipboard
import Control.Monad.Gen as Gen
import Data.Bifunctor (lmap)
import Data.Generic.Rep (class Generic)
Expand Down Expand Up @@ -63,6 +64,7 @@ data HAction
| LoadFullReport
| ActivateContract ContractExe
| ChainAction Chain.Action
| ClipboardAction Clipboard.Action
| ChangeContractEndpointCall ContractInstanceId Int FormEvent
| InvokeContractEndpoint ContractInstanceId EndpointForm

Expand Down
20 changes: 14 additions & 6 deletions plutus-scb-client/src/View/Contracts.purs
Expand Up @@ -3,6 +3,7 @@ module View.Contracts where
import Prelude hiding (div)
import Bootstrap (btn, btnBlock, btnPrimary, btnSmall, cardBody_, cardFooter_, cardHeader_, card_, col10_, col2_, col4_, nbsp, row_, tableBordered)
import Bootstrap as Bootstrap
import Clipboard (showShortCopyLong)
import Data.Array (mapWithIndex, null)
import Data.Array as Array
import Data.Foldable.Extra (interleave)
Expand Down Expand Up @@ -111,18 +112,23 @@ contractStatusPane contractState =
)
contractState

contractRequestView :: forall p i. ContractInstanceState ContractExe -> HTML p i
contractRequestView :: forall p. ContractInstanceState ContractExe -> HTML p HAction
contractRequestView contractInstance =
table [ classes [ Bootstrap.table, tableBordered ] ]
[ thead_
[ tr_
[ th [ colSpan 3 ]
[ h3_
[ pretty $ view (_csContractDefinition) contractInstance
, nbsp
, text "-"
, nbsp
, text $ view (_csContract <<< _contractInstanceIdString) contractInstance
[ ClipboardAction
<$> showShortCopyLong contractInstanceIdString
( Just
[ pretty $ view (_csContractDefinition) contractInstance
, nbsp
, text "-"
, nbsp
, text contractInstanceIdString
]
)
]
]
]
Expand All @@ -135,6 +141,8 @@ contractRequestView contractInstance =
, tbody_ (requestRow <$> requests)
]
where
contractInstanceIdString = view (_csContract <<< _contractInstanceIdString) contractInstance

requests = view (_csCurrentState <<< _hooks) contractInstance

requestRow (Request { itID: IterationID itID, rqID: RequestID rqID, rqRequest }) =
Expand Down

0 comments on commit d035460

Please sign in to comment.