Skip to content

Commit

Permalink
Dashboard preview card should never show balances
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajchert committed Jul 29, 2021
1 parent 83c7239 commit f739473
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions marlowe-dashboard-client/src/Contract/View.purs
@@ -1,5 +1,5 @@
module Contract.View
( contractCard
( contractPreviewCard
, contractScreen
, actionConfirmationCard
) where
Expand All @@ -16,7 +16,7 @@ import Data.Array.NonEmpty as NonEmptyArray
import Data.BigInteger (BigInteger, fromString)
import Data.Foldable (foldMap)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Lens ((^.))
import Data.Lens (set, (^.))
import Data.Map (intersectionWith, keys, lookup, toUnfoldable) as Map
import Data.Maybe (Maybe(..), isJust, maybe, maybe')
import Data.Set (Set)
Expand Down Expand Up @@ -44,7 +44,7 @@ import Marlowe.Execution.Types (NamedAction(..))
import Marlowe.Extended (contractTypeName)
import Marlowe.Extended.Metadata (_contractType)
import Marlowe.PAB (transactionFee)
import Marlowe.Semantics (Accounts, Assets, Bound(..), ChoiceId(..), Party(..), Slot, SlotInterval(..), Token, TransactionInput(..), _accounts, getEncompassBound)
import Marlowe.Semantics (Assets, Bound(..), ChoiceId(..), Party(..), Slot, SlotInterval(..), Token, TransactionInput(..), _accounts, getEncompassBound)
import Marlowe.Semantics (Input(..)) as S
import Marlowe.Slot (secondsDiff, slotToDateTime)
import Material.Icons (Icon(..)) as Icon
Expand All @@ -54,8 +54,9 @@ import Tooltip.State (tooltip)
import Tooltip.Types (ReferenceId(..))
import WalletData.State (adaToken, getAda)

contractCard :: forall m. MonadAff m => Slot -> State -> ComponentHTML Action ChildSlots m
contractCard currentSlot state =
-- This card shows a preview of the contract (intended to be used in the dashboard)
contractPreviewCard :: forall m. MonadAff m => Slot -> State -> ComponentHTML Action ChildSlots m
contractPreviewCard currentSlot state =
let
currentStepNumber = (currentStep state) + 1

Expand Down Expand Up @@ -99,7 +100,10 @@ contractCard currentSlot state =
]
, div
[ classNames [ "h-dashboard-card-actions", "overflow-y-auto" ] ]
[ currentStepActions currentStepNumber state ]
-- NOTE: We use a slightly modification of the state here in order
-- to ensure that the preview card always shows the Task tab
-- and not the balance tab.
[ currentStepActions currentStepNumber $ set _tab Tasks state ]
]

timeoutString :: Slot -> State -> String
Expand Down
6 changes: 3 additions & 3 deletions marlowe-dashboard-client/src/Dashboard/View.purs
Expand Up @@ -6,7 +6,7 @@ module Dashboard.View
import Prelude hiding (div)
import Contract.State (isContractClosed)
import Contract.Types (State) as Contract
import Contract.View (actionConfirmationCard, contractCard, contractScreen)
import Contract.View (actionConfirmationCard, contractPreviewCard, contractScreen)
import Css as Css
import Dashboard.Lenses (_card, _cardOpen, _contractFilter, _contract, _menuOpen, _selectedContract, _selectedContractFollowerAppId, _templateState, _walletDetails, _walletDataState)
import Dashboard.Types (Action(..), Card(..), ContractFilter(..), State, Input)
Expand Down Expand Up @@ -242,7 +242,7 @@ dashboardFooter =

dashboardLinks :: forall p. Warn (Text "We need to add the dashboard links.") => Array (HTML p Action)
dashboardLinks =
-- FIXME: Add link to Docs
-- FIXME: SCP-2589 Add link to Docs
[ link "Docs" ""
, link "marlowe-finance.io" "https://marlowe-finance.io"
, link "play.marlowe-finance.io" "https://play.marlowe-finance.io"
Expand Down Expand Up @@ -405,7 +405,7 @@ contractGrid currentSlot contractFilter contracts =
, span_ [ text "New smart contract from template" ]
]

dashboardContractCard (followerAppId /\ contractState) = mapComponentAction (ContractAction followerAppId) $ contractCard currentSlot contractState
dashboardContractCard (followerAppId /\ contractState) = mapComponentAction (ContractAction followerAppId) $ contractPreviewCard currentSlot contractState

-- TODO: waiting new design for this from Russ
currentWalletCard :: forall p. WalletDetails -> HTML p Action
Expand Down

0 comments on commit f739473

Please sign in to comment.