import { useState, useCallback } from 'react'; import { useTranslation } from 'next-i18next'; import { Modal, ModalBody, } from 'reactstrap'; import { useSiteUrl, useGrowiVersion } from '~/stores/context'; type ModalProps = { isOpen: boolean, onClose: () => void, }; const QuestionnaireCompletionModal = (props: ModalProps): JSX.Element => { const { t } = useTranslation(); const { isOpen, onClose } = props; return ( {t('questionnaire.title')} {t('questionnaire.successfully_submit')} {t('questionnaire.thanks_for_answer')} {t('Close')} ); }; const ProactiveQuestionnaireModal = (props: ModalProps): JSX.Element => { const { t } = useTranslation(); const { isOpen, onClose } = props; const { data: siteUrl } = useSiteUrl(); const { data: growiVersion } = useGrowiVersion(); const [isQuestionnaireCompletionModal, setQuestionnaireCompletionModal] = useState(false); const submitHandler = useCallback(async(e) => { e.preventDefault(); const formData = e.target.elements; const { satisfaction: { value: satisfaction }, lengthOfExperience: { value: lengthOfExperience }, position: { value: position }, occupation: { value: occupation }, commentText: { value: commentText }, } = formData; const sendValues = { satisfaction: Number(satisfaction), lengthOfExperience, position, occupation, commentText, growiUri: siteUrl, growiVersion, }; // TODO: send questionnaire data onClose(); setQuestionnaireCompletionModal(true); }, [growiVersion, onClose, siteUrl]); return ( <> {t('questionnaire.title')} {t('questionnaire.more_satisfied_services')} {t('questionnaire.strive_to_improve_services')} {t('Required')}{t('questionnaire.satisfaction_with_growi')} ▼ {t('Select')} 1 2 3 4 5 {t('questionnaire.history_of_growi_use')} ▼ {t('Select')} {t('questionnaire.length_of_experience.more_than_two_years')} {t('questionnaire.length_of_experience.one_to_two_years')} {t('questionnaire.length_of_experience.six_months_to_one_year')} {t('questionnaire.length_of_experience.three_months_to_six_months')} {t('questionnaire.length_of_experience.one_month_to_three_months')} {t('questionnaire.length_of_experience.less_than_one_month')} {t('questionnaire.position')} {t('questionnaire.occupation')} {t('questionnaire.comment_on_growi')} {t('questionnaire.answer')} {t('Close')} setQuestionnaireCompletionModal(false)} /> > ); }; export default ProactiveQuestionnaireModal;
{t('questionnaire.successfully_submit')}
{t('questionnaire.thanks_for_answer')}
{t('questionnaire.more_satisfied_services')}
{t('questionnaire.strive_to_improve_services')}