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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function CallIcon({
isOnConferenceCall={isOnConferenceCall}
avatarUrl={avatarUrl}
extraNum={extraNum}
shouldBubbleClick
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export default class ActiveCallItem extends Component {
isOnConferenceCall={isOnConferenceCall}
avatarUrl={avatarUrl}
extraNum={extraNum}
shouldBubbleClick />
/>
</div>
}
bodyCls={styles.content}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import CallAvatar from '../CallAvatar';
export default function CallInfo(props) {
let avatar;
if (props.avatarUrl) {
avatar = (<CallAvatar avatarUrl={props.avatarUrl} shouldBubbleClick />);
avatar = (<CallAvatar avatarUrl={props.avatarUrl} />);
} else {
avatar = (<CallAvatar avatarUrl={null} shouldBubbleClick />);
avatar = (<CallAvatar avatarUrl={null} />);
}
return (
<div className={styles.userInfo}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function ConferenceInfo({
className={styles.avatar}>
<CallAvatar
avatarUrl={avatarUrl}
shouldBubbleClick
/>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class MergeInfo extends Component {
extraNum={isOnConferenceCall ? lastCallInfo.extraNum : 0}
isOnConferenceCall={isOnConferenceCall}
spinnerMode={showSpinner}
shouldBubbleClick
/>
</div>
{
Expand Down Expand Up @@ -151,8 +150,8 @@ class MergeInfo extends Component {
<div className={styles.callee_avatar_active} >
{
currentCallAvatarUrl
? <CallAvatar avatarUrl={currentCallAvatarUrl} shouldBubbleClick />
: <CallAvatar avatarUrl={null} shouldBubbleClick />
? <CallAvatar avatarUrl={currentCallAvatarUrl} />
: <CallAvatar avatarUrl={null} />
}
</div>
<div className={styles.callee_name_active}>
Expand Down
118 changes: 62 additions & 56 deletions packages/ringcentral-widgets/components/CallAvatar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class CallAvatar extends Component {

render() {
const {
extraNum, isOnConferenceCall, spinnerMode, shouldBubbleClick
extraNum, isOnConferenceCall, spinnerMode, className, onClick
} = this.props;
const { avatarUrl } = this.state;
const initialSize = 38;
Expand All @@ -104,7 +104,13 @@ class CallAvatar extends Component {
const clipId = `circleClip-${hash}`;
const avatarStyle = { stroke: $dark, strokeWidth: `${circleBorder}px` };
const showingSpinner = spinnerMode;

const aspectRatio = 'xMidYMid meet';
const xmlns = 'http://www.w3.org/2000/svg';
const svgCls = classnames(
styles.callAvatar,
onClick ? styles.autoPointerEvents : styles.disabledPointerEvents,
className
);
// spinner sizing
const spinnerId = `spinner-${hash}`;
const spinnerScaleSize = 1.5;
Expand All @@ -116,18 +122,15 @@ class CallAvatar extends Component {
spinnerScaleSize
}, ${spinnerScaleSize})`;

let res;

if (isOnConferenceCallWithExtraNum) {
res = (
return (
<svg
className={shouldBubbleClick ?
classnames(styles.callAvatar, styles.bubbleSvg) :
styles.callAvatar}
onClick={onClick ? () => onClick() : null}
className={svgCls}
style={avatarUrl ? avatarStyle : null}
viewBox={`0 0 ${initialSize} ${initialSize}`}
preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio={aspectRatio}
xmlns={xmlns}
>
<defs>
<g id={textId}>
Expand Down Expand Up @@ -212,63 +215,66 @@ class CallAvatar extends Component {
</text>
</svg>
);
} else {
res = (
<svg
className={styles.callAvatar}
style={avatarUrl ? avatarStyle : null}
viewBox={`0 0 ${initialSize} ${initialSize}`}
xmlns="http://www.w3.org/2000/svg">
<defs>
<g id={textId}>
<text
x="0"
y="0"
dy={`${initialSize - 10}px`}
dx="2"
style={{
}
return (
<svg
className={svgCls}
onClick={onClick ? () => onClick() : null}
style={avatarUrl ? avatarStyle : null}
viewBox={`0 0 ${initialSize} ${initialSize}`}
preserveAspectRatio={aspectRatio}
xmlns={xmlns}
>
<defs>
<g id={textId}>
<text
x="0"
y="0"
dy={`${initialSize - 10}px`}
dx="2"
style={{
fontSize: `${(initialSize / 2 - 2) * 2}px`,
fill: $blue,
opacity: '.5'
}}
className={styles.portrait}>
{'\ue904'}
</text>
</g>
<SpinnerIcon id={spinnerId} />
</defs>
<circle
cx={initialSize / 2}
cy={initialSize / 2}
r={initialSize / 2 - circleBorder}
fill={$snow}
stroke={showingSpinner ? $dark : 'inherit'}
strokeOpacity={showingSpinner ? $transparency : '1'}
className={styles.portrait}>
{'\ue904'}
</text>
</g>
<SpinnerIcon id={spinnerId} />
</defs>
<circle
cx={initialSize / 2}
cy={initialSize / 2}
r={initialSize / 2 - circleBorder}
fill={$snow}
stroke={showingSpinner ? $dark : 'inherit'}
strokeOpacity={showingSpinner ? $transparency : '1'}
/>
<g>
<clipPath id={clipId}>
<circle
cx={initialSize / 2}
cy={initialSize / 2}
r={initialSize / 2 - 1}
<g>
<clipPath id={clipId}>
<circle
cx={initialSize / 2}
cy={initialSize / 2}
r={initialSize / 2 - 1}
/>
</clipPath>
</g>
{
</clipPath>
</g>
{
showingSpinner && (
<g transform={spinnerTransform} >
<use xlinkHref={`#${spinnerId}`} />
</g>
)
}
{
{
showingSpinner && (
<g transform={spinnerTransform} >
<use xlinkHref={`#${spinnerId}`} />
</g>
)
}
{
{
avatarUrl && (<image
clipPath={`url(#${clipId})`}
height="100%"
Expand All @@ -277,18 +283,16 @@ class CallAvatar extends Component {
preserveAspectRatio="xMinYMin slice" />
)
}
{
{
(!avatarUrl && !showingSpinner) &&
<use
xlinkHref={`#${textId}`}
clipPath={`url(#${clipId})`}
style={defaultAvatarStyle}
/>
}
</svg>
);
}
return res;
</svg>
);
}
}

Expand All @@ -301,15 +305,17 @@ CallAvatar.propTypes = {
* Set to true to make it always show the loading spinner.
*/
spinnerMode: PropTypes.bool,
shouldBubbleClick: PropTypes.bool
className: PropTypes.string,
onClick: PropTypes.func,
};

CallAvatar.defaultProps = {
isOnConferenceCall: false,
avatarUrl: null,
extraNum: 0,
spinnerMode: false,
shouldBubbleClick: false,
className: null,
onClick: null,
};


Expand Down
10 changes: 9 additions & 1 deletion packages/ringcentral-widgets/components/CallAvatar/styles.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
@import '../../lib/commonStyles/fonts';

.callAvatar {
width: 100%;

&:not(:root) {
overflow: visible;
}

text.portrait {
font-family: 'dynamics_icon' !important;
}
}
.bubbleSvg {

.disabledPointerEvents {
pointer-events: none;
}

.autoPointerEvents {
pointer-events: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function ParticipantItem({
containerCls={styles.participantItem}
mediaLeft={
<div className={styles.avatar}>
<CallAvatar isOnConferenceCall={false} avatarUrl={avatarUrl} shouldBubbleClick />
<CallAvatar isOnConferenceCall={false} avatarUrl={avatarUrl} />
</div>
}
mediaBody={detail}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function ConfirmMergeModal({
avatarUrl={avatarUrls[0]}
isOnConferenceCall
extraNum={avatarUrls.length - 1}
shouldBubbleClick />
/>
</div>
<span>{i18n.getString('conferenceCall', currentLocale)}</span>
</div>
Expand Down