import { validatePasswordSettings } from '@ringcentral-integration/commons/modules/RcVideo'; import { RcButton, RcDialogActions, RcTextField, spacing, styled, } from '@ringcentral/juno'; import React, { useState, useEffect } from 'react'; import { t } from './i18n'; import styles from './styles.scss'; import { getHelperTextForPasswordField } from './utils'; export interface ChangePasswordPopupProps { currentLocale: string; meetingPassword?: string; handleCancel: () => void; handleUpdate: (password: string) => void; } const StyledDialogActions = styled(RcDialogActions)` padding: ${spacing(5, 0, 6)} !important; `; export const ChangePasswordPopup: React.FC = ({ currentLocale, meetingPassword = '', handleCancel, handleUpdate, }) => { const [password, setPassword] = useState(meetingPassword); const [isError, setError] = useState(false); useEffect(() => { setPassword(meetingPassword); }, [meetingPassword]); useEffect(() => { setError(!validatePasswordSettings(password, true)); }, [password]); return (
{ setPassword(e.target.value); }} /> {t('cancel')} handleUpdate(password)} > {t('update')}
); };