diff --git a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx index 91cd86c606e..ad966d58a6d 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx @@ -17,6 +17,7 @@ import useOperateCamera, { } from "../../CameraFeed/useOperateCamera"; import request from "../../../Utils/request/request"; import { classNames, isIOS } from "../../../Utils/utils"; +import ConfirmDialog from "../../Common/ConfirmDialog"; export const ConsultationFeedTab = (props: ConsultationTabProps) => { const authUser = useAuthUser(); @@ -25,6 +26,8 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { const [asset, setAsset] = useState(); const [preset, setPreset] = useState(); + const [showPresetSaveConfirmation, setShowPresetSaveConfirmation] = + useState(false); const [isUpdatingPreset, setIsUpdatingPreset] = useState(false); const [hasMoved, setHasMoved] = useState(false); const [key, setKey] = useState(0); @@ -77,6 +80,7 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { setPreset(updated); setHasMoved(false); setIsUpdatingPreset(false); + setShowPresetSaveConfirmation(false); }; useEffect(() => { @@ -94,97 +98,108 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { } return ( -
- + setShowPresetSaveConfirmation(false)} + onConfirm={handleUpdatePreset} /> - - - For better experience, rotate your device. - -
- setHasMoved(true)} - onReset={() => { - if (isIOS) { - setKey(key + 1); - } - }} - onStreamError={() => { - triggerGoal("Camera Feed Viewed", { - consultationId: props.consultationId, - userId: authUser.id, - result: "error", - }); - }} - onStreamSuccess={() => { - triggerGoal("Camera Feed Viewed", { - consultationId: props.consultationId, - userId: authUser.id, - result: "success", - }); - }} - > -
- {presets ? ( - <> - obj.meta.preset_name} - value={preset} - onChange={(value) => { - triggerGoal("Camera Preset Clicked", { - presetName: preset?.meta?.preset_name, - consultationId: props.consultationId, - userId: authUser.id, - result: "success", - }); - setHasMoved(false); - setPreset(value); - }} - /> - {isUpdatingPreset ? ( - + + + + For better experience, rotate your device. + +
+ setHasMoved(true)} + onReset={() => { + if (isIOS) { + setKey(key + 1); + } + }} + onStreamError={() => { + triggerGoal("Camera Feed Viewed", { + consultationId: props.consultationId, + userId: authUser.id, + result: "error", + }); + }} + onStreamSuccess={() => { + triggerGoal("Camera Feed Viewed", { + consultationId: props.consultationId, + userId: authUser.id, + result: "success", + }); + }} + > +
+ {presets ? ( + <> + obj.meta.preset_name} + value={preset} + onChange={(value) => { + triggerGoal("Camera Preset Clicked", { + presetName: preset?.meta?.preset_name, + consultationId: props.consultationId, + userId: authUser.id, + result: "success", + }); + setHasMoved(false); + setPreset(value); + }} /> - ) : ( - + {isUpdatingPreset ? ( - - )} - - ) : ( - loading presets... - )} -
-
+ ) : ( + setShowPresetSaveConfirmation(true)} + > + + + )} + + ) : ( + loading presets... + )} +
+ +
-
+ ); };