-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MM-42420] Implement new "Start Call" channel header button (#62)
* Update header button to use registerCallButtonAction * Simplify registrations
- Loading branch information
1 parent
fd6a63c
commit fe44602
Showing
7 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
webapp/src/components/channel_header_dropdown_button/component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import CompassIcon from '../../components/icons/compassIcon'; | ||
|
||
interface Props { | ||
show: boolean, | ||
inCall: boolean, | ||
hasCall: boolean, | ||
} | ||
|
||
const ChannelHeaderDropdownButton = (props: Props) => { | ||
if (!props.show) { | ||
return null; | ||
} | ||
return ( | ||
<button | ||
id='calls-join-button' | ||
className={'style--none call-button-dropdown ' + (props.inCall ? 'disabled' : '')} | ||
disabled={Boolean(props.inCall)} | ||
> | ||
<CompassIcon icon='phone-outline'/> | ||
<div> | ||
<span > | ||
{props.hasCall ? 'Join Call' : 'Start Call'} | ||
</span> | ||
<span | ||
className='call-button-dropdown-sublabel' | ||
> | ||
{'In this channel'} | ||
</span> | ||
</div> | ||
</button> | ||
); | ||
}; | ||
|
||
export default ChannelHeaderDropdownButton; |
16 changes: 16 additions & 0 deletions
16
webapp/src/components/channel_header_dropdown_button/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {connect} from 'react-redux'; | ||
import {GlobalState} from 'mattermost-redux/types/store'; | ||
|
||
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; | ||
|
||
import {voiceConnectedUsers, connectedChannelID, isVoiceEnabled} from '../../selectors'; | ||
|
||
import ChannelHeaderDropdownButton from './component'; | ||
|
||
const mapStateToProps = (state: GlobalState) => ({ | ||
hasCall: voiceConnectedUsers(state).length > 0, | ||
inCall: connectedChannelID(state) && connectedChannelID(state) === getCurrentChannelId(state), | ||
show: isVoiceEnabled(state), | ||
}); | ||
|
||
export default connect(mapStateToProps)(ChannelHeaderDropdownButton); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters