lbry-desktop/src/renderer/component/header/view.jsx

76 lines
1.9 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import * as React from 'react';
import Button from 'component/button';
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 = {
autoUpdateDownloaded: boolean,
2018-03-26 23:32:43 +02:00
balance: string,
downloadUpgradeRequested: any => void,
isUpgradeAvailable: boolean,
navigate: any => void,
roundedBalance: string,
2018-03-26 23:32:43 +02:00
};
const Header = (props: Props) => {
const {
autoUpdateDownloaded,
balance,
downloadUpgradeRequested,
isUpgradeAvailable,
navigate,
roundedBalance,
} = 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"
onClick={() => navigate('/wallet')}
2018-03-26 23:32:43 +02:00
label={
isUpgradeAvailable ? (
`${balance}`
) : (
<React.Fragment>
<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"
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-11-22 21:19:08 +01:00
export default Header;