Skip to content

Commit

Permalink
isPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
amjithtitus09 committed Feb 20, 2025
1 parent 0a50f3c commit e52aa6c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/components/Questionnaire/QuestionRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function QuestionRenderer({
patientId,
}: QuestionRendererProps) {
const questionRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
const isPreview = encounterId === "preview";

useEffect(() => {
if (activeGroupId && questionRefs.current[activeGroupId]) {
Expand Down Expand Up @@ -79,7 +80,7 @@ export function QuestionRenderer({
updateQuestionnaireResponseCB={onResponseChange}
errors={errors}
clearError={clearError}
disabled={disabled || encounterId === "preview"}
disabled={disabled || isPreview}
activeGroupId={activeGroupId}
patientId={patientId}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export function AllergyQuestion({
disabled,
patientId,
}: AllergyQuestionProps) {
const isPreview = patientId === "preview";
const allergies =
(questionnaireResponse.values?.[0]?.value as AllergyIntoleranceRequest[]) ||
[];
Expand All @@ -121,7 +122,7 @@ export function AllergyQuestion({
limit: 100,
},
}),
enabled: patientId !== "preview",
enabled: !isPreview,
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function DiagnosisQuestion({
updateQuestionnaireResponseCB,
disabled,
}: DiagnosisQuestionProps) {
const isPreview = patientId === "preview";
const diagnoses =
(questionnaireResponse.values?.[0]?.value as DiagnosisRequest[]) || [];

Expand All @@ -102,7 +103,7 @@ export function DiagnosisQuestion({
limit: 100,
},
}),
enabled: encounterId !== "preview",
enabled: !isPreview,
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function MedicationRequestQuestion({
patientId,
encounterId,
}: MedicationRequestQuestionProps) {
const isPreview = patientId === "preview";
const medications =
(questionnaireResponse.values?.[0]?.value as MedicationRequest[]) || [];

Expand All @@ -100,7 +101,7 @@ export function MedicationRequestQuestion({
limit: 100,
},
}),
enabled: encounterId !== "preview",
enabled: !isPreview,
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function MedicationStatementQuestion({
encounterId,
}: MedicationStatementQuestionProps) {
const { t } = useTranslation();
const isPreview = patientId === "preview";
const desktopLayout = useBreakpoints({ lg: true, default: false });
const [expandedMedicationIndex, setExpandedMedicationIndex] = useState<
number | null
Expand All @@ -115,7 +116,7 @@ export function MedicationStatementQuestion({
encounter: encounterId,
},
}),
enabled: encounterId !== "preview",
enabled: !isPreview,
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export function SymptomQuestion({
disabled,
encounterId,
}: SymptomQuestionProps) {
const isPreview = patientId === "preview";
const symptoms =
(questionnaireResponse.values?.[0]?.value as SymptomRequest[]) || [];

Expand All @@ -296,7 +297,7 @@ export function SymptomQuestion({
encounter: encounterId,
},
}),
enabled: encounterId !== "preview",
enabled: !isPreview,
});

useEffect(() => {
Expand Down

0 comments on commit e52aa6c

Please sign in to comment.