diff --git a/static/app-strings.json b/static/app-strings.json index 67e0ef012..87ed5d91e 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -915,12 +915,7 @@ "Support %amount% LBC": "Support %amount% LBC", "You deposited %amount% LBC as a support!": "You deposited %amount% LBC as a support!", "LBRY Link": "LBRY Link", - "Publish to %uri%": "Publish to %uri%", "Your wallet": "Your wallet", "Publish a file, or create a channel": "Publish a file, or create a channel", - "Your account": "Your account", - "Channel profile picture": "Channel profile picture", - "refreshing the app": "refreshing the app", - "Follower": "Follower", - "%repost_channel_link% reposted": "%repost_channel_link% reposted" + "Your account": "Your account" } \ No newline at end of file diff --git a/ui/component/header/view.jsx b/ui/component/header/view.jsx index 343167754..ecba00685 100644 --- a/ui/component/header/view.jsx +++ b/ui/component/header/view.jsx @@ -11,6 +11,7 @@ import WunderBar from 'component/wunderbar'; import Icon from 'component/common/icon'; import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button'; import Tooltip from 'component/common/tooltip'; +import NavigationButton from 'component/navigationButton'; // @if TARGET='app' import { IS_MAC } from 'component/app/view'; // @endif @@ -18,7 +19,15 @@ import { IS_MAC } from 'component/app/view'; type Props = { balance: string, roundedBalance: number, - history: { push: string => void, goBack: () => void, goForward: () => void, location: { pathname: string } }, + history: { + entities: {}[], + goBack: () => void, + goForward: () => void, + index: number, + length: number, + location: { pathname: string }, + push: string => void, + }, currentTheme: string, automaticDarkModeEnabled: boolean, setClientSetting: (string, boolean | string) => void, @@ -105,21 +114,8 @@ const Header = (props: Props) => { {/* @if TARGET='app' */} {!authHeader && (
-
)} {/* @endif */} diff --git a/ui/component/navigationButton/index.js b/ui/component/navigationButton/index.js new file mode 100644 index 000000000..81cb43a8e --- /dev/null +++ b/ui/component/navigationButton/index.js @@ -0,0 +1,3 @@ +import NavigationButton from './view'; + +export default NavigationButton; diff --git a/ui/component/navigationButton/view.jsx b/ui/component/navigationButton/view.jsx new file mode 100644 index 000000000..72c9cb017 --- /dev/null +++ b/ui/component/navigationButton/view.jsx @@ -0,0 +1,91 @@ +// @flow +import React, { useState, useCallback } from 'react'; +import * as ICONS from 'constants/icons'; +import Button from 'component/button'; + +// the maximum length of history to show per button +const MAX_HISTORY_SIZE = 12; + +type Props = { + isBackward: boolean, + history: { + entries: Array<{ key: string, title: string, pathname: string }>, + go: number => void, + goBack: () => void, + goForward: () => void, + index: number, + length: number, + location: { pathname: string }, + push: string => void, + }, +}; + +// 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, maxSize) => { + let l = isBackward ? 0 : currentIndex + 1; + let r = isBackward ? currentIndex : historyLength; + const exceedsMax = maxSize < r - l; + if (!exceedsMax) { + return entries.slice(l, r); + } else if (isBackward) { + l = r - maxSize; + } else { + r = l + maxSize; + } + return entries.slice(l, r); +}; + +const NavigationButton = (props: Props) => { + const { isBackward, history } = props; + const { entries, go } = history; + const currentIndex = history.index; + const historyLength = history.length; + const [showHistory, setShowHistory] = useState(false); + + // creates an
  • intended for the button's