|
|
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
|
|
import { IQuestionnaireOrderHasId } from '~/interfaces/questionnaire/questionnaire-order';
|
|
|
+import { useCurrentUser } from '~/stores/context';
|
|
|
import { useQuestionnaireModal } from '~/stores/modal';
|
|
|
|
|
|
|
|
|
@@ -12,6 +13,9 @@ type QuestionnaireToastProps = {
|
|
|
|
|
|
const QuestionnaireToast = ({ questionnaireOrder }: QuestionnaireToastProps): JSX.Element => {
|
|
|
const { open: openQuestionnaireModal } = useQuestionnaireModal();
|
|
|
+ const { data: currentUser } = useCurrentUser();
|
|
|
+ const lang = currentUser?.lang;
|
|
|
+
|
|
|
const [isOpen, setIsOpen] = useState(true);
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
@@ -21,9 +25,11 @@ const QuestionnaireToast = ({ questionnaireOrder }: QuestionnaireToastProps): JS
|
|
|
openQuestionnaireModal(questionnaireOrder._id);
|
|
|
};
|
|
|
|
|
|
+ const questionnaireOrderTitle = lang === 'en_US' ? questionnaireOrder.title.en_US : questionnaireOrder.title.ja_JP;
|
|
|
+
|
|
|
return <div className={`toast ${isOpen ? 'show' : 'hide'}`}>
|
|
|
<div className="toast-header bg-info">
|
|
|
- <strong className="mr-auto text-light">{questionnaireOrder.title}</strong>
|
|
|
+ <strong className="mr-auto text-light">{questionnaireOrderTitle}</strong>
|
|
|
<button type="button" className="ml-2 mb-1 close" onClick={() => setIsOpen(false)}>
|
|
|
<span aria-hidden="true" className="text-light">×</span>
|
|
|
</button>
|