2021-12-20 13:29:51 +01:00
|
|
|
// @flow
|
2021-12-21 13:42:28 +01:00
|
|
|
import 'scss/component/_header.scss';
|
|
|
|
|
2022-07-11 16:12:37 +02:00
|
|
|
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
2022-06-17 11:49:22 +02:00
|
|
|
import { useHistory } from 'react-router';
|
2021-12-20 13:29:51 +01:00
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import * as PAGES from 'constants/pages';
|
2022-06-03 15:43:31 +02:00
|
|
|
import Button from 'component/button';
|
2021-12-20 13:29:51 +01:00
|
|
|
import Icon from 'component/common/icon';
|
|
|
|
import React from 'react';
|
2021-12-20 13:38:12 +01:00
|
|
|
import Tooltip from 'component/common/tooltip';
|
2021-12-20 13:29:51 +01:00
|
|
|
|
|
|
|
type HeaderMenuButtonProps = {
|
|
|
|
activeChannelStakedLevel: number,
|
|
|
|
authenticated: boolean,
|
|
|
|
user: ?User,
|
2022-03-09 19:05:37 +01:00
|
|
|
doOpenModal: (string, {}) => void,
|
2021-12-20 13:29:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
2022-07-11 16:12:37 +02:00
|
|
|
const { authenticated, user } = props;
|
2021-12-20 13:29:51 +01:00
|
|
|
|
2022-03-09 19:05:37 +01:00
|
|
|
const livestreamEnabled = Boolean(ENABLE_NO_SOURCE_CLAIMS && user && !user.odysee_live_disabled);
|
2021-12-20 13:29:51 +01:00
|
|
|
|
2022-04-27 14:54:02 +02:00
|
|
|
const uploadProps = { requiresAuth: !authenticated };
|
2022-06-17 11:49:22 +02:00
|
|
|
const { push } = useHistory();
|
2022-04-27 14:54:02 +02:00
|
|
|
|
2022-07-11 16:12:37 +02:00
|
|
|
return authenticated ? (
|
2021-12-20 13:29:51 +01:00
|
|
|
<div className="header__buttons">
|
2022-07-11 16:12:37 +02:00
|
|
|
<Tooltip title={__('Upload a file')}>
|
|
|
|
<Button className="header__navigationItem--icon" navigate={`/$/${PAGES.UPLOAD}`}>
|
|
|
|
<Icon size={18} icon={ICONS.PUBLISH} aria-hidden />
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
{livestreamEnabled && (
|
|
|
|
<Tooltip title={__('Go live')}>
|
|
|
|
<Button className="header__navigationItem--icon" {...uploadProps} navigate={`/$/${PAGES.LIVESTREAM}`}>
|
|
|
|
<Icon size={18} icon={ICONS.VIDEO} aria-hidden />
|
|
|
|
</Button>
|
2022-04-27 14:54:02 +02:00
|
|
|
</Tooltip>
|
2022-06-03 15:43:31 +02:00
|
|
|
)}
|
2022-07-11 16:12:37 +02:00
|
|
|
<Tooltip title={__('Post an article')}>
|
|
|
|
<Button className="header__navigationItem--icon" navigate={`/$/${PAGES.POST}`}>
|
|
|
|
<Icon size={18} icon={ICONS.POST} aria-hidden />
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
2021-12-20 13:29:51 +01:00
|
|
|
</div>
|
2022-07-11 16:12:37 +02:00
|
|
|
) : (
|
|
|
|
<Tooltip title={__('Settings')}>
|
|
|
|
<Button className="header__navigationItem--icon" onClick={() => push(`/$/${PAGES.SETTINGS}`)}>
|
|
|
|
<Icon size={18} icon={ICONS.SETTINGS} aria-hidden />
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
2021-12-20 13:29:51 +01:00
|
|
|
);
|
|
|
|
}
|