diff --git a/css/base.css b/css/base.css
index 707145e8..ae98d51d 100644
--- a/css/base.css
+++ b/css/base.css
@@ -2633,7 +2633,12 @@ video {
padding: 20px;
}
-#video-call-hangup {
+.video-call-accept {
+ border-radius: 10px;
+ background-color: green;
+}
+
+.video-call-hangup {
border-radius: 10px;
background-color: red;
}
@@ -2642,3 +2647,17 @@ video {
border-radius: 10px;
background-color: gray;
}
+
+.incoming-call-title {
+ text-align: center;
+ padding: 10px;
+}
+
+.incoming-call-badges {
+ text-align: center;
+}
+
+.incoming-call-actions {
+ text-align: center;
+ padding: 20px;
+}
diff --git a/src/lib/utils.js b/src/lib/utils.js
index e18dd732..b3a79432 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -209,3 +209,8 @@ export function cancelablePromise(promise) {
export function isVideoCall(mime) {
return mime == 'application/tinode-video-call';
}
+
+// Clips string to the specified length.
+export function clipStr(str, length) {
+ return str && str.substring(0, length);
+}
diff --git a/src/views/call-view.jsx b/src/views/incoming-call-view.jsx
similarity index 61%
rename from src/views/call-view.jsx
rename to src/views/incoming-call-view.jsx
index 79d5ba84..277052e3 100644
--- a/src/views/call-view.jsx
+++ b/src/views/incoming-call-view.jsx
@@ -1,6 +1,6 @@
-// InfoView: panel with topic/user info.
+// IncomingCallView: displays Accept & Reject buttons for incoming calls.
import React from 'react';
-import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
+import { FormattedMessage, injectIntl } from 'react-intl';
import Tinode from 'tinode-sdk';
@@ -8,18 +8,14 @@ import AvatarUpload from '../widgets/avatar-upload.jsx';
import BadgeList from '../widgets/badge-list.jsx';
import MenuCancel from '../widgets/menu-cancel.jsx';
-import { MAX_TITLE_LENGTH, MAX_TOPIC_DESCRIPTION_LENGTH, NO_ACCESS_MODE } from '../config.js';
+import { CALL_STATE_INCOMING_RECEIVED, MAX_TITLE_LENGTH } from '../config.js';
import { makeImageUrl } from '../lib/blob-helpers.js';
-import { arrayEqual, theCard } from '../lib/utils.js';
-
-function _clip(str, length) {
- return str && str.substring(0, length);
-}
+import { clipStr } from '../lib/utils.js'
const RING_SOUND = new Audio("audio/phone_ring.mp3");
-class CallView extends React.Component {
+class IncomingCallView extends React.Component {
constructor(props) {
super(props);
@@ -29,7 +25,6 @@ class CallView extends React.Component {
avatar: null,
trustedBadges: [],
previousMetaDesc: undefined,
- offerSent: false,
};
this.resetDesc = this.resetDesc.bind(this);
@@ -45,7 +40,7 @@ class CallView extends React.Component {
return;
}
this.resetDesc(topic, this.props);
- if (this.props.callState == 2) {
+ if (this.props.callState == CALL_STATE_INCOMING_RECEIVED) {
RING_SOUND.play();
this.ringTimer = setInterval(() => RING_SOUND.play(), 2000);
this.props.onRinging(this.props.topic, this.props.seq);
@@ -96,7 +91,7 @@ class CallView extends React.Component {
}
this.setState({
- fullName: _clip(topic.public ? topic.public.fn : undefined, MAX_TITLE_LENGTH),
+ fullName: clipStr(topic.public ? topic.public.fn : undefined, MAX_TITLE_LENGTH),
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
trustedBadges: badges,
});
@@ -126,16 +121,9 @@ class CallView extends React.Component {
render() {
const {formatMessage} = this.props.intl;
let panelTitle = 'Unknown';
- switch (this.props.callState) {
- case 1:
- panelTitle = 'Calling';
- break;
- case 2:
- panelTitle = 'Incoming Call From';
- break;
- case 3:
- panelTitle = 'Call Established';
- break;
+ if (this.props.callState == CALL_STATE_INCOMING_RECEIVED) {
+ panelTitle =