Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCP-2092: Implement new design of contract cards. #3556

Merged
merged 5 commits into from
Jul 19, 2021

Conversation

merivale
Copy link
Contributor

@merivale merivale commented Jul 15, 2021

This implements the new designs for the dashboard, with the contract summary cards including the actions possible at the current step. I haven't changed the style of the actions themselves, since that change also applies to the current step card on the contract screen - and I'll attack the contract screen in the next PR. This PR already feels quite big enough, especially the diff of the Contract.View module.

Until now, the selectedContractIndex in the Dashboard.State was doing two things: determining which contract screen was visible, and also which contract any Contract.Action applied to. In the new designs, a Contract.Action for any contract can be called from the dashboard, without the need to first go into the screen for that contract, so these two things needed to come apart. I left the selectedContractIndex to determine which contract screen is visible, and added an contract index (PlutusAppId) parameter to ContractAction.

While I was at it, I deleted the followerAppId from the Contract.State, which is duplicate information already available as the key of the contract map in the Dashboard.State. Instead I'm passing this as input to the contract action handlers, which feels nicer. And because the contract view needs to know about this, I changed the partitioned arrays of contracts (running / completed) to maps. Since the filter functions are being called every second, we might want to store these as separate maps in the sate - but I haven't noticed any performance issues yet, so I'm not too worried about it.

localhost_8009_ (10)

@merivale merivale requested a review from hrajchert July 15, 2021 09:31
Copy link
Contributor

@hrajchert hrajchert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good🦄

handleAction _ (SetNickname nickname) = do
handleAction { followerAppId } SelectSelf = callMainFrameAction $ MainFrame.DashboardAction $ Dashboard.SelectContract $ Just followerAppId

handleAction { followerAppId } (SetNickname nickname) = do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using the app id here right?

handleAction _ (SetNickname nickname)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we need it to insertIntoContractNicknames (contractNicknames is a Map PlutusAppId String)

, type_ InputText
, value nickname
, onValueInput_ SetNickname
, placeholder "Please rename"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the Please rename something for us internal to remember we have to rename? if so, it's probably worth to add a FIXME. If it's for the end user we might want to ask Niahm for some copy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a note for us - this is the text Russ included in his designs

@merivale merivale force-pushed the merivale/contract-card-redux branch 3 times, most recently from 3fd0ef7 to 3596af5 Compare July 16, 2021 16:27
@merivale merivale force-pushed the merivale/contract-card-redux branch from 3596af5 to 8960485 Compare July 19, 2021 07:25
@merivale merivale merged commit 8e6e1a0 into master Jul 19, 2021
@merivale merivale deleted the merivale/contract-card-redux branch July 19, 2021 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants