/*! * Copyright (c) 2024 PLANKA Software GmbH * Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md */ import React, { useCallback, useEffect } from 'react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; import { Button, Form, Input } from 'semantic-ui-react'; import { Popup } from '../../../lib/custom-ui'; import { useForm, useNestedRef } from '../../../hooks'; import styles from './ConfirmationStep.module.scss'; const ButtonTypes = { POSITIVE: 'positive', NEGATIVE: 'negative', }; const ConfirmationStep = React.memo( ({ title, content, buttonType, buttonContent, typeValue, typeContent, onConfirm, onBack }) => { const [t] = useTranslation(); const [data, handleFieldChange] = useForm({ typeValue: '', }); const [nameFieldRef, handleNameFieldRef] = useNestedRef('inputRef'); const handleSubmit = useCallback(() => { if (typeValue) { const cleanData = { ...data, typeValue: data.typeValue.trim(), }; if (cleanData.typeValue.toLowerCase() !== typeValue.toLowerCase()) { nameFieldRef.current.select(); return; } } onConfirm(); }, [typeValue, onConfirm, data, nameFieldRef]); useEffect(() => { if (typeValue) { nameFieldRef.current.select(); } }, [typeValue, nameFieldRef]); return ( <> {t(title, { context: 'title', })}
{t(content)}
{typeContent &&
{t(typeContent)}
}
{typeValue && ( )}