diff --git a/public/locale/en.json b/public/locale/en.json index 6cbe69658f7..15b26365b10 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -2676,6 +2676,7 @@ "filed_by": "filed by", "files": "Files", "fill_color": "Fill Color", + "fill_context_load_failed": "Couldn't load the patient context for this form. Go back and try again.", "fill_draft_form_dropped": "Couldn't restore \"{{title}}\" — the questionnaire changed since the draft was saved.", "fill_draft_form_unavailable": "Couldn't load \"{{title}}\" just now — it's still in your saved draft.", "fill_draft_includes_added_forms_one": "Includes {{count}} added questionnaire.", @@ -4802,6 +4803,7 @@ "questionnaire_updated_successfully": "Questionnaire updated successfully", "questions": "Questions", "questions_count": "Question count", + "questions_outline": "Questions outline", "queue": "Queue", "queue_board": "Queue board", "queue_created_successfully": "Queue created successfully", diff --git a/src/components/Common/PluginErrorBoundary.tsx b/src/components/Common/PluginErrorBoundary.tsx index 3d07e1c7bf6..de2d154486d 100644 --- a/src/components/Common/PluginErrorBoundary.tsx +++ b/src/components/Common/PluginErrorBoundary.tsx @@ -1,14 +1,21 @@ import React from "react"; +interface PluginErrorBoundaryProps { + children: React.ReactNode; + pluginName: string; + fallback?: React.ReactNode; + /** Notified once the boundary has caught. Callers that must react to the + * failure elsewhere in the app use it — the questionnaire fill page + * records the question so submit-time validation stops requiring an + * input that is no longer on screen. */ + onError?: (error: Error) => void; +} + export class PluginErrorBoundary extends React.Component< - { children: React.ReactNode; pluginName: string; fallback?: React.ReactNode }, + PluginErrorBoundaryProps, { hasError: boolean } > { - constructor(props: { - children: React.ReactNode; - pluginName: string; - fallback?: React.ReactNode; - }) { + constructor(props: PluginErrorBoundaryProps) { super(props); this.state = { hasError: false }; } @@ -23,6 +30,7 @@ export class PluginErrorBoundary extends React.Component< error, errorInfo, ); + this.props.onError?.(error); } render() { diff --git a/src/components/Questionnaire/QuestionLabel.tsx b/src/components/Questionnaire/QuestionLabel.tsx deleted file mode 100644 index b610385910d..00000000000 --- a/src/components/Questionnaire/QuestionLabel.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { cn } from "@/lib/utils"; - -import { Label } from "@/components/ui/label"; - -import type { Question } from "@/types/questionnaire/question"; - -interface QuestionLabelProps { - question: Question; - className?: string; - groupLabel?: boolean; - isSubQuestion?: boolean; -} - -const defaultGroupClass = "text-lg font-medium text-gray-900"; -const defaultInputClass = "text-base font-medium block"; - -export function QuestionLabel({ - question, - className, - groupLabel, - isSubQuestion = false, -}: QuestionLabelProps) { - const defaultClass = groupLabel ? defaultGroupClass : defaultInputClass; - - return ( - - ); -} diff --git a/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx b/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx index 5cc5d147be1..8680acd5380 100644 --- a/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx @@ -48,7 +48,6 @@ import { import { CATEGORY_ICONS } from "@/components/Patient/allergy/list"; import { EntitySelectionDrawer } from "@/components/Questionnaire/EntitySelectionDrawer"; -import { QuestionLabel } from "@/components/Questionnaire/QuestionLabel"; import ValueSetSelect from "@/components/Questionnaire/ValueSetSelect"; import useBreakpoints from "@/hooks/useBreakpoints"; @@ -552,7 +551,6 @@ const AllergyItem = ({ }; export function AllergyQuestion({ - question, questionnaireResponse, updateQuestionnaireResponseCB, disabled, @@ -676,7 +674,6 @@ export function AllergyQuestion({ return (