diff --git a/frontend/benefit/handler/src/components/applicationReview/handlingView/HandlingStep2.tsx b/frontend/benefit/handler/src/components/applicationReview/handlingView/HandlingStep2.tsx index bb12eed220..aadad7f35d 100644 --- a/frontend/benefit/handler/src/components/applicationReview/handlingView/HandlingStep2.tsx +++ b/frontend/benefit/handler/src/components/applicationReview/handlingView/HandlingStep2.tsx @@ -3,7 +3,7 @@ import useAhjoSettingsQuery from 'benefit/handler/hooks/useAhjoSettingsQuery'; import { DecisionProposalTemplateData } from 'benefit/handler/types/common'; import { DECISION_TYPES } from 'benefit-shared/constants'; import { Application, DecisionMaker } from 'benefit-shared/types/application'; -import { Select, SelectionGroup } from 'hds-react'; +import { LoadingSpinner, Select, SelectionGroup } from 'hds-react'; import { useTranslation } from 'next-i18next'; import * as React from 'react'; import Container from 'shared/components/container/Container'; @@ -36,7 +36,7 @@ const ApplicationReviewStep2: React.FC = ({ application, }) => { const { applicantLanguage, id } = application; - + const { t } = useTranslation(); const translationBase = 'common:review.decisionProposal'; const { handledApplication, setHandledApplication } = @@ -46,7 +46,7 @@ const ApplicationReviewStep2: React.FC = ({ React.useState(handledApplication?.justificationText || ''); const [templateForDecisionText, setTemplateForDecisionText] = React.useState(handledApplication?.decisionText || ''); - + const [selectedDecisionMaker, setSelectedDecisionMaker] = React.useState(null); @@ -55,7 +55,10 @@ const ApplicationReviewStep2: React.FC = ({ ? DECISION_TYPES.ACCEPTED : DECISION_TYPES.DENIED; - const { data: sections } = useDecisionProposalTemplateQuery(id, decisionType); + const { data: sections, isLoading } = useDecisionProposalTemplateQuery( + id, + decisionType + ); const { data: decisionMakerOptions } = useAhjoSettingsQuery(); const selectTemplate = (option: DecisionProposalTemplateData): void => { @@ -89,6 +92,14 @@ const ApplicationReviewStep2: React.FC = ({ }); }; + if (isLoading) { + return ( + + + + ); + } + if (!sections || sections?.length === 0) { const language = applicantLanguage === 'en' ? 'fi' : (applicantLanguage as 'fi' | 'sv'); @@ -119,7 +130,7 @@ const ApplicationReviewStep2: React.FC = ({ /> <$GridCell $colSpan={12}> -