2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2018-11-26 02:21:25 +01:00
|
|
|
import * as ICONS from 'constants/icons';
|
2018-03-26 23:32:43 +02:00
|
|
|
import * as React from 'react';
|
|
|
|
import Button from 'component/button';
|
2018-12-19 06:44:53 +01:00
|
|
|
import LbcSymbol from 'component/common/lbc-symbol';
|
2017-12-21 22:08:54 +01:00
|
|
|
import WunderBar from 'component/wunderbar';
|
2019-04-01 01:04:01 +02:00
|
|
|
import Icon from 'component/common/icon';
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
2018-04-17 07:14:14 +02:00
|
|
|
autoUpdateDownloaded: boolean,
|
2018-03-26 23:32:43 +02:00
|
|
|
balance: string,
|
|
|
|
isUpgradeAvailable: boolean,
|
2018-04-17 07:14:14 +02:00
|
|
|
roundedBalance: string,
|
2018-06-25 08:07:45 +02:00
|
|
|
isBackDisabled: boolean,
|
|
|
|
isForwardDisabled: boolean,
|
|
|
|
back: () => void,
|
|
|
|
forward: () => void,
|
|
|
|
downloadUpgradeRequested: any => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const Header = (props: Props) => {
|
2017-08-16 01:29:55 +02:00
|
|
|
const {
|
2018-04-17 07:14:14 +02:00
|
|
|
autoUpdateDownloaded,
|
2017-08-16 01:29:55 +02:00
|
|
|
balance,
|
2018-04-17 07:14:14 +02:00
|
|
|
downloadUpgradeRequested,
|
2017-11-15 02:51:06 +01:00
|
|
|
isUpgradeAvailable,
|
2018-04-17 07:14:14 +02:00
|
|
|
roundedBalance,
|
2018-06-25 08:07:45 +02:00
|
|
|
back,
|
|
|
|
isBackDisabled,
|
|
|
|
forward,
|
|
|
|
isForwardDisabled,
|
2017-08-16 01:29:55 +02:00
|
|
|
} = props;
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2019-05-07 23:38:29 +02:00
|
|
|
const showUpgradeButton = autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable);
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
return (
|
2018-03-26 23:32:43 +02:00
|
|
|
<header className="header">
|
2018-06-25 08:07:45 +02:00
|
|
|
<div className="header__navigation">
|
2019-04-18 18:51:15 +02:00
|
|
|
<Button
|
|
|
|
className="header__navigation-item header__navigation-item--lbry"
|
|
|
|
label={__('LBRY')}
|
|
|
|
iconRight={ICONS.LBRY}
|
|
|
|
navigate="/"
|
|
|
|
/>
|
2019-03-28 17:53:13 +01:00
|
|
|
{/* @if TARGET='app' */}
|
2019-05-01 07:16:12 +02:00
|
|
|
<div className="header__navigation-arrows">
|
|
|
|
<Button
|
|
|
|
className="header__navigation-item header__navigation-item--back"
|
|
|
|
description={__('Navigate back')}
|
|
|
|
onClick={() => window.history.back()}
|
|
|
|
icon={ICONS.ARROW_LEFT}
|
|
|
|
iconSize={15}
|
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2019-05-01 07:16:12 +02:00
|
|
|
<Button
|
|
|
|
className="header__navigation-item header__navigation-item--forward"
|
|
|
|
description={__('Navigate forward')}
|
|
|
|
onClick={() => window.history.forward()}
|
|
|
|
icon={ICONS.ARROW_RIGHT}
|
|
|
|
iconSize={15}
|
|
|
|
/>
|
2019-04-01 01:04:01 +02:00
|
|
|
</div>
|
2019-03-28 17:53:13 +01:00
|
|
|
{/* @endif */}
|
2018-12-19 06:44:53 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<WunderBar />
|
|
|
|
|
|
|
|
<div className="header__navigation">
|
|
|
|
<Button
|
|
|
|
className="header__navigation-item header__navigation-item--menu"
|
|
|
|
description={__('Menu')}
|
|
|
|
icon={ICONS.MENU}
|
|
|
|
iconSize={15}
|
|
|
|
/>
|
|
|
|
|
2019-04-01 01:04:01 +02:00
|
|
|
<Button
|
2019-05-01 07:16:12 +02:00
|
|
|
className="header__navigation-item header__navigation-item--right-action"
|
|
|
|
activeClass="header__navigation-item--active"
|
2019-04-01 01:04:01 +02:00
|
|
|
description={__('Your wallet')}
|
|
|
|
title={`Your balance is ${balance} LBRY Credits`}
|
|
|
|
label={
|
|
|
|
<React.Fragment>
|
2019-04-03 06:17:00 +02:00
|
|
|
{roundedBalance} <LbcSymbol />
|
2019-04-01 01:04:01 +02:00
|
|
|
</React.Fragment>
|
|
|
|
}
|
2019-04-04 23:05:23 +02:00
|
|
|
navigate="/$/account"
|
2019-04-01 01:04:01 +02:00
|
|
|
/>
|
|
|
|
|
2018-12-19 06:44:53 +01:00
|
|
|
<Button
|
2019-01-14 19:40:06 +01:00
|
|
|
className="header__navigation-item header__navigation-item--right-action"
|
2019-04-03 06:17:00 +02:00
|
|
|
activeClass="header__navigation-item--active"
|
2018-12-19 06:44:53 +01:00
|
|
|
description={__('Publish content')}
|
2018-11-26 02:21:25 +01:00
|
|
|
icon={ICONS.UPLOAD}
|
2019-01-14 19:40:06 +01:00
|
|
|
iconSize={24}
|
2018-03-26 23:32:43 +02:00
|
|
|
label={isUpgradeAvailable ? '' : __('Publish')}
|
2019-03-28 17:53:13 +01:00
|
|
|
navigate="/$/publish"
|
2018-01-04 06:58:51 +01:00
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2019-03-06 18:04:26 +01:00
|
|
|
{/* @if TARGET='app' */}
|
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
{showUpgradeButton && (
|
|
|
|
<Button
|
2019-05-01 07:16:12 +02:00
|
|
|
className="header__navigation-item header__navigation-item--right-action header__navigation-item--upgrade"
|
2018-11-26 02:21:25 +01:00
|
|
|
icon={ICONS.DOWNLOAD}
|
2019-01-14 19:40:06 +01:00
|
|
|
iconSize={24}
|
2018-03-26 23:32:43 +02:00
|
|
|
label={__('Upgrade App')}
|
2018-12-19 06:44:53 +01:00
|
|
|
onClick={downloadUpgradeRequested}
|
2018-03-26 23:32:43 +02:00
|
|
|
/>
|
|
|
|
)}
|
2019-03-06 18:04:26 +01:00
|
|
|
{/* @endif */}
|
2017-06-06 23:19:12 +02:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
);
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2016-08-27 16:12:56 +02:00
|
|
|
|
2016-11-22 21:19:08 +01:00
|
|
|
export default Header;
|