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

[LIVE-2943] Feat/add back forward buttons to web platform player #625

Merged
merged 9 commits into from
Aug 12, 2022

Conversation

chabroA
Copy link
Contributor

@chabroA chabroA commented Jul 11, 2022

📝 Description

Add the back and forward buttons to the web platform player, allowing to easily back and forth in a Live app and also between live apps (like with the Buy / Sell live-app that redirect to other live apps)

Possible to display or hide navigation through a new property in the TopBarConfig prop.

For now, only enables the navigation on the dedicated Ledger Card entry
The navigation on the Buy / Sell screen will be enabled by this PR -> #923

❓ Context

  • Impacted projects: ``
  • Linked resource(s): ``

✅ Checklist

  • Test coverage
  • Atomic delivery
  • No breaking changes

📸 Demo

a

b.mov

🚀 Expectations to reach

We can go back and forward on live apps.

Please make sure you follow these Important Steps.

Pull Requests must pass the CI and be internally validated in order to be merged.

@vercel
Copy link

vercel bot commented Jul 11, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
live-common-tools ✅ Ready (Inspect) Visit Preview Aug 12, 2022 at 7:40AM (UTC)
3 Ignored Deployments
Name Status Preview Updated
ledger-live-github-bot ⬜️ Ignored (Inspect) Aug 12, 2022 at 7:40AM (UTC)
native-ui-storybook ⬜️ Ignored (Inspect) Aug 12, 2022 at 7:40AM (UTC)
react-ui-storybook ⬜️ Ignored (Inspect) Aug 12, 2022 at 7:40AM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented Jul 11, 2022

🦋 Changeset detected

Latest commit: ae151d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
ledger-live-desktop Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the desktop Has changes in LLD label Jul 11, 2022
@chabroA chabroA force-pushed the feat/add-back-forward-buttons-web-platform-player branch from a039d3f to 62b87e1 Compare July 11, 2022 16:14
@chabroA chabroA requested review from IAmMorrow and Justkant July 11, 2022 16:15
@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #625 (2d1e7b1) into release (fe110c9) will increase coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 2d1e7b1 differs from pull request most recent head ae151d6. Consider uploading reports for the commit ae151d6 to get more accurate results

@@             Coverage Diff             @@
##           release     #625      +/-   ##
===========================================
+ Coverage    47.91%   47.92%   +0.01%     
===========================================
  Files          617      620       +3     
  Lines        27578    27870     +292     
  Branches      7126     7177      +51     
===========================================
+ Hits         13215    13358     +143     
- Misses       13296    13393      +97     
- Partials      1067     1119      +52     
Flag Coverage Δ
test 47.92% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
libs/ledger-live-common/src/range.ts 94.87% <0.00%> (-2.57%) ⬇️
libs/ledgerjs/packages/hw-app-btc/src/BtcNew.ts 92.25% <0.00%> (ø)
libs/ledgerjs/packages/hw-app-btc/src/varint.ts 30.76% <0.00%> (ø)
.../ledgerjs/packages/hw-app-btc/src/newops/psbtv2.ts 67.51% <0.00%> (ø)
...dgerjs/packages/hw-app-btc/src/newops/appClient.ts 23.07% <0.00%> (ø)
...dgerjs/packages/hw-app-btc/src/newops/merkleMap.ts 20.00% <0.00%> (ø)
...dgerjs/packages/hw-app-btc/src/splitTransaction.ts 74.22% <0.00%> (ø)
...erjs/packages/hw-app-btc/src/newops/accounttype.ts 65.78% <0.00%> (ø)
...js/packages/hw-app-btc/src/newops/psbtFinalizer.ts 78.57% <0.00%> (ø)
...s/packages/hw-app-btc/src/newops/clientCommands.ts 10.45% <0.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

github-actions bot commented Jul 11, 2022

@chabroA

Screenshots: ✅

There are no changes in the screenshots for this PR. If this is expected, you are good to go.

Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

LGTM just a question for the ref

@Justkant
Copy link
Contributor

We also need a changeset for this PR

} = config;

const [canGoBack, setCanGoBack] = React.useState(false);
const [canGoForward, setCanGoForward] = React.useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

it appears that canGoBack === canGoForward is kept true at any point in time, so you only need one state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to keep track of both cases, to enable or disable the "forward" or "backward" button accordingly.

Furthermore, canGoBack === canGoForward is not true at all time. Sometimes you can go back but not forward, and some other times you can go forward but not back. And sometimes you can do both

Copy link
Contributor

@gre gre left a comment

Choose a reason for hiding this comment

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

is it possible to have a unit test that instrument this to be able to test end to end?

We have to test all our PRs. and Desktop offers way to implement this. maybe a mock page could be used to record the events and assert it works? 🙏 would be super beneficial for non regression in future.

@gre gre self-assigned this Jul 26, 2022
@chabroA chabroA force-pushed the feat/add-back-forward-buttons-web-platform-player branch from 78c0e1a to e4a223b Compare August 5, 2022 13:22
@chabroA
Copy link
Contributor Author

chabroA commented Aug 5, 2022

is it possible to have a unit test that instrument this to be able to test end to end?

We have to test all our PRs. and Desktop offers way to implement this. maybe a mock page could be used to record the events and assert it works? 🙏 would be super beneficial for non regression in future.

After further investigation and tests, we currently don't have a proper testing framework to easily build and reliably maintain such tests.
IMHO we should consider working on such framework independently from this feature PR (it's also a broader R&D subject) rather than blocking it until such thing is available

cf. this PR as a non conclusive attempt to add such tests in the current framework

Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

small changes and we can merge this

@chabroA chabroA changed the title Feat/add back forward buttons to web platform player [LIVE-2943] Feat/add back forward buttons to web platform player Aug 10, 2022
@chabroA chabroA requested review from Justkant and gre August 10, 2022 07:14
Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

LGTM

@chabroA chabroA changed the base branch from develop to release August 12, 2022 07:33
@chabroA chabroA changed the base branch from release to develop August 12, 2022 07:33
@chabroA chabroA changed the base branch from develop to release August 12, 2022 07:34
@chabroA chabroA force-pushed the feat/add-back-forward-buttons-web-platform-player branch from f940aab to ae151d6 Compare August 12, 2022 07:37
@chabroA chabroA added the release candidate for next release label Aug 12, 2022
@chabroA chabroA merged commit 2589194 into release Aug 12, 2022
@chabroA chabroA deleted the feat/add-back-forward-buttons-web-platform-player branch August 12, 2022 12:18
chabroA added a commit that referenced this pull request Aug 19, 2022
* add possibility to go back and forward

* use arrow icon

* move webview specific callbacks to TopBar

* disable nav buttons when nav not possible

* Add shouldDisplayNavigation to TopBarConfig

* Use webview ref as prop instead of ref current value

* add comments for events listened to

* small code style changes

* Add changeset
chabroA added a commit that referenced this pull request Aug 19, 2022
* add possibility to go back and forward

* use arrow icon

* move webview specific callbacks to TopBar

* disable nav buttons when nav not possible

* Add shouldDisplayNavigation to TopBarConfig

* Use webview ref as prop instead of ref current value

* add comments for events listened to

* small code style changes

* Add changeset
chabroA added a commit that referenced this pull request Aug 19, 2022
chabroA added a commit that referenced this pull request Aug 23, 2022
* [LIVE-2943] Feat/add back forward buttons to web platform player (#625)

* add possibility to go back and forward

* use arrow icon

* move webview specific callbacks to TopBar

* disable nav buttons when nav not possible

* Add shouldDisplayNavigation to TopBarConfig

* Use webview ref as prop instead of ref current value

* add comments for events listened to

* small code style changes

* Add changeset

* use navigation is buy/sell screen

* Revert "use navigation is buy/sell screen"

This reverts commit 647b892.

* handle Buy Sell live app in exchange screen

* add changeset

* Revert "[LIVE-2943] Feat/add back forward buttons to web platform player (#625)"

This reverts commit 3caf8e1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Has changes in LLD release candidate for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants