Skip to content

Commit

Permalink
feat: support to set dark icon for customized tab (#932)
Browse files Browse the repository at this point in the history
* feat: support to set dark icon for customized tab

* chore: add docs
  • Loading branch information
embbnux authored Dec 13, 2024
1 parent d8119f5 commit c8b9caa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/integration/custom-tab.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ document.querySelector("#rc-widget-adapter-frame").contentWindow.postMessage({
id: 'tabID', // tab id, required
title: 'CRM',
type: 'tab', // tab type
iconUri: 'https://xxx/icon.png', // icon for tab, 24x24
activeIconUri: 'https://xxx/icon-active.png', // icon for tab in active status, 24x24
iconUri: 'https://xxx/icon.png', // icon for tab, 24x24, recommended color: #16181D
activeIconUri: 'https://xxx/icon-active.png', // icon for tab in active status, 24x24, recommended color: ##2559E4
darkIconUri: 'https://xxx/icon-dark.png', // Supported from v2.2.1, icon for tab in dark mode, 24x24, recommended color: #ffffff
hidden: false, // optional, default false, whether to hide the tab icon from navigation bar
unreadCount: 0, // optional, unread count, 0-99
priority: 31, // tab priority, 0-100, 0 is the highest priority, Phone tab: 10, Text: 20, Fax: 30, Glip: 40, Contacts: 50, Video: 60, Settings: 70
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ringcentral-embeddable",
"version": "2.2.0",
"version": "2.2.1",
"description": "A RingCentral Embeddable Widget Application",
"main": "index.js",
"license": "MIT",
Expand Down
7 changes: 6 additions & 1 deletion src/components/MainViewPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const MainViewPanel = (props) => {
smsUnreadCounts,
voiceUnreadCounts,
customizedTabs = [],
themeType,
} = props;
const tabList: Tab[] = [];
if (showPhone) {
Expand Down Expand Up @@ -212,6 +213,10 @@ export const MainViewPanel = (props) => {
if (customTab.hidden) {
return;
}
let iconUri = customTab.iconUri;
if (themeType === 'dark' && customTab.darkIconUri) {
iconUri = customTab.darkIconUri;
}
tabList.push({
label: customTab.label,
path: customTab.path,
Expand All @@ -220,7 +225,7 @@ export const MainViewPanel = (props) => {
showHeader: () => true,
showHeaderBorder: true,
priority: customTab.priority,
iconUri: customTab.iconUri,
iconUri,
activeIconUri: customTab.activeIconUri,
});
});
Expand Down
3 changes: 3 additions & 0 deletions src/modules/MainViewUI/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { RcUIModuleV2 } from '@ringcentral-integration/core';
'ThirdPartyService',
'Brand',
'PhoneTabsUI',
'Theme',
],
})
export class MainViewUI extends RcUIModuleV2 {
Expand All @@ -33,6 +34,7 @@ export class MainViewUI extends RcUIModuleV2 {
brand,
thirdPartyService,
phoneTabsUI,
theme,
} = this._deps;

const showPhone = appFeatures.ready && (
Expand Down Expand Up @@ -68,6 +70,7 @@ export class MainViewUI extends RcUIModuleV2 {
faxUnreadCounts: messageStore.faxUnreadCounts || 0,
voiceUnreadCounts: messageStore.voiceUnreadCounts || 0,
customizedTabs: thirdPartyService.customizedTabs,
themeType: theme.themeType,
};
}

Expand Down
1 change: 1 addition & 0 deletions src/modules/ThirdPartyService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ export default class ThirdPartyService extends RcModuleV2 {
label: tab.title,
iconUri: tab.iconUri,
activeIconUri: tab.activeIconUri,
darkIconUri: tab.darkIconUri,
priority: tab.priority,
unreadCount: tab.unreadCount,
path: `/customizedTabs/${tab.id}`,
Expand Down

0 comments on commit c8b9caa

Please sign in to comment.