Web:Client:GlobalEvents: rename onCreate to isCreateDialog

This commit is contained in:
Timofey Boyko 2023-01-13 13:48:16 +03:00
parent e18d067ad0
commit 9b3666ca47
2 changed files with 9 additions and 9 deletions

View File

@ -271,7 +271,7 @@ const CreateEvent = ({
onSave={onSave} onSave={onSave}
onCancel={onCancel} onCancel={onCancel}
onClose={onCloseAction} onClose={onCloseAction}
onCreate={true} isCreateDialog={true}
/> />
); );
}; };

View File

@ -21,7 +21,7 @@ const Dialog = ({
onSave, onSave,
onCancel, onCancel,
onClose, onClose,
onCreate, isCreateDialog,
isChecked, isChecked,
setIsChecked, setIsChecked,
}) => { }) => {
@ -30,8 +30,8 @@ const Dialog = ({
const [checked, setChecked] = useState(false); const [checked, setChecked] = useState(false);
useEffect(() => { useEffect(() => {
isChecked && onCreate && setChecked(isChecked); isChecked && isCreateDialog && setChecked(isChecked);
}, [onCreate, isChecked]); }, [isCreateDialog, isChecked]);
useEffect(() => { useEffect(() => {
let input = document?.getElementById("create-text-input"); let input = document?.getElementById("create-text-input");
@ -77,10 +77,10 @@ const Dialog = ({
const onSaveAction = useCallback( const onSaveAction = useCallback(
(e) => { (e) => {
setIsDisabled(true); setIsDisabled(true);
onCreate && setIsChecked(checked); isCreateDialog && setIsChecked(checked);
onSave && onSave(e, value); onSave && onSave(e, value);
}, },
[onSave, onCreate, value, checked] [onSave, isCreateDialog, value, checked]
); );
const onCancelAction = useCallback((e) => { const onCancelAction = useCallback((e) => {
@ -99,7 +99,7 @@ const Dialog = ({
); );
const onChangeCheckbox = () => { const onChangeCheckbox = () => {
onCreate && setChecked((val) => !val); isCreateDialog && setChecked((val) => !val);
}; };
return ( return (
@ -123,7 +123,7 @@ const Dialog = ({
onFocus={onFocus} onFocus={onFocus}
isDisabled={isDisabled} isDisabled={isDisabled}
/> />
{onCreate && ( {isCreateDialog && (
<Box displayProp="flex" alignItems="center" paddingProp="16px 0 0"> <Box displayProp="flex" alignItems="center" paddingProp="16px 0 0">
<Checkbox <Checkbox
label={t("Common:DontAskAgain")} label={t("Common:DontAskAgain")}
@ -145,7 +145,7 @@ const Dialog = ({
<ModalDialog.Footer> <ModalDialog.Footer>
<Button <Button
key="GlobalSendBtn" key="GlobalSendBtn"
label={onCreate ? t("Common:Create") : t("Common:Save")} label={isCreateDialog ? t("Common:Create") : t("Common:Save")}
size="normal" size="normal"
scale scale
primary primary