From f2f19b7863171b24099a287427296cf3c3dc754f Mon Sep 17 00:00:00 2001 From: Dalton Date: Thu, 23 Jan 2020 22:11:06 -0600 Subject: [PATCH] history works well but only for channel related pages - need to add title update hook for other pages --- ui/component/buttonNavigation/view.jsx | 40 ++++++++++++++------------ ui/component/header/view.jsx | 2 +- ui/page/show/view.jsx | 17 ++++++++++- ui/scss/component/_header.scss | 2 ++ ui/store.js | 7 ----- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/ui/component/buttonNavigation/view.jsx b/ui/component/buttonNavigation/view.jsx index 0399ea0a4..df5e115a2 100644 --- a/ui/component/buttonNavigation/view.jsx +++ b/ui/component/buttonNavigation/view.jsx @@ -17,56 +17,58 @@ type Props = { }, }; +// determines which slice of entries should make up the back or forward button drop-downs (isBackward vs !isBackward respectively) +const sliceEntries = (currentIndex, entries, historyLength, isBackward) => { + const l = isBackward ? 0 : currentIndex + 1; + const r = isBackward ? currentIndex : historyLength; + return entries.slice(l, r); +}; + const ButtonNavigation = (props: Props) => { const { isBackward, history } = props; + const { entries, go } = history; + const currentIndex = history.index; + const historyLength = history.length; const [showHistory, setShowHistory] = useState(false); - const makeEntrySlice = useCallback(() => { - const left = isBackward ? 1 : history.index + 1; - const right = isBackward ? history.index : history.length; - return history.entries.slice(left, right); - }, [history, isBackward]); - + // creates an
  • intended for the button's