Skip to content

Commit

Permalink
fix: correcting submission button bug for MRF
Browse files Browse the repository at this point in the history
  • Loading branch information
kathleenkhy authored and justynoh committed Apr 3, 2024
1 parent d84c3fa commit 7342138
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { Container, Flex, Stack, StackDivider } from '@chakra-ui/react'

import { FormColorTheme, FormDto } from '~shared/types/form'

import { SubmissionData } from '~features/public-form/PublicFormContext'
import {
SubmissionData,
usePublicFormContext,
} from '~features/public-form/PublicFormContext'

import { EndPageBlock } from './components/EndPageBlock'
import { FeedbackBlock, FeedbackFormInput } from './components/FeedbackBlock'
Expand All @@ -23,6 +26,8 @@ export const FormEndPage = ({
colorTheme,
...endPageProps
}: FormEndPageProps): JSX.Element => {
const { previousSubmissionId } = usePublicFormContext()

return (
<Container w="42.5rem" maxW="100%" p={0}>
<Flex flexDir="column" align="center">
Expand All @@ -39,6 +44,7 @@ export const FormEndPage = ({
focusOnMount
{...endPageProps}
colorTheme={colorTheme}
previousSubmissionId={previousSubmissionId}
/>
{isFeedbackSectionHidden ? null : (
<FeedbackBlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ import { useMdComponents } from '~hooks/useMdComponents'
import Button from '~components/Button'
import { MarkdownText } from '~components/MarkdownText'

import {
SubmissionData,
usePublicFormContext,
} from '~features/public-form/PublicFormContext'
import { SubmissionData } from '~features/public-form/PublicFormContext'

export interface EndPageBlockProps {
formTitle: FormDto['title'] | undefined
endPage: FormDto['endPage']
submissionData: SubmissionData
colorTheme?: FormColorTheme
focusOnMount?: boolean
previousSubmissionId?: string
}

export const EndPageBlock = ({
Expand All @@ -27,6 +25,7 @@ export const EndPageBlock = ({
submissionData,
colorTheme = FormColorTheme.Blue,
focusOnMount,
previousSubmissionId,
}: EndPageBlockProps): JSX.Element => {
const focusRef = useRef<HTMLDivElement>(null)
useEffect(() => {
Expand Down Expand Up @@ -56,7 +55,6 @@ export const EndPageBlock = ({
return 'You have successfully submitted your response.'
}, [formTitle])

const { previousSubmissionId } = usePublicFormContext()
const disableSubmitResponseButton = !!previousSubmissionId //disable for MRF 2nd respondent onwards

return (
Expand Down

0 comments on commit 7342138

Please sign in to comment.