Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/app/pages/Components/IncomingCallPad/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import IncomingCallPad from 'ringcentral-widget/components/IncomingCallPad';
const props = {};
props.answer = () => null;
props.reject = () => null;
props.replyWithMessage = () => null;
props.toVoiceMail = () => null;
props.currentLocale = 'en-US';
props.forwardingNumbers = [{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"redux-thunk": "^2.1.0",
"ringcentral": "^3.1.1",
"ringcentral-client": "^1.0.0-rc1",
"ringcentral-integration": "^0.7.0-rc5",
"ringcentral-integration": "^0.7.0-rc10",
"sass-loader": "^6.0.5",
"source-map-loader": "^0.2.1",
"style-loader": "^0.18.2",
Expand Down
53 changes: 47 additions & 6 deletions src/components/IncomingCallPad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Tooltip from 'rc-tooltip';
import 'rc-tooltip/assets/bootstrap_white.css';

import ForwardForm from '../ForwardForm';
import ReplyWithMessage from '../ReplyWithMessage';
import ActiveCallButton from '../ActiveCallButton';
import MessageIcon from '../../assets/images/MessageFill.svg';
import ForwardIcon from '../../assets/images/Forward.svg';
Expand All @@ -19,6 +20,9 @@ export default class IncomingCallPad extends Component {
super(props);
this.state = {
showForward: false,
forwardNumber: '',
replyMessage: null,
showReplyWithMessage: false,
};
this.onShowForwardChange = (visible) => {
this.setState({
Expand All @@ -32,6 +36,17 @@ export default class IncomingCallPad extends Component {
this.closeForwardForm = () => {
this.onShowForwardChange(false);
};
this.onShowReplyWithMessageChange = (visible) => {
this.setState({
showReplyWithMessage: visible,
});
};
this.onReplyMessageChange = (message) => {
this.setState({ replyMessage: message });
};
this.closeReplyWithMessage = () => {
this.onShowReplyWithMessageChange(false);
};
}

render() {
Expand All @@ -51,6 +66,12 @@ export default class IncomingCallPad extends Component {
this.forwardContainner = containner;
}}
/>
<div
className={styles.replyWithMessageContainner}
ref={(containner) => {
this.replyWithMessageContainner = containner;
}}
/>
<div className={styles.buttonRow}>
<Tooltip
defaultVisible={false}
Expand Down Expand Up @@ -79,12 +100,31 @@ export default class IncomingCallPad extends Component {
className={styles.callButton}
/>
</Tooltip>
<ActiveCallButton
onClick={() => console.log('test')}
icon={MessageIcon}
title={i18n.getString('reply', currentLocale)}
className={styles.callButton}
/>
<Tooltip
defaultVisible={false}
visible={this.state.showReplyWithMessage}
onVisibleChange={this.onShowReplyWithMessageChange}
placement="top"
trigger="click"
arrowContent={<div className="rc-tooltip-arrow-inner" />}
getTooltipContainer={() => this.replyWithMessageContainner}
overlay={
<ReplyWithMessage
currentLocale={currentLocale}
onCancel={this.closeReplyWithMessage}
value={this.state.replyMessage}
onChange={this.onReplyMessageChange}
onReply={this.props.replyWithMessage}
/>
}
>
<ActiveCallButton
onClick={() => null}
icon={MessageIcon}
title={i18n.getString('reply', currentLocale)}
className={styles.callButton}
/>
</Tooltip>
<ActiveCallButton
onClick={reject}
icon={IgnoreIcon}
Expand Down Expand Up @@ -123,6 +163,7 @@ IncomingCallPad.propTypes = {
forwardingNumbers: PropTypes.array.isRequired,
formatPhone: PropTypes.func,
onForward: PropTypes.func.isRequired,
replyWithMessage: PropTypes.func.isRequired,
};

IncomingCallPad.defaultProps = {
Expand Down
23 changes: 23 additions & 0 deletions src/components/IncomingCallPad/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,26 @@
}
}
}

.replyWithMessageContainner {
display: block;
width: 60%;
height: 1px;
:global .rc-tooltip {
z-index: 9;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.15);
border: solid 1px #e3e3e3;
border-radius: 0;
opacity: 1;
width: 79%;
min-width: 192px;
background: #fff;
}
:global .rc-tooltip-inner {
padding: 0;
border: none;
}
:global .rc-tooltip-arrow {
border-top-color: #e3e3e3;
}
}
11 changes: 11 additions & 0 deletions src/components/ReplyWithMessage/i18n/en-US.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
cancel: 'Cancel',
send: 'Send',
onMyWay: 'On my way',
customMessage: 'Custom Message',
callMeBackIn: 'Call me back in',
willCallYouBackIn: 'Will call you back in',
min: 'min.',
hours: 'hours',
days: 'days',
};
4 changes: 4 additions & 0 deletions src/components/ReplyWithMessage/i18n/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import I18n from 'ringcentral-integration/lib/I18n';
import loadLocale from './loadLocale';

export default new I18n(loadLocale);
1 change: 1 addition & 0 deletions src/components/ReplyWithMessage/i18n/loadLocale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* loadLocale */
Loading