You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Manage some more call states
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -32,6 +32,12 @@ interface IState {
|
||||
callState: CallState;
|
||||
}
|
||||
|
||||
const TEXTUAL_STATES = new Map([
|
||||
[CallState.Connected, _t("Connected")],
|
||||
[CallState.Connecting, _t("Connecting")],
|
||||
[CallState.Ended, _t("This call has ended")],
|
||||
]);
|
||||
|
||||
export default class CallEvent extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props);
|
||||
@@ -49,7 +55,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
|
||||
this.props.callEventGrouper.removeListener(CallEventGrouperEvent.StateChanged, this.onStateChanged);
|
||||
}
|
||||
|
||||
private onStateChanged = (newState: CallEventGrouperState) => {
|
||||
private onStateChanged = (newState: CallState) => {
|
||||
this.setState({callState: newState});
|
||||
}
|
||||
|
||||
@@ -57,8 +63,9 @@ export default class CallEvent extends React.Component<IProps, IState> {
|
||||
const event = this.props.mxEvent;
|
||||
const sender = event.sender ? event.sender.name : event.getSender();
|
||||
|
||||
const state = this.state.callState;
|
||||
let content;
|
||||
if (this.state.callState === CallState.Ringing) {
|
||||
if (state === CallState.Ringing) {
|
||||
content = (
|
||||
<div className="mx_CallEvent_content">
|
||||
<FormButton
|
||||
@@ -76,6 +83,18 @@ export default class CallEvent extends React.Component<IProps, IState> {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
} else if (Array.from(TEXTUAL_STATES.keys()).includes(state)) {
|
||||
content = (
|
||||
<div className="mx_CallEvent_content">
|
||||
{ TEXTUAL_STATES.get(state) }
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
content = (
|
||||
<div className="mx_CallEvent_content">
|
||||
{ _t("The call is in an unknown state!") }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user