Skip to content

Commit 16c46f3

Browse files
committed
Add missing props
1 parent 2f5f517 commit 16c46f3

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

vim--ai-scribe--react/src/components/templates/DebugView.tsx renamed to vim--ai-scribe--react/src/components/organisms/notes-tab/DebugView.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { TranscriptionPanel } from "../organisms/transcription-panel/TranscriptionPanel";
2-
import { NotesSections } from "../organisms/notes-tab/NotesSections";
3-
import type { TranscriptionSegment } from "../organisms/ai-scribe-demo/transcription.mock";
1+
import { TranscriptionPanel } from "../transcription-panel/TranscriptionPanel";
2+
import { NotesSections } from "./NotesSections";
3+
import type { TranscriptionSegment } from "../ai-scribe-demo/transcription.mock";
4+
import { useUpdateEncounter } from "./useSectionWriteAvailability";
45

56
interface DebugViewProps {
67
transcriptionSegments: TranscriptionSegment[];
@@ -21,6 +22,8 @@ export const DebugView = ({
2122
onHoverSegment,
2223
renderHighlightedText,
2324
}: DebugViewProps) => {
25+
const updateEncounterState = useUpdateEncounter();
26+
2427
return (
2528
<div className="grid grid-cols-2 gap-6">
2629
<TranscriptionPanel
@@ -32,6 +35,7 @@ export const DebugView = ({
3235
hoveredSegment={hoveredSegment}
3336
transcriptionSegments={transcriptionSegments}
3437
renderHighlightedText={renderHighlightedText}
38+
{...updateEncounterState}
3539
/>
3640
</div>
3741
);

vim--ai-scribe--react/src/components/organisms/notes-tab/NotesTab.tsx

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import { useState } from "react";
21
import { useNoteFormContext } from "@/providers/NoteFormContext";
32
import { useVimOsContext } from "@/providers/VimOSContext";
3+
import { useState } from "react";
44
import { Button } from "../../atoms/Button";
5-
import { DebugView } from "../../templates/DebugView";
5+
import { DebugView } from "./DebugView";
66
import { MOCK_TRANSCRIPTION } from "../ai-scribe-demo/transcription.mock";
77
import { NotesSections } from "./NotesSections";
8-
import {
9-
useUpdateSubjective,
10-
useUpdateObjective,
11-
useUpdateAssessment,
12-
useUpdatePlan,
13-
} from "./useSectionWriteAvailability";
8+
import { useUpdateEncounter } from "./useSectionWriteAvailability";
149

1510
export const NotesTab = ({
1611
patientName,
@@ -27,20 +22,14 @@ export const NotesTab = ({
2722
const { watch } = useNoteFormContext();
2823
const currentNote = watch();
2924

30-
// Use the hooks to get write availability and update functions
31-
const { canUpdateSubjectiveNote, updateSubjectiveNote } =
32-
useUpdateSubjective();
33-
const { canUpdateObjectiveNote, updateObjectiveNote } = useUpdateObjective();
34-
const { canUpdateAssessmentNote, updateAssessmentNote } =
35-
useUpdateAssessment();
36-
const { canUpdatePlanNote, updatePlanNote } = useUpdatePlan();
25+
const updateEncounterState = useUpdateEncounter();
3726

3827
// Only enable the button if all are true
3928
const canPushAll =
40-
canUpdateSubjectiveNote &&
41-
canUpdateObjectiveNote &&
42-
canUpdateAssessmentNote &&
43-
canUpdatePlanNote;
29+
updateEncounterState.canUpdateSubjectiveNote &&
30+
updateEncounterState.canUpdateObjectiveNote &&
31+
updateEncounterState.canUpdateAssessmentNote &&
32+
updateEncounterState.canUpdatePlanNote;
4433

4534
const toggleDebugMode = () => {
4635
setIsDebugMode(!isDebugMode);
@@ -82,14 +71,7 @@ export const NotesTab = ({
8271
hoveredSegment={hoveredSegment}
8372
transcriptionSegments={MOCK_TRANSCRIPTION}
8473
renderHighlightedText={renderHighlightedText}
85-
canUpdateSubjectiveNote={canUpdateSubjectiveNote}
86-
canUpdateObjectiveNote={canUpdateObjectiveNote}
87-
canUpdateAssessmentNote={canUpdateAssessmentNote}
88-
canUpdatePlanNote={canUpdatePlanNote}
89-
updateSubjectiveNote={updateSubjectiveNote}
90-
updateObjectiveNote={updateObjectiveNote}
91-
updateAssessmentNote={updateAssessmentNote}
92-
updatePlanNote={updatePlanNote}
74+
{...updateEncounterState}
9375
/>
9476
)}
9577
</>

vim--ai-scribe--react/src/components/organisms/notes-tab/useSectionWriteAvailability.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,22 @@ export const useUpdatePlan = () => {
8383
updatePlanNote,
8484
};
8585
};
86+
87+
export const useUpdateEncounter = () => {
88+
const { canUpdateSubjectiveNote, updateSubjectiveNote } =
89+
useUpdateSubjective();
90+
const { canUpdateObjectiveNote, updateObjectiveNote } = useUpdateObjective();
91+
const { canUpdateAssessmentNote, updateAssessmentNote } =
92+
useUpdateAssessment();
93+
const { canUpdatePlanNote, updatePlanNote } = useUpdatePlan();
94+
return {
95+
canUpdateSubjectiveNote,
96+
updateSubjectiveNote,
97+
canUpdateObjectiveNote,
98+
updateObjectiveNote,
99+
canUpdateAssessmentNote,
100+
updateAssessmentNote,
101+
canUpdatePlanNote,
102+
updatePlanNote,
103+
};
104+
};

0 commit comments

Comments
 (0)