From 5620eac2c2e2dec9e06568504538ac11c8c8280f Mon Sep 17 00:00:00 2001 From: Embbnux Ji Date: Fri, 13 Dec 2024 15:38:22 +0800 Subject: [PATCH] feat: support to hide Edit log button --- src/components/CallItem/index.tsx | 8 +++++++- src/components/CallListV2/index.tsx | 3 +++ src/components/CallsListPanel/index.tsx | 2 ++ src/modules/CallLogger/index.ts | 4 ++++ src/modules/CallsListUI/index.ts | 1 + src/modules/ThirdPartyService/index.ts | 7 +++++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/CallItem/index.tsx b/src/components/CallItem/index.tsx index bd856e36..23a6a603 100644 --- a/src/components/CallItem/index.tsx +++ b/src/components/CallItem/index.tsx @@ -106,6 +106,7 @@ type CallItemProps = { onViewSmartNote?: (...args: any[]) => any; aiNoted: boolean; showLogButton?: boolean; + hideEditLogButton?: boolean; logButtonTitle?: string; }; @@ -165,6 +166,7 @@ export const CallItem: FunctionComponent = ({ externalViewEntity: externalViewEntityProp, externalHasEntity, showLogButton, + hideEditLogButton, logButtonTitle, isRecording = false, onViewSmartNote, @@ -412,7 +414,11 @@ export const CallItem: FunctionComponent = ({ const statusMatch = activityMatches.find( (activity) => activity.type === 'status', ); - if (showLogButton && !isFax) { + if ( + showLogButton && + !isFax && + (!isLogged || !hideEditLogButton) + ) { actions.push({ id: 'log', icon: isLogged ? Edit : NewAction, diff --git a/src/components/CallListV2/index.tsx b/src/components/CallListV2/index.tsx index 86212dbc..af6b28eb 100644 --- a/src/components/CallListV2/index.tsx +++ b/src/components/CallListV2/index.tsx @@ -55,6 +55,7 @@ type CallListV2Props = { maxExtensionNumberLength: number; formatPhone: (phoneNumber: string) => string | undefined; showLogButton: boolean; + hideEditLogButton: boolean; logButtonTitle: string; isRecording?: boolean; onViewSmartNote?: (...args: any[]) => any; @@ -141,6 +142,7 @@ export function CallListV2({ maxExtensionNumberLength, formatPhone, showLogButton, + hideEditLogButton, logButtonTitle, isRecording, onViewSmartNote, @@ -224,6 +226,7 @@ export function CallListV2({ enableCDC={enableCDC} maxExtensionNumberLength={maxExtensionNumberLength} showLogButton={showLogButton} + hideEditLogButton={hideEditLogButton} logButtonTitle={logButtonTitle} isRecording={isRecording} onViewSmartNote={onViewSmartNote} diff --git a/src/components/CallsListPanel/index.tsx b/src/components/CallsListPanel/index.tsx index 26edf12e..5cff5d61 100644 --- a/src/components/CallsListPanel/index.tsx +++ b/src/components/CallsListPanel/index.tsx @@ -91,6 +91,7 @@ export function CallsListPanel({ maxExtensionLength, showLogButton = false, logButtonTitle = '', + hideEditLogButton = false, showMergeCall, showCallDetail, onMergeCall, @@ -238,6 +239,7 @@ export function CallsListPanel({ enableCDC={enableCDC} showLogButton={showLogButton} logButtonTitle={logButtonTitle} + hideEditLogButton={hideEditLogButton} formatPhone={formatPhone} isRecording={type === 'recordings'} onViewSmartNote={onViewSmartNote} diff --git a/src/modules/CallLogger/index.ts b/src/modules/CallLogger/index.ts index b786f80d..989a818b 100644 --- a/src/modules/CallLogger/index.ts +++ b/src/modules/CallLogger/index.ts @@ -123,4 +123,8 @@ export class CallLogger extends CallLoggerBase { get autoLogOnCallSync() { return this._deps.thirdPartyService.callLoggerAutoLogOnCallSync; } + + get hideEditLogButton() { + return this._deps.thirdPartyService.callLoggerHideEditLogButton; + } } diff --git a/src/modules/CallsListUI/index.ts b/src/modules/CallsListUI/index.ts index 649dd977..b364b56d 100644 --- a/src/modules/CallsListUI/index.ts +++ b/src/modules/CallsListUI/index.ts @@ -147,6 +147,7 @@ export class CallsListUI extends BaseCallsListUI { (!composeText || composeText.ready) ), showLogButton: callLogger.ready, + hideEditLogButton: callLogger.hideEditLogButton, logButtonTitle: callLogger.logButtonTitle, showRingoutCallControl, showTransferCall, diff --git a/src/modules/ThirdPartyService/index.ts b/src/modules/ThirdPartyService/index.ts index 1cef4361..f151b45b 100644 --- a/src/modules/ThirdPartyService/index.ts +++ b/src/modules/ThirdPartyService/index.ts @@ -422,6 +422,7 @@ export default class ThirdPartyService extends RcModuleV2 { callLoggerAutoSettingReadOnlyReason: service.callLoggerAutoSettingReadOnlyReason, callLoggerAutoSettingReadOnlyValue: service.callLoggerAutoSettingReadOnlyValue, callLoggerAutoLogOnCallSync: service.callLoggerAutoLogOnCallSync, // auto log for calls happened when the app is not opened + callLoggerHideEditLogButton: service.callLoggerHideEditLogButton, }); } @@ -1142,6 +1143,10 @@ export default class ThirdPartyService extends RcModuleV2 { @state callLoggerAutoLogOnCallSync = false; + @globalStorage + @state + callLoggerHideEditLogButton = false; + @action _onRegisterCallLogger({ callLoggerTitle, @@ -1151,6 +1156,7 @@ export default class ThirdPartyService extends RcModuleV2 { callLoggerAutoSettingReadOnlyReason, callLoggerAutoSettingReadOnlyValue, callLoggerAutoLogOnCallSync, + callLoggerHideEditLogButton = false, }) { if (callLoggerTitle) { this.callLoggerTitle = callLoggerTitle; @@ -1166,6 +1172,7 @@ export default class ThirdPartyService extends RcModuleV2 { } this.callLoggerRegistered = true; this.callLoggerAutoLogOnCallSync = !!callLoggerAutoLogOnCallSync; + this.callLoggerHideEditLogButton = !!callLoggerHideEditLogButton; } @globalStorage