ref: Creating popups with hook, fix translation keys passing

This commit is contained in:
Maksim Eltyshev
2023-01-24 18:53:13 +01:00
parent 0f50dbde92
commit 8a46a2e0b9
69 changed files with 309 additions and 332 deletions
@@ -2,13 +2,12 @@ import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Menu } from 'semantic-ui-react';
import { withPopup } from '../../../lib/popup';
import { Popup } from '../../../lib/custom-ui';
import { useSteps } from '../../../hooks';
import DeleteStep from '../../DeleteStep';
import styles from './ActionsPopup.module.scss';
import styles from './ActionsStep.module.scss';
const StepTypes = {
DELETE: 'DELETE',
@@ -30,11 +29,9 @@ const ActionsStep = React.memo(({ onNameEdit, onDelete, onClose }) => {
if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
title={t('common.deleteTask', {
context: 'title',
})}
content={t('common.areYouSureYouWantToDeleteThisTask')}
buttonContent={t('action.deleteTask')}
title="common.deleteTask"
content="common.areYouSureYouWantToDeleteThisTask"
buttonContent="action.deleteTask"
onConfirm={onDelete}
onBack={handleBack}
/>
@@ -72,4 +69,4 @@ ActionsStep.propTypes = {
onClose: PropTypes.func.isRequired,
};
export default withPopup(ActionsStep);
export default ActionsStep;
@@ -4,9 +4,10 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Draggable } from 'react-beautiful-dnd';
import { Button, Checkbox, Icon } from 'semantic-ui-react';
import { usePopup } from '../../../lib/popup';
import NameEdit from './NameEdit';
import ActionsPopup from './ActionsPopup';
import ActionsStep from './ActionsStep';
import styles from './Item.module.scss';
@@ -39,6 +40,8 @@ const Item = React.memo(
nameEdit.current.open();
}, []);
const ActionsPopup = usePopup(ActionsStep);
return (
<Draggable draggableId={id} index={index} isDragDisabled={!isPersisted || !canEdit}>
{({ innerRef, draggableProps, dragHandleProps }, { isDragging }) => {