import { RcButton, RcFormControlLabel, RcLink, RcSwitch, RcTypography, spacing, styled, } from '@ringcentral/juno'; import React, { FunctionComponent, useEffect, useRef } from 'react'; import { PageHeader, PageHeaderBack, PageHeaderRemain, PageHeaderTitle, } from '../BackHeader/PageHeader'; import { Tooltip } from '../Rcui/Tooltip'; import { IssuesTrackingCloseConfirmPanel, IssuesTrackingCloseConfirmPanelProps, } from './IssuesTrackingConfirmPanel'; import i18n from './i18n'; type IssuesTrackingPanelProps = { currentLocale: string; downloading: boolean; enabled: boolean; goBack: () => void; toggleEnable: (checked: boolean) => void; downloadLog: () => Promise; ConfirmPanelProps: IssuesTrackingCloseConfirmPanelProps; }; const _IssuesTrackingPanel: FunctionComponent = ({ currentLocale, downloading, enabled, goBack, toggleEnable, downloadLog, ConfirmPanelProps, ...rest }) => { const initEnabledRef = useRef(enabled); const downloadDisabled = !initEnabledRef.current || !enabled || downloading; useEffect(() => { // the behavior is make user need enter page again to enable // so when become not enable, set the first time enable to false if (!enabled) { initEnabledRef.current = false; } }, [enabled]); return ( <> goBack()} /> {i18n.getString('header', currentLocale)}
toggleEnable(checked)} label={ {i18n.getString('toggleTitle', currentLocale)} } /> {i18n.getString('toggleDescription', currentLocale)}
{i18n.getString('downloadTitle', currentLocale)}
{i18n.getString( downloading ? 'downloading' : 'downloadButton', currentLocale, )}
{i18n.getString('sendTitle', currentLocale)} {i18n.getString('createSupportTicket', currentLocale)} {i18n.getString('sendDescription', currentLocale)} {i18n.getString('privacyNotice', currentLocale)} {i18n.getString('privacyNoticeLink', currentLocale)} {i18n.getString('and', currentLocale)} {i18n.getString('privacyNoticeEnd', currentLocale)}
); }; export const IssuesTrackingPanel = styled(_IssuesTrackingPanel)` padding: ${spacing(4, 5)}; display: flex; flex-direction: column; gap: ${spacing(6)}; overflow: auto; ${RcFormControlLabel} { margin: ${spacing(-3, 0, -1, 0)}; width: 100%; justify-content: space-between; ${RcSwitch} { margin-right: 0; } } `;