Right Click to Navigate History #3547

Merged
dalhill merged 11 commits from 3474-history-buttons into master 2020-02-03 16:19:16 +01:00
dalhill commented 2020-01-25 22:58:14 +01:00 (Migrated from github.com)

PR Checklist

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I have checked that this PR does not introduce a breaking change

PR Type

  • Feature

Fixes

Issue Number: #3474

What is the current behavior?

In order to navigate history, the user must do so one step at a time.

What is the new behavior?

User is able to right click the navigation buttons to move forward or backward multiple steps.

backward

forward

Other information

Possible improvements

  • Limit the size of the history. Showing only 12 historical entries on either side. This is consistent with chrome.
  • Configure the list to dropdown the same height as the other header buttons.
  • If there is no "forward" or "backward" action to be taken, disable the button.
## PR Checklist - [x] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged) - [x] I have checked that this PR does not introduce a breaking change ## PR Type - [x] Feature ## Fixes Issue Number: #3474 ## What is the current behavior? In order to navigate history, the user must do so one step at a time. ## What is the new behavior? User is able to right click the navigation buttons to move forward or backward multiple steps. ![backward](https://user-images.githubusercontent.com/15717854/73127743-bbfa4800-3f8a-11ea-8664-b0be99acaf81.png) ![forward](https://user-images.githubusercontent.com/15717854/73127745-be5ca200-3f8a-11ea-94a3-de0c226c385f.png) ## Other information Possible improvements - [x] Limit the size of the history. Showing only 12 historical entries on either side. This is consistent with chrome. - [x] Configure the list to dropdown the same height as the other header buttons. - [x] If there is no "forward" or "backward" action to be taken, disable the button.
dalhill (Migrated from github.com) reviewed 2020-01-25 23:01:49 +01:00
dalhill (Migrated from github.com) commented 2020-01-25 23:01:49 +01:00

BTW - streamName was coming as a string of value 'undefined'. I didn't look too far into this bug.

BTW - streamName was coming as a string of value 'undefined'. I didn't look too far into this bug.
neb-b (Migrated from github.com) reviewed 2020-01-27 16:57:54 +01:00
neb-b (Migrated from github.com) left a comment

A few questions

A few questions
@ -0,0 +68,4 @@
const slicedEntries = sliceEntries(currentIndex, entries, historyLength, isBackward, MAX_HISTORY_SIZE);
return (
<div>
<Button
neb-b (Migrated from github.com) commented 2020-01-27 16:57:36 +01:00

Are you able to determine if we can go back here or not? If so, it would be great to disable the back button and give it some disabled style so it's easier to tell that you can't

Are you able to determine if we can go back here or not? If so, it would be great to disable the back button and give it some disabled style so it's easier to tell that you can't
@ -72,0 +98,4 @@
document.title = title;
} else if (streamName) {
document.title = streamName;
} else if (channelName) {
neb-b (Migrated from github.com) commented 2020-01-27 16:53:52 +01:00

Why did you move this effect out of the show component?

Why did you move this effect out of the show component?
neb-b (Migrated from github.com) commented 2020-01-27 16:52:33 +01:00

What is the difference between these two?

What is the difference between these two?
tzarebczan commented 2020-01-27 17:43:16 +01:00 (Migrated from github.com)

Thanks for the PR! Once this is fully reviewed/corrected/merged, please send us an email so we can show you some appreciation

Thanks for the PR! Once this is fully reviewed/corrected/merged, please send us an email so we can show you some [appreciation](https://lbry.com/faq/appreciation)
dalhill (Migrated from github.com) reviewed 2020-01-28 00:20:27 +01:00
dalhill (Migrated from github.com) commented 2020-01-28 00:20:26 +01:00

createMemoryHistory gives us an array of entries so that we can reference the history stack.

Excerpt from history/docs/GettingStarted

Additionally, createMemoryHistory provides history.index and history.entries properties that let you inspect the history stack.

createMemoryHistory gives us an array of entries so that we can reference the history stack. *Excerpt from [history/docs/GettingStarted](https://github.com/ReactTraining/history/blob/master/docs/GettingStarted.md)* > Additionally, createMemoryHistory provides history.index and history.entries properties that let you inspect the history stack.
dalhill (Migrated from github.com) reviewed 2020-01-28 00:22:52 +01:00
@ -72,0 +98,4 @@
document.title = title;
} else if (streamName) {
document.title = streamName;
} else if (channelName) {
dalhill (Migrated from github.com) commented 2020-01-28 00:22:52 +01:00

I want this to fire on every page and not just the pages that render using the ShowPage component.

I want this to fire on every page and not just the pages that render using the ShowPage component.
dalhill (Migrated from github.com) reviewed 2020-01-28 02:07:31 +01:00
@ -0,0 +68,4 @@
const slicedEntries = sliceEntries(currentIndex, entries, historyLength, isBackward, MAX_HISTORY_SIZE);
return (
<div>
<Button
dalhill (Migrated from github.com) commented 2020-01-28 02:07:31 +01:00

PR has been updated to disable button if no historical entries.

PR has been updated to disable button if no historical entries.
neb-b (Migrated from github.com) reviewed 2020-01-28 16:24:38 +01:00
@ -0,0 +68,4 @@
const slicedEntries = sliceEntries(currentIndex, entries, historyLength, isBackward, MAX_HISTORY_SIZE);
return (
<div>
<Button
neb-b (Migrated from github.com) commented 2020-01-28 16:24:37 +01:00

Awesome!

Awesome!
neb-b commented 2020-01-28 16:26:51 +01:00 (Migrated from github.com)

Nice work @dalhill. This is really close.

I'll spend some time testing your branch this week just to make sure there aren't any issues on electron moving to memoryHistory, but I don't think there will be. I'll also push up a commit and do another pass at the styling.

Nice work @dalhill. This is really close. I'll spend some time testing your branch this week just to make sure there aren't any issues on electron moving to memoryHistory, but I don't think there will be. I'll also push up a commit and do another pass at the styling.
dalhill commented 2020-01-29 02:56:43 +01:00 (Migrated from github.com)

Pushed to resolve conflicts

Pushed to resolve conflicts
neb-b (Migrated from github.com) approved these changes 2020-02-03 15:59:27 +01:00
neb-b (Migrated from github.com) left a comment

I pushed up a commit that cleaned up the styling. I'll get this merged today!

I pushed up a commit that cleaned up the styling. I'll get this merged today!
neb-b (Migrated from github.com) commented 2020-02-03 15:33:17 +01:00

I think it's when you call parseURI with an undefined uri. Only calling parseURI if uri exists should fix it.

I think it's when you call `parseURI` with an `undefined` uri. Only calling `parseURI` if uri exists should fix it.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-desktop#3547
No description provided.