import { RcButton, RcCircularProgress, RcIcon } from '@ringcentral/juno'; import { Check } from '@ringcentral/juno-icon'; import clsx from 'clsx'; import React from 'react'; import { CountdownTimer } from '../CountdownTimer'; import { getButtonStatus } from './getButtonStatus'; import i18n from './i18n'; import styles from './styles.scss'; type SaveLogButtonProps = { currentLog?: object; currentLocale: string; onSaveCallLog?: (...args: any[]) => any; loading?: boolean; isWide?: boolean; disabled?: boolean; currentDelaySavingState?: { delayUpdatingStartTime: number; delayUpdatingMinutes: number; }; }; const SaveLogButton: React.FC = ({ onSaveCallLog, currentLocale, currentLog, loading, isWide, disabled, currentDelaySavingState, }) => { const { buttonDisabled, buttonContent } = getButtonStatus( // @ts-expect-error TS(2532): Object is possibly 'undefined'. currentLog.currentLogCall, ); const getContent = (buttonContent: any) => ( {buttonContent === 'saved' && ( )} {buttonContent === 'saving' && } {buttonContent === 'save' && i18n.getString('save', currentLocale)} ); const content = getContent(buttonContent); const SaveButton = ( onSaveCallLog(currentLog.call)} > {content} ); if (currentDelaySavingState) { return ( {SaveButton} ); } return SaveButton; }; SaveLogButton.defaultProps = { // @ts-expect-error TS(2322): Type 'null' is not assignable to type 'object | un... Remove this comment to see the full error message currentLog: null, // @ts-expect-error TS(2322): Type 'null' is not assignable to type 'string | un... Remove this comment to see the full error message currentLocale: null, onSaveCallLog() {}, loading: false, isWide: true, disabled: false, }; export default SaveLogButton;