2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import Button from 'component/button';
|
2017-12-21 22:08:54 +01:00
|
|
|
import WunderBar from 'component/wunderbar';
|
2018-03-26 23:32:43 +02:00
|
|
|
import * as icons from 'constants/icons';
|
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,
|
|
|
|
downloadUpgradeRequested: any => void,
|
|
|
|
isUpgradeAvailable: boolean,
|
2018-04-17 07:14:14 +02:00
|
|
|
navigate: any => void,
|
|
|
|
roundedBalance: string,
|
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,
|
2017-08-16 01:29:55 +02:00
|
|
|
navigate,
|
2018-04-17 07:14:14 +02:00
|
|
|
roundedBalance,
|
2017-08-16 01:29:55 +02:00
|
|
|
} = props;
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
const showUpgradeButton =
|
|
|
|
autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable);
|
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
return (
|
2018-03-26 23:32:43 +02:00
|
|
|
<header className="header">
|
|
|
|
<WunderBar />
|
|
|
|
<div className="header__actions-right">
|
|
|
|
<Button
|
|
|
|
button="inverse"
|
|
|
|
className="btn--header-balance"
|
2017-12-21 22:08:54 +01:00
|
|
|
onClick={() => navigate('/wallet')}
|
2018-03-26 23:32:43 +02:00
|
|
|
label={
|
|
|
|
isUpgradeAvailable ? (
|
|
|
|
`${balance}`
|
|
|
|
) : (
|
|
|
|
<React.Fragment>
|
2018-04-17 07:14:14 +02:00
|
|
|
<span className="btn__label--balance" title={`${balance} LBC`}>
|
|
|
|
You have
|
|
|
|
</span>{' '}
|
|
|
|
<span title={`${balance} LBC`}>{roundedBalance} LBC</span>
|
2018-03-26 23:32:43 +02:00
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
iconRight="LBC"
|
|
|
|
description={__('Your wallet')}
|
2017-06-06 23:19:12 +02:00
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
<Button
|
|
|
|
uppercase
|
|
|
|
button="primary"
|
2018-04-17 04:21:19 +02:00
|
|
|
className="btn--header-publish"
|
2017-12-21 22:08:54 +01:00
|
|
|
onClick={() => navigate('/publish')}
|
2018-03-26 23:32:43 +02:00
|
|
|
icon={icons.UPLOAD}
|
|
|
|
label={isUpgradeAvailable ? '' : __('Publish')}
|
|
|
|
description={__('Publish content')}
|
2018-01-04 06:58:51 +01:00
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
{showUpgradeButton && (
|
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
onClick={downloadUpgradeRequested}
|
|
|
|
icon={icons.DOWNLOAD}
|
|
|
|
label={__('Upgrade App')}
|
|
|
|
/>
|
|
|
|
)}
|
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;
|