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

[DDW-1111] Non-recommended decimal place setting alert is not displayed before 1st change of settings #3007

Conversation

marcin-mazurek
Copy link
Contributor

@marcin-mazurek marcin-mazurek commented Jun 30, 2022

This PR fixes the issue with non-recommended decimal place setting not displayed before the first change of settings.

Related PR: #2905

Screenshots

No UI changes.

Testing Checklist


Review Checklist

Basics

  • PR assigned to the PR author(s)
  • input-output-hk/daedalus-dev and input-output-hk/daedalus-qa assigned as PR reviewers
  • If there are UI changes, Alexander Rukin assigned as an additional reviewer
  • All visual regression testing has been reviewed (assign run Chromatic label to PR to trigger the run)
  • PR has appropriate labels (release-vNext, feature/bug/chore, WIP)
  • PR link is added to a Jira ticket, ticket moved to In Review
  • [x PR is updated to the most recent version of the target branch (and there are no conflicts)
  • PR has a good description that summarizes all changes
  • PR contains screenshots (in case of UI changes)
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • There are no missing translations (running yarn manage:translations produces no changes)
  • Text changes are proofread and approved (Jane Wild / Amy Reeve)
  • Japanese text changes are proofread and approved (Junko Oda)
  • Storybook works and no stories are broken (yarn storybook)
  • In case of dependency changes yarn.lock file is updated

Code Quality

  • Important parts of the code are properly commented and documented
  • Code is properly typed with typescript types
  • React components are split-up enough to avoid unnecessary re-renderings
  • Any code that only works in main process is neatly separated from components

Testing

  • New feature/change is covered by acceptance tests
  • New feature/change is manually tested and approved by QA team
  • All existing acceptance tests are still up-to-date
  • New feature/change is covered by Daedalus Testing scenario
  • All existing Daedalus Testing scenarios are still up-to-date

After Review

  • Update Slack QA thread by marking it with a green checkmark

@marcin-mazurek marcin-mazurek self-assigned this Jun 30, 2022
@marcin-mazurek marcin-mazurek changed the title [DDW-1111] Non-recommended decimal place settinng alert is not displayed before 1st change of settings [DDW-1111] Non-recommended decimal place setting alert is not displayed before 1st change of settings Jul 4, 2022

export type WalletLocalData = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved those to separate file.

decimals: hasSavedDecimals
? savedDecimals
: recommendedDecimals || DEFAULT_DECIMAL_PRECISION,
decimals: hasRecommendedDecimals
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The correct logic is: when the user opens the settings, if the token has recomended decimal, it should use it as the initial value, so it can be saved right away (in fact - fixed). If there is no recommendation we should show the current or fallback value.

Copy link
Contributor

Choose a reason for hiding this comment

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

What if the user already has saved decimals? Would it display the recommended anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is my understanding of the requirement. @dmitrii-gaico could you confirm?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that also seems a bit weird to me 🤔 I would also think that the saved decimals always trump the recommended ones (if there was anything saved ofc) like it was before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, so I personally believe we should never change the initial form value, we should always show the current setting no matter what is recommended. As a user, when I open the edit form, I expect to see the currently applied values, no matter if these are defaults or set by me explicitly. Unless that value can no longer be used (eg. because the value selected is no longer available).

Initially when I tried to understand what was the problem, I really couldn't wrap my head around the UX of this form until I jumped on a call with @dmitrii-gaico and he explained it to me.

I would personally show a red screaming alert that the current setting is different from recommended setting (instead of tiny warning sign with no text) and give the user the chance to decide. Or at least add one more section that shows the current setting, because at the moment the user cannot clearly see what is the currently used decimal (or maybe I still don't understand this feature).

But - this is my personal opionion - and I guess this was already discussed in the past and carefully thought through.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be fair, as a user of multiple wallets, this is something unique to Daedalus and I was also initially confused in the beginning. But in my experience, initial state is initial (default) state unless there has been a write operation where that bit of state has been overridden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed with @dmitrii-gaico, this change should be reverted to the original implementation.

TransportDevice,
} from '../../../common/types/hardware-wallets.types';

export type WalletLocalData = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved those from source/renderer/app/api/utils/localStorage.ts

@marcin-mazurek marcin-mazurek removed the WIP label Jul 4, 2022
@dmitrii-gaico dmitrii-gaico self-requested a review July 6, 2022 08:07
@miorsufianiohk miorsufianiohk self-requested a review July 7, 2022 08:19
Copy link

@miorsufianiohk miorsufianiohk left a comment

Choose a reason for hiding this comment

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

Great work @marcin-mazurek . Tested on 22001 👍

Copy link
Contributor

@danielmain danielmain left a comment

Choose a reason for hiding this comment

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

Great job @marcin-mazurek

@danielmain danielmain merged commit 9ee0dd5 into develop Jul 7, 2022
@iohk-bors iohk-bors bot deleted the fix/ddw-1111-non-recommended-decimal-settings-warning-not-shown branch July 7, 2022 13:16
@danielmain danielmain added release-5.0.0 Daedalus version 5.0.0 and removed ⏳release-vNext labels Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug release-5.0.0 Daedalus version 5.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants