Skip to content

Commit defea5f

Browse files
authored
feat: update incoming call ui (#881)
* feat: update incoming call ui * feat: hide forward/voicemail buttons for call queue * feat: show caller ID icon * feat: show caller id icon * misc: ignore for call queue call * misc: call id icon for call ctrl page
1 parent 7e68aa4 commit defea5f

File tree

12 files changed

+526
-235
lines changed

12 files changed

+526
-235
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@ringcentral-integration/utils": "^0.14.0",
8989
"@ringcentral-integration/widgets": "^0.14.0",
9090
"@ringcentral/juno": "^2.41.0",
91-
"@ringcentral/juno-icon": "^1.74.0",
91+
"@ringcentral/juno-icon": "^1.77.0",
9292
"@ringcentral/mfe-react": "^0.3.7",
9393
"@ringcentral/sdk": "^4.7.2",
9494
"@ringcentral/subscriptions": "^4.7.2",

src/components/CallCtrlPanel/ActiveCallPanel/CallInfo.tsx

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import {
66
RcListItemAvatar,
77
RcAvatar,
88
RcIcon,
9+
RcTooltip,
910
styled,
1011
} from '@ringcentral/juno';
11-
import { People } from '@ringcentral/juno-icon';
12+
import { People, IdBorder } from '@ringcentral/juno-icon';
1213
import ContactDisplay from '@ringcentral-integration/widgets/components/ContactDisplay';
1314

1415
const StyledItem = styled(RcListItem)`
@@ -27,7 +28,6 @@ const StyledItem = styled(RcListItem)`
2728
.ContactDisplay_root {
2829
vertical-align: bottom;
2930
font-family: Lato, Helvetica, Arial, sans-serif;
30-
flex: 1;
3131
overflow: hidden;
3232
3333
> div {
@@ -42,6 +42,10 @@ const StyledItem = styled(RcListItem)`
4242
margin-right: auto;
4343
`;
4444

45+
const StyledCallerIDIcon = styled(RcIcon)`
46+
margin-left: 5px;
47+
`;
48+
4549
type CallInfoProps = {
4650
phoneNumber?: string;
4751
formatPhone: (...args: any[]) => any;
@@ -59,6 +63,7 @@ type CallInfoProps = {
5963
phoneTypeRenderer?: (...args: any[]) => any;
6064
phoneSourceNameRenderer?: (...args: any[]) => any;
6165
callQueueName?: string;
66+
showCallerIdName: boolean;
6267
};
6368
const CallInfo: FunctionComponent<CallInfoProps> = ({
6469
nameMatches = [],
@@ -77,6 +82,7 @@ const CallInfo: FunctionComponent<CallInfoProps> = ({
7782
areaCode,
7883
countryCode,
7984
onSelectMatcherName,
85+
showCallerIdName,
8086
}) => {
8187
return (
8288
<StyledItem
@@ -103,27 +109,49 @@ const CallInfo: FunctionComponent<CallInfoProps> = ({
103109
<RcListItemText
104110
primary={
105111
<>
106-
{callQueueName}
107-
<ContactDisplay
108-
formatPhone={formatPhone}
109-
contactMatches={nameMatches}
110-
phoneNumber={phoneNumber}
111-
fallBackName={fallBackName}
112-
currentLocale={currentLocale}
113-
areaCode={areaCode}
114-
countryCode={countryCode}
115-
showType={false}
116-
selected={selectedMatcherIndex}
117-
onSelectContact={onSelectMatcherName}
118-
isLogging={false}
119-
enableContactFallback
120-
brand={brand}
121-
showPlaceholder={showContactDisplayPlaceholder}
122-
// @ts-expect-error TS(2322): Type 'object | undefined' is not assignable to typ... Remove this comment to see the full error message
123-
sourceIcons={sourceIcons}
124-
phoneTypeRenderer={phoneTypeRenderer}
125-
phoneSourceNameRenderer={phoneSourceNameRenderer}
126-
/>
112+
{
113+
callQueueName && !showCallerIdName && (
114+
<span data-sign="callQueueName">
115+
{callQueueName}
116+
</span>
117+
)
118+
}
119+
{
120+
showCallerIdName ? (
121+
<>
122+
<span data-sign="callerId" title={fallBackName}>
123+
{fallBackName}
124+
</span>
125+
<RcTooltip title="Caller ID">
126+
<StyledCallerIDIcon
127+
symbol={IdBorder}
128+
size="medium"
129+
/>
130+
</RcTooltip>
131+
</>
132+
) : (
133+
<ContactDisplay
134+
formatPhone={formatPhone}
135+
contactMatches={nameMatches}
136+
phoneNumber={phoneNumber}
137+
fallBackName={fallBackName}
138+
currentLocale={currentLocale}
139+
areaCode={areaCode}
140+
countryCode={countryCode}
141+
showType={false}
142+
selected={selectedMatcherIndex}
143+
onSelectContact={onSelectMatcherName}
144+
isLogging={false}
145+
enableContactFallback
146+
brand={brand}
147+
showPlaceholder={showContactDisplayPlaceholder}
148+
// @ts-expect-error TS(2322): Type 'object | undefined' is not assignable to typ... Remove this comment to see the full error message
149+
sourceIcons={sourceIcons}
150+
phoneTypeRenderer={phoneTypeRenderer}
151+
phoneSourceNameRenderer={phoneSourceNameRenderer}
152+
/>
153+
)
154+
}
127155
</>
128156
}
129157
primaryTypographyProps={{

src/components/CallCtrlPanel/ActiveCallPanel/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { styled, palette2, RcText } from '@ringcentral/juno';
44
import callCtrlLayouts from '@ringcentral-integration/widgets/enums/callCtrlLayouts';
55

66
import DurationCounter from '@ringcentral-integration/widgets/components/DurationCounter';
7+
import i18n from '@ringcentral-integration/widgets/components/CallCtrlContainer/i18n';
78

89
import { BackHeaderView } from '../../BackHeaderView';
910
import CallInfo from './CallInfo';
@@ -164,6 +165,11 @@ const ActiveCallPanel: React.SFC<ActiveCallPanelProps> = ({
164165
const currentCallTitle = nameMatches?.length
165166
? nameMatches[0].name
166167
: formatPhone(phoneNumber);
168+
const showCallerIdName =
169+
(!nameMatches || nameMatches.length === 0) &&
170+
fallBackName &&
171+
fallBackName.length > 0 &&
172+
phoneNumber !== 'anonymous';
167173
let callInfo;
168174
switch (layout) {
169175
case callCtrlLayouts.completeTransferCtrl:
@@ -174,7 +180,7 @@ const ActiveCallPanel: React.SFC<ActiveCallPanelProps> = ({
174180
timeCounter={timeCounter}
175181
lastCallInfo={lastCallInfo}
176182
currentCallAvatarUrl={avatarUrl}
177-
currentCallTitle={currentCallTitle || fallBackName}
183+
currentCallTitle={currentCallTitle || fallBackName || i18n.getString('unknown', currentLocale)}
178184
formatPhone={formatPhone}
179185
getAvatarUrl={getAvatarUrl}
180186
/>
@@ -194,11 +200,9 @@ const ActiveCallPanel: React.SFC<ActiveCallPanelProps> = ({
194200
<CallInfo
195201
currentLocale={currentLocale}
196202
nameMatches={nameMatches}
197-
fallBackName={fallBackName}
203+
fallBackName={fallBackName || i18n.getString('unknown', currentLocale)}
198204
phoneNumber={phoneNumber}
199205
formatPhone={formatPhone}
200-
// @ts-expect-error TS(2322): Type '{ currentLocale: string; nameMatches: { name... Remove this comment to see the full error message
201-
startTime={startTime}
202206
areaCode={areaCode}
203207
countryCode={countryCode}
204208
selectedMatcherIndex={selectedMatcherIndex}
@@ -210,6 +214,7 @@ const ActiveCallPanel: React.SFC<ActiveCallPanelProps> = ({
210214
phoneTypeRenderer={phoneTypeRenderer}
211215
phoneSourceNameRenderer={phoneSourceNameRenderer}
212216
callQueueName={callQueueName}
217+
showCallerIdName={showCallerIdName}
213218
/>
214219
);
215220
break;

0 commit comments

Comments
 (0)