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 = ; } return ( @@ -146,43 +134,41 @@ class CallView extends React.Component { -
-
-
- -
-
-
{this.state.fullName}
-
-
- -
-
- {this.props.callState >= 1 && this.props.callState < 3 ? - - : - null - } - {this.props.callState >= 2 && this.props.callState < 3 ? - - : - null - } -
+ + : + null + }
+ ); } }; -export default injectIntl(CallView); +export default injectIntl(IncomingCallView); diff --git a/src/views/info-view.jsx b/src/views/info-view.jsx index f29287ff..555a0975 100644 --- a/src/views/info-view.jsx +++ b/src/views/info-view.jsx @@ -18,7 +18,7 @@ import TopicSecurity from '../widgets/topic-security.jsx'; import { MAX_TITLE_LENGTH, MAX_TOPIC_DESCRIPTION_LENGTH, NO_ACCESS_MODE } from '../config.js'; import { makeImageUrl } from '../lib/blob-helpers.js'; -import { theCard } from '../lib/utils.js'; +import { theCard, clipStr } from '../lib/utils.js'; const messages = defineMessages({ info: { @@ -78,10 +78,6 @@ const messages = defineMessages({ }, }); -function _clip(str, length) { - return str && str.substring(0, length); -} - class InfoView extends React.Component { constructor(props) { super(props); @@ -206,11 +202,11 @@ class InfoView extends React.Component { deleter: acs && acs.isDeleter(), muted: acs && acs.isMuted(), - fullName: _clip(topic.public ? topic.public.fn : undefined, MAX_TITLE_LENGTH), - description: _clip(topic.public ? topic.public.note : undefined, MAX_TOPIC_DESCRIPTION_LENGTH), + fullName: clipStr(topic.public ? topic.public.fn : undefined, MAX_TITLE_LENGTH), + description: clipStr(topic.public ? topic.public.note : undefined, MAX_TOPIC_DESCRIPTION_LENGTH), avatar: makeImageUrl(topic.public ? topic.public.photo : null), trustedBadges: badges, - private: _clip(topic.private ? topic.private.comment : null, MAX_TITLE_LENGTH), + private: clipStr(topic.private ? topic.private.comment : null, MAX_TITLE_LENGTH), archived: topic.isArchived(), address: topic.name, groupTopic: topic.isGroupType(), diff --git a/src/views/messages-view.jsx b/src/views/messages-view.jsx index cc80c0bd..b5161c1e 100644 --- a/src/views/messages-view.jsx +++ b/src/views/messages-view.jsx @@ -14,7 +14,7 @@ import Invitation from '../widgets/invitation.jsx'; import LetterTile from '../widgets/letter-tile.jsx'; import LoadSpinner from '../widgets/load-spinner.jsx'; import LogoView from './logo-view.jsx'; -import RtcPanel from '../widgets/rtc-panel.jsx'; +import CallPanel from '../widgets/call-panel.jsx'; import SendMessage from '../widgets/send-message.jsx'; import { DEFAULT_P2P_ACCESS_MODE, IMAGE_PREVIEW_DIM, KEYPRESS_DELAY, @@ -984,7 +984,7 @@ class MessagesView extends React.Component { } else if (this.state.rtcPanel) { const topic = this.props.tinode.getTopic(this.state.topic); component2 = ( - {remoteActive ? -
{this.props.title}
+
{clipStr(this.props.title, MAX_TITLE_LENGTH)}
: null}
-