import { Button, Input, Switch, Typography } from 'antd'; import React from 'react'; import { UxTask } from 'App/services/UxtestingService'; import { useTranslation } from 'react-i18next'; function StepsModal({ onAdd, onHide, editTask, typingEnabled, }: { onAdd: (step: UxTask) => void; onHide: () => void; editTask?: UxTask; typingEnabled?: boolean; }) { const { t } = useTranslation(); const [title, setTitle] = React.useState(editTask?.title ?? ''); const [description, setDescription] = React.useState( editTask?.description ?? '', ); const [isAnswerEnabled, setIsAnswerEnabled] = React.useState( editTask?.allowTyping ?? typingEnabled, ); const save = () => { onAdd({ title, description: description || '', allowTyping: Boolean(isAnswerEnabled), }); onHide(); }; return (
{t('Add a task or question')}
{t('Title/Question')} setTitle(e.target.value)} placeholder={t('Task title')} />
{t('Example:')}
  • {t('Task: Finding a specific product on shopping.com')}
  • {t('Question: Find a specific product on shopping.com?')}
{t('Instructions')} setDescription(e.target.value)} placeholder={t('Task instructions')} />
{t('Example:')}
  1. {t('Search for "Sustainable T-shirt".')}
  2. {t('Pick a product from the results.')}
  3. {t('Note/Callout the ease of finding it.')}
{t('Allow participants to type an answer')} setIsAnswerEnabled(checked)} checkedChildren="Yes" unCheckedChildren="No" />
{t( 'Enabling this option will show a text field for participants to type their answer.', )}
); } export default StepsModal;