2021-08-30 18:42:24 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import {
|
2021-08-31 16:13:31 +03:00
|
|
|
openPublicRooms, openCreateRoom, openInviteUser,
|
2021-08-30 18:42:24 +03:00
|
|
|
} from '../../../client/action/navigation';
|
|
|
|
|
|
|
|
import Text from '../../atoms/text/Text';
|
|
|
|
import Header, { TitleWrapper } from '../../atoms/header/Header';
|
|
|
|
import IconButton from '../../atoms/button/IconButton';
|
|
|
|
import ContextMenu, { MenuItem, MenuHeader } from '../../atoms/context-menu/ContextMenu';
|
|
|
|
|
|
|
|
import PlusIC from '../../../../public/res/ic/outlined/plus.svg';
|
|
|
|
import HashPlusIC from '../../../../public/res/ic/outlined/hash-plus.svg';
|
|
|
|
import HashSearchIC from '../../../../public/res/ic/outlined/hash-search.svg';
|
|
|
|
|
|
|
|
function DrawerHeader({ activeTab }) {
|
|
|
|
return (
|
|
|
|
<Header>
|
|
|
|
<TitleWrapper>
|
|
|
|
<Text variant="s1">{(activeTab === 'home' ? 'Home' : 'Direct messages')}</Text>
|
|
|
|
</TitleWrapper>
|
|
|
|
{(activeTab === 'dm')
|
|
|
|
? <IconButton onClick={() => openInviteUser()} tooltip="Start DM" src={PlusIC} size="normal" />
|
|
|
|
: (
|
|
|
|
<ContextMenu
|
|
|
|
content={(hideMenu) => (
|
|
|
|
<>
|
2021-08-31 16:13:31 +03:00
|
|
|
<MenuHeader>Add room</MenuHeader>
|
2021-08-30 18:42:24 +03:00
|
|
|
<MenuItem
|
|
|
|
iconSrc={HashPlusIC}
|
2021-08-31 16:13:31 +03:00
|
|
|
onClick={() => { hideMenu(); openCreateRoom(); }}
|
2021-08-30 18:42:24 +03:00
|
|
|
>
|
2021-08-31 16:13:31 +03:00
|
|
|
Create new room
|
2021-08-30 18:42:24 +03:00
|
|
|
</MenuItem>
|
|
|
|
<MenuItem
|
|
|
|
iconSrc={HashSearchIC}
|
2021-08-31 16:13:31 +03:00
|
|
|
onClick={() => { hideMenu(); openPublicRooms(); }}
|
2021-08-30 18:42:24 +03:00
|
|
|
>
|
2021-08-31 16:13:31 +03:00
|
|
|
Add public room
|
2021-08-30 18:42:24 +03:00
|
|
|
</MenuItem>
|
|
|
|
</>
|
|
|
|
)}
|
2021-08-31 16:13:31 +03:00
|
|
|
render={(toggleMenu) => (<IconButton onClick={toggleMenu} tooltip="Add room" src={PlusIC} size="normal" />)}
|
2021-08-30 18:42:24 +03:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{/* <IconButton onClick={() => ''} tooltip="Menu" src={VerticalMenuIC} size="normal" /> */}
|
|
|
|
</Header>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
DrawerHeader.propTypes = {
|
|
|
|
activeTab: PropTypes.string.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default DrawerHeader;
|