Middle Header: Hide big buttons when playing audio (#1541)

This commit is contained in:
Alexander Zinchuk 2021-11-10 23:13:22 +03:00
parent 7ee51beaf6
commit 9319a260bb
3 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,7 @@ interface OwnProps {
chatId: string; chatId: string;
threadId: number; threadId: number;
messageListType: MessageListType; messageListType: MessageListType;
canExpandActions: boolean;
} }
interface StateProps { interface StateProps {
@ -63,6 +64,7 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
canMute, canMute,
canLeave, canLeave,
isRightColumnShown, isRightColumnShown,
canExpandActions,
joinChannel, joinChannel,
sendBotCommand, sendBotCommand,
openLocalTextSearch, openLocalTextSearch,
@ -120,17 +122,17 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
return ( return (
<div className="HeaderActions"> <div className="HeaderActions">
{!IS_SINGLE_COLUMN_LAYOUT && canSubscribe && ( {!IS_SINGLE_COLUMN_LAYOUT && canExpandActions && canSubscribe && (
<Button <Button
size="tiny" size="tiny"
ripple ripple
fluid fluid
onClick={handleSubscribeClick} onClick={handleSubscribeClick}
> >
{lang(isChannel ? 'Subscribe' : 'Join Group')} {lang(isChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}
</Button> </Button>
)} )}
{!IS_SINGLE_COLUMN_LAYOUT && canStartBot && ( {!IS_SINGLE_COLUMN_LAYOUT && canExpandActions && canStartBot && (
<Button <Button
size="tiny" size="tiny"
ripple ripple
@ -140,7 +142,7 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
{lang('BotStart')} {lang('BotStart')}
</Button> </Button>
)} )}
{!IS_SINGLE_COLUMN_LAYOUT && canRestartBot && ( {!IS_SINGLE_COLUMN_LAYOUT && canExpandActions && canRestartBot && (
<Button <Button
size="tiny" size="tiny"
ripple ripple
@ -181,6 +183,7 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
threadId={threadId} threadId={threadId}
isOpen={isMenuOpen} isOpen={isMenuOpen}
anchor={menuPosition} anchor={menuPosition}
withExtraActions={IS_SINGLE_COLUMN_LAYOUT || !canExpandActions}
isChannel={isChannel} isChannel={isChannel}
canStartBot={canStartBot} canStartBot={canStartBot}
canRestartBot={canRestartBot} canRestartBot={canRestartBot}

View File

@ -34,6 +34,7 @@ export type OwnProps = {
chatId: string; chatId: string;
threadId: number; threadId: number;
isOpen: boolean; isOpen: boolean;
withExtraActions: boolean;
anchor: IAnchorPosition; anchor: IAnchorPosition;
isChannel?: boolean; isChannel?: boolean;
canStartBot?: boolean; canStartBot?: boolean;
@ -60,6 +61,7 @@ type StateProps = {
const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
chatId, chatId,
isOpen, isOpen,
withExtraActions,
anchor, anchor,
isChannel, isChannel,
canStartBot, canStartBot,
@ -161,7 +163,7 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
style={`left: ${x}px;top: ${y}px;`} style={`left: ${x}px;top: ${y}px;`}
onClose={closeMenu} onClose={closeMenu}
> >
{IS_SINGLE_COLUMN_LAYOUT && canStartBot && ( {withExtraActions && canStartBot && (
<MenuItem <MenuItem
icon="bots" icon="bots"
onClick={handleStartBot} onClick={handleStartBot}
@ -169,7 +171,7 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
{lang('BotStart')} {lang('BotStart')}
</MenuItem> </MenuItem>
)} )}
{IS_SINGLE_COLUMN_LAYOUT && canRestartBot && ( {withExtraActions && canRestartBot && (
<MenuItem <MenuItem
icon="bots" icon="bots"
onClick={handleRestartBot} onClick={handleRestartBot}
@ -177,12 +179,12 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
{lang('BotRestart')} {lang('BotRestart')}
</MenuItem> </MenuItem>
)} )}
{IS_SINGLE_COLUMN_LAYOUT && canSubscribe && ( {withExtraActions && canSubscribe && (
<MenuItem <MenuItem
icon={isChannel ? 'channel' : 'group'} icon={isChannel ? 'channel' : 'group'}
onClick={handleSubscribe} onClick={handleSubscribe}
> >
{lang(isChannel ? 'Subscribe' : 'Join Group')} {lang(isChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}
</MenuItem> </MenuItem>
)} )}
{canAddContact && ( {canAddContact && (

View File

@ -429,6 +429,7 @@ const MiddleHeader: FC<OwnProps & StateProps & DispatchProps> = ({
chatId={chatId} chatId={chatId}
threadId={threadId} threadId={threadId}
messageListType={messageListType} messageListType={messageListType}
canExpandActions={!isAudioPlayerRendered}
/> />
</div> </div>
</div> </div>