Skip to content

Commit

Permalink
Merge pull request #4042 from input-output-hk/component-modules
Browse files Browse the repository at this point in the history
Update all component module names in marlowe apps
  • Loading branch information
jhbertra committed Oct 14, 2021
2 parents 681b986 + e7b423b commit f47b9f1
Show file tree
Hide file tree
Showing 166 changed files with 603 additions and 712 deletions.
8 changes: 3 additions & 5 deletions marlowe-dashboard-client/src/Bridge.purs
Expand Up @@ -7,17 +7,16 @@ module Bridge

import Prologue
import Cardano.Wallet.Mock.Types (WalletInfo(..)) as Back
import Component.Contacts.Types (Wallet(..), WalletInfo(..)) as Front
import Data.Bifunctor (bimap)
import Data.BigInteger (BigInteger)
import Data.Json.JsonNTuple (JsonNTuple(..))
import Data.Json.JsonUUID (JsonUUID(..))
import Data.Lens (Iso', iso)
import Data.Map (Map, fromFoldable, toUnfoldable) as Front
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Data.Json.JsonNTuple (JsonNTuple(..))
import Marlowe.PAB (PlutusAppId(..)) as Front
import Marlowe.Semantics (Assets(..), Slot(..), PubKeyHash) as Front
import Marlowe.Semantics (Assets(..), Slot(..)) as Front
import Network.RemoteData (RemoteData)
import Plutus.V1.Ledger.Crypto (PubKey(..), PubKeyHash(..)) as Back
import Plutus.V1.Ledger.Slot (Slot(..)) as Back
Expand All @@ -26,7 +25,6 @@ import PlutusTx.AssocMap (Map, fromTuples, toTuples) as Back
import Servant.PureScript.Ajax (AjaxError)
import Wallet.Emulator.Wallet (Wallet(..)) as Back
import Wallet.Types (ContractInstanceId(..)) as Back
import Contacts.Types (Wallet(..), WalletInfo(..)) as Front

{-
Note [JSON communication]: To ensure the client and the PAB server understand each other, they have
Expand Down
3 changes: 1 addition & 2 deletions marlowe-dashboard-client/src/Capability/Contract.purs
Expand Up @@ -19,7 +19,6 @@ import AppM (AppM)
import Bridge (toBack, toFront)
import Control.Monad.Except (lift, runExceptT)
import Data.Lens (view)
import Data.Maybe
import Data.RawJson (RawJson)
import Foreign.Generic (class Encode)
import Halogen (HalogenM)
Expand All @@ -30,7 +29,7 @@ import Plutus.Contract.Resumable (Request)
import Plutus.PAB.Events.ContractInstanceState (PartiallyDecodedResponse)
import Plutus.PAB.Webserver.Types (ContractActivationArgs(..), ContractInstanceClientState, ContractSignatureResponse)
import Types (AjaxResponse)
import Contacts.Types (Wallet)
import Component.Contacts.Types (Wallet)

-- TODO (possibly): make `AppM` a `MonadError` and remove all the `runExceptT`s
class
Expand Down
9 changes: 3 additions & 6 deletions marlowe-dashboard-client/src/Capability/Marlowe.purs
Expand Up @@ -28,8 +28,8 @@ import Capability.MarloweStorage (class ManageMarloweStorage, addAssets, getCont
import Capability.PlutusApps.MarloweApp as MarloweApp
import Capability.Wallet (class ManageWallet)
import Capability.Wallet (createWallet, getWalletInfo, getWalletTotalFunds) as Wallet
import Contacts.Lenses (_companionAppId, _marloweAppId, _pubKeyHash, _wallet, _walletInfo)
import Contacts.Types (Wallet(..), WalletDetails, WalletInfo(..))
import Component.Contacts.Lenses (_companionAppId, _marloweAppId, _pubKeyHash, _wallet, _walletInfo)
import Component.Contacts.Types (Wallet(..), WalletDetails, WalletInfo(..))
import Control.Monad.Except (ExceptT(..), except, lift, mapExceptT, runExcept, runExceptT, withExceptT)
import Control.Monad.Reader (asks)
import Control.Monad.Reader.Class (ask)
Expand All @@ -47,21 +47,18 @@ import Data.Traversable (for, traverse)
import Data.Tuple.Nested ((/\))
import Data.UUID (genUUID, parseUUID, toString)
import Effect.Aff (delay)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
import Env (DataProvider(..))
import Foreign (MultipleErrors)
import Foreign.Generic (decodeJSON)
import Halogen (HalogenM, liftAff)
import Marlowe.Client (ContractHistory(..))
import Marlowe.PAB (PlutusAppId(..))
import Marlowe.Semantics (Assets(..), Contract, MarloweData(..), MarloweParams(..), TokenName, TransactionInput, _rolePayoutValidatorHash, asset, emptyState, PubKeyHash(..))
import Marlowe.Semantics (Assets(..), Contract, MarloweData(..), MarloweParams(..), PubKeyHash, TokenName, TransactionInput, _rolePayoutValidatorHash, asset, emptyState)
import MarloweContract (MarloweContract(..))
import Plutus.PAB.Webserver.Types (ContractInstanceClientState)
import Servant.PureScript.Ajax (AjaxError(..), ErrorDescription(..))
import Types (AjaxResponse, CombinedWSStreamToServer(..), DecodedAjaxResponse)
import Contacts.Lenses (_companionAppId, _marloweAppId, _pubKeyHash, _wallet, _walletInfo)
import Contacts.Types (Wallet(..), WalletDetails, WalletInfo(..))
import WebSocket.Support as WS

-- The `ManageMarlowe` class provides a window on the `ManageContract` and `ManageWallet`
Expand Down
6 changes: 3 additions & 3 deletions marlowe-dashboard-client/src/Capability/MarloweStorage.purs
Expand Up @@ -27,9 +27,9 @@ import Foreign.Generic (decodeJSON, encodeJSON)
import Halogen (HalogenM)
import LocalStorage (Key(..), getItem, removeItem, setItem)
import Marlowe.PAB (PlutusAppId)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, TransactionInput, PubKeyHash)
import Contacts.Lenses (_assets, _pubKeyHash, _walletInfo, _walletNickname)
import Contacts.Types (WalletDetails, WalletLibrary)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, PubKeyHash, TransactionInput)
import Component.Contacts.Lenses (_assets, _pubKeyHash, _walletInfo, _walletNickname)
import Component.Contacts.Types (WalletDetails, WalletLibrary)

walletLibraryLocalStorageKey :: Key
walletLibraryLocalStorageKey = Key "walletLibrary"
Expand Down
2 changes: 1 addition & 1 deletion marlowe-dashboard-client/src/Capability/Wallet.purs
Expand Up @@ -16,7 +16,7 @@ import Halogen (HalogenM)
import Marlowe.Semantics (Assets)
import Plutus.V1.Ledger.Tx (Tx)
import Types (AjaxResponse)
import Contacts.Types (Wallet, WalletInfo)
import Component.Contacts.Types (Wallet, WalletInfo)

-- TODO (possibly): make `AppM` a `MonadError` and remove all the `runExceptT`s
class
Expand Down
@@ -1,9 +1,9 @@
module Component.ConfirmInput.Types where

import Contract.Types as Contract
import Data.BigInteger (BigInteger)
import Marlowe.Execution.Types (NamedAction)
import Marlowe.Semantics (Slot) as Semantics
import Page.Contract.Types as Contract

type Input
= { action :: NamedAction
Expand Down
12 changes: 6 additions & 6 deletions marlowe-dashboard-client/src/Component/ConfirmInput/View.purs
Expand Up @@ -4,21 +4,21 @@ import Prologue hiding (div)
import Component.Amount (amount)
import Component.Box (box)
import Component.Box as Box
import Component.Button.View (button)
import Component.Button.Types as Button
import Component.Button.View (button)
import Component.Column (column)
import Component.Column as Column
import Component.ConfirmInput.Types (Input)
import Component.Expand as Expand
import Component.Heading (Preset(..), heading)
import Component.IconButton.View (iconButton)
import Component.Icons (icon_)
import Component.Icons as Icon
import Component.Link (link)
import Component.Row (row)
import Component.Row as Row
import Component.Transfer.View (transfer)
import Component.Transfer.Types (Termini(..))
import Contract.State (currentStep, partyToParticipant, paymentToTransfer, toInput)
import Contract.Types (Action(..))
import Component.Transfer.View (transfer)
import Data.Array (fromFoldable)
import Data.Default (default)
import Data.Foldable (length)
Expand All @@ -31,8 +31,8 @@ import Marlowe.Execution.State (mkTx)
import Marlowe.Execution.Types (NamedAction(..))
import Marlowe.Semantics (ChoiceId(..), Contract(..), TransactionOutput(..)) as Semantics
import Marlowe.Semantics (Token(..), computeTransaction)
import Material.Icons (icon_)
import Material.Icons as Icon
import Page.Contract.State (currentStep, partyToParticipant, paymentToTransfer, toInput)
import Page.Contract.Types (Action(..))

render :: forall m. Monad m => Input -> ComponentHTML Action ChildSlots m
render =
Expand Down
@@ -1,4 +1,4 @@
module Contacts.Lenses
module Component.Contacts.Lenses
( _walletLibrary
, _cardSection
, _walletNicknameInput
Expand All @@ -15,16 +15,16 @@ module Contacts.Lenses
) where

import Prologue
import Component.InputField.Types (State) as InputField
import Component.Contacts.Types (CardSection, State, Wallet, WalletIdError, WalletInfo, WalletLibrary, WalletNickname, WalletNicknameError, WalletDetails)
import Data.Lens (Lens')
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Lens.Record (prop)
import Data.Map (Map)
import Data.Symbol (SProxy(..))
import InputField.Types (State) as InputField
import Marlowe.PAB (PlutusAppId)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, PubKey, PubKeyHash)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, PubKeyHash)
import Types (WebData)
import Contacts.Types (CardSection, State, Wallet, WalletIdError, WalletInfo, WalletLibrary, WalletNickname, WalletNicknameError, WalletDetails)

_walletLibrary :: Lens' State WalletLibrary
_walletLibrary = prop (SProxy :: SProxy "walletLibrary")
Expand Down
@@ -1,4 +1,4 @@
module Contacts.State
module Component.Contacts.State
( mkInitialState
, defaultWalletDetails
, handleAction
Expand All @@ -16,8 +16,12 @@ import Capability.MarloweStorage (class ManageMarloweStorage, insertIntoWalletLi
import Capability.Toast (class Toast, addToast)
import Clipboard (class MonadClipboard)
import Clipboard (handleAction) as Clipboard
import Component.Contacts.Lenses (_cardSection, _remoteWalletInfo, _walletIdInput, _walletLibrary, _walletNickname, _walletNicknameInput)
import Component.Contacts.Types (Action(..), CardSection(..), State, Wallet(..), WalletDetails, WalletIdError(..), WalletInfo(..), WalletLibrary, WalletNickname, WalletNicknameError(..))
import Component.InputField.Lenses (_pristine, _value)
import Component.InputField.State (handleAction, mkInitialState) as InputField
import Component.InputField.Types (Action(..), State) as InputField
import Control.Monad.Reader (class MonadAsk)
import Dashboard.Types (Action(..)) as Dashboard
import Data.Array (any)
import Data.BigInteger (BigInteger)
import Data.Char.Unicode (isAlphaNum)
Expand All @@ -33,18 +37,14 @@ import Env (Env)
import Halogen (HalogenM, modify_)
import Halogen.Extra (mapSubmodule)
import Halogen.Query.HalogenM (mapAction)
import InputField.Lenses (_pristine, _value)
import InputField.State (handleAction, mkInitialState) as InputField
import InputField.Types (Action(..), State) as InputField
import MainFrame.Types (Action(..)) as MainFrame
import MainFrame.Types (ChildSlots, Msg)
import Marlowe.PAB (PlutusAppId(..))
import Marlowe.Semantics (Assets, Token(..), PubKeyHash(..))
import Marlowe.Semantics (Assets, Token(..))
import Network.RemoteData (RemoteData(..), fromEither)
import Page.Dashboard.Types (Action(..)) as Dashboard
import Toast.Types (errorToast, successToast)
import Types (WebData)
import Contacts.Lenses (_cardSection, _remoteWalletInfo, _walletIdInput, _walletLibrary, _walletNickname, _walletNicknameInput)
import Contacts.Types (Action(..), CardSection(..), State, Wallet(..), WalletDetails, WalletIdError(..), WalletInfo(..), WalletLibrary, WalletNickname, WalletNicknameError(..))

mkInitialState :: WalletLibrary -> State
mkInitialState walletLibrary =
Expand Down
@@ -1,4 +1,4 @@
module Contacts.Types
module Component.Contacts.Types
( State
, WalletLibrary
, WalletNickname
Expand All @@ -14,16 +14,15 @@ module Contacts.Types
import Prologue
import Analytics (class IsEvent, defaultEvent, toEvent)
import Clipboard (Action) as Clipboard
import Data.BigInteger (BigInteger)
import Component.InputField.Types (Action, State) as InputField
import Component.InputField.Types (class InputFieldError)
import Data.Generic.Rep (class Generic)
import Data.Map (Map)
import Data.Newtype (class Newtype)
import Foreign.Class (class Encode, class Decode)
import Foreign.Generic (defaultOptions, genericDecode, genericEncode)
import InputField.Types (Action, State) as InputField
import InputField.Types (class InputFieldError)
import Marlowe.PAB (PlutusAppId)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, PubKey, PubKeyHash)
import Marlowe.Semantics (Assets, MarloweData, MarloweParams, PubKeyHash)
import Types (WebData)

type State
Expand Down
@@ -1,10 +1,20 @@
module Contacts.View
module Component.Contacts.View
( contactsCard
, walletIdTip
) where

import Prelude hiding (div)
import Clipboard (Action(..)) as Clipboard
import Component.Contacts.Lenses (_cardSection, _companionAppId, _walletIdInput, _walletLibrary, _walletNickname, _walletNicknameInput)
import Component.Contacts.Types (Action(..), CardSection(..), State, WalletDetails, WalletIdError, WalletLibrary, WalletNicknameError)
import Component.Icons (Icon(..)) as Icon
import Component.Icons (icon_)
import Component.InputField.Lenses (_value)
import Component.InputField.State (validate)
import Component.InputField.Types (State) as InputField
import Component.InputField.View (renderInput)
import Component.Label.View as Label
import Component.WalletId.View as WalletId
import Css as Css
import Data.Lens (view, (^.))
import Data.Map (isEmpty, toUnfoldable)
Expand All @@ -16,16 +26,6 @@ import Halogen.Css (classNames)
import Halogen.HTML (HTML, a, button, div, h2, h3, li, p, span, text, ul)
import Halogen.HTML.Events.Extra (onClick_)
import Halogen.HTML.Properties (disabled)
import InputField.Lenses (_value)
import InputField.State (validate)
import InputField.Types (State) as InputField
import InputField.View (renderInput)
import Material.Icons (Icon(..)) as Icon
import Material.Icons (icon_)
import Contacts.Lenses (_cardSection, _companionAppId, _walletIdInput, _walletLibrary, _walletNickname, _walletNicknameInput)
import Contacts.Types (Action(..), CardSection(..), State, WalletDetails, WalletIdError, WalletLibrary, WalletNicknameError)
import Component.Label.View as Label
import Component.WalletId.View as WalletId

contactsCard :: forall p. WalletDetails -> State -> HTML p Action
contactsCard currentWallet state =
Expand Down
@@ -1,4 +1,4 @@
module InputField.Lenses
module Component.InputField.Lenses
( _value
, _pristine
, _validator
Expand All @@ -15,11 +15,11 @@ module InputField.Lenses
) where

import Prologue
import Component.InputField.Types (InputDisplayOptions, State)
import Data.Lens (Lens')
import Data.Lens.Record (prop)
import Data.Symbol (SProxy(..))
import Halogen.HTML (HTML)
import InputField.Types (InputDisplayOptions, State)
import Marlowe.Extended.Metadata (NumberFormat)

_value :: forall e. Lens' (State e) String
Expand Down
@@ -1,4 +1,4 @@
module InputField.State
module Component.InputField.State
( dummyState
, mkInitialState
, handleAction
Expand All @@ -8,6 +8,8 @@ module InputField.State
) where

import Prologue
import Component.InputField.Lenses (_dropdownLocked, _dropdownOpen, _pristine, _validator, _value)
import Component.InputField.Types (class InputFieldError, Action(..), State)
import Control.Monad.Reader (class MonadAsk)
import Data.Array (head, last)
import Data.Array (length, take) as Array
Expand All @@ -22,8 +24,6 @@ import Data.String.Extra (leftPadTo, rightPadTo)
import Effect.Aff.Class (class MonadAff)
import Env (Env)
import Halogen (HalogenM, modify_)
import InputField.Lenses (_dropdownLocked, _dropdownOpen, _pristine, _validator, _value)
import InputField.Types (class InputFieldError, Action(..), State)
import Marlowe.Extended.Metadata (NumberFormat(..))

-- see note [dummyState] in MainFrame.State
Expand Down
@@ -1,4 +1,4 @@
module InputField.Types
module Component.InputField.Types
( State
, class InputFieldError
, inputErrorToString
Expand Down
@@ -1,8 +1,11 @@
module InputField.View (renderInput) where
module Component.InputField.View (renderInput) where

import Prologue hiding (div, min)
import Component.Input.Types (InputType(..)) as Input
import Component.Input.View (renderWithChildren) as Input
import Component.InputField.Lenses (_additionalCss, _after, _before, _dropdownLocked, _dropdownOpen, _pristine, _placeholder, _readOnly, _value, _valueOptions, _numberFormat, _id_)
import Component.InputField.State (validate)
import Component.InputField.Types (class InputFieldError, Action(..), InputDisplayOptions, State, inputErrorToString)
import Control.Alt ((<|>))
import Control.MonadPlus (guard)
import Css as Css
Expand All @@ -16,22 +19,6 @@ import Halogen.Css (classNames)
import Halogen.HTML (HTML, a, div, span_, text)
import Halogen.HTML.Events (onMouseEnter, onMouseLeave)
import Halogen.HTML.Events.Extra (onClick_)
import InputField.Lenses
( _additionalCss
, _after
, _before
, _dropdownLocked
, _dropdownOpen
, _pristine
, _placeholder
, _readOnly
, _value
, _valueOptions
, _numberFormat
, _id_
)
import InputField.State (validate)
import InputField.Types (class InputFieldError, Action(..), InputDisplayOptions, State, inputErrorToString)
import Marlowe.Extended.Metadata (NumberFormat(..))

inputCss :: forall w i. InputDisplayOptions w i -> Boolean -> Array String
Expand Down
@@ -1,4 +1,4 @@
module LoadingSubmitButton.Lenses where
module Component.LoadingSubmitButton.Lenses where

import Data.Lens (Lens')
import Data.Lens.Record (prop)
Expand Down
@@ -1,6 +1,9 @@
module LoadingSubmitButton.State (loadingSubmitButton) where
module Component.LoadingSubmitButton.State (loadingSubmitButton) where

import Prologue
import Component.LoadingSubmitButton.Lenses (_buttonHeight, _caption, _enabled, _status, _styles)
import Component.LoadingSubmitButton.Types (Action(..), Input, Message(..), Query(..), State, _submitButtonSlot, buttonRef)
import Component.LoadingSubmitButton.View (render)
import Control.Monad.Cont (lift)
import Control.Monad.Maybe.Trans (MaybeT(..), runMaybeT)
import Data.Int (round)
Expand All @@ -11,9 +14,6 @@ import Halogen (Component, HalogenM, Slot, getHTMLElementRef, liftEffect, mkComp
import Halogen as H
import Halogen.Animation (waitForAllAnimations)
import Halogen.HTML (ComponentHTML, HTML, slot)
import LoadingSubmitButton.Lenses (_buttonHeight, _caption, _enabled, _status, _styles)
import LoadingSubmitButton.Types (Action(..), Input, Message(..), Query(..), State, _submitButtonSlot, buttonRef)
import LoadingSubmitButton.View (render)
import Network.RemoteData (RemoteData(..), fromEither)
import Web.DOM.DOMTokenList as DOMTokenList
import Web.DOM.Element (removeAttribute, setAttribute)
Expand Down
@@ -1,4 +1,4 @@
module LoadingSubmitButton.Types where
module Component.LoadingSubmitButton.Types where

import Prologue
import Data.Symbol (SProxy(..))
Expand Down

0 comments on commit f47b9f1

Please sign in to comment.