Skip to content

Commit 440d9c0

Browse files
authored
Merge branch 'develop' into valueset_bugs
2 parents a5c47d9 + 213fb25 commit 440d9c0

File tree

10 files changed

+220
-223
lines changed

10 files changed

+220
-223
lines changed

public/locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@
803803
"edit_caution_note": "A new prescription will be added to the consultation with the edited details and the current prescription will be discontinued.",
804804
"edit_cover_photo": "Edit Cover Photo",
805805
"edit_facility": "Edit Facility",
806+
"edit_facility_details": "Edit Facility Details",
806807
"edit_history": "Edit History",
807808
"edit_location": "Edit Location",
808809
"edit_location_description": "Edit the Location to make any changes",

src/components/Common/AvatarEditModal.tsx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const AvatarEditModal = ({
6262
const [selectedFile, setSelectedFile] = useState<File>();
6363
const [preview, setPreview] = useState<string>();
6464
const [isCameraOpen, setIsCameraOpen] = useState<boolean>(false);
65-
const webRef = useRef<any>(null);
66-
const [previewImage, setPreviewImage] = useState(null);
65+
const webRef = useRef<Webcam>(null);
66+
const [previewImage, setPreviewImage] = useState<string | null>(null);
6767
const [isCaptureImgBeingUploaded, setIsCaptureImgBeingUploaded] =
6868
useState(false);
6969
const [constraint, setConstraint] = useState<IVideoConstraint>(
@@ -81,16 +81,35 @@ const AvatarEditModal = ({
8181
}, []);
8282

8383
const captureImage = () => {
84-
setPreviewImage(webRef.current.getScreenshot());
85-
const canvas = webRef.current.getCanvas();
86-
canvas?.toBlob((blob: Blob) => {
87-
const myFile = new File([blob], "image.png", {
88-
type: blob.type,
89-
});
90-
setSelectedFile(myFile);
84+
if (webRef.current) {
85+
setPreviewImage(webRef.current.getScreenshot());
86+
}
87+
const canvas = webRef.current?.getCanvas();
88+
canvas?.toBlob((blob) => {
89+
if (blob) {
90+
const myFile = new File([blob], "image.png", {
91+
type: blob.type,
92+
});
93+
setSelectedFile(myFile);
94+
} else {
95+
toast.error(t("failed_to_capture_image"));
96+
}
9197
});
9298
};
93-
99+
const stopCamera = useCallback(() => {
100+
try {
101+
if (webRef.current) {
102+
const openCamera = webRef.current?.video?.srcObject as MediaStream;
103+
if (openCamera) {
104+
openCamera.getTracks().forEach((track) => track.stop());
105+
}
106+
}
107+
} catch {
108+
toast.error("Failed to stop camera");
109+
} finally {
110+
setIsCameraOpen(false);
111+
}
112+
}, []);
94113
const closeModal = () => {
95114
setPreview(undefined);
96115
setIsProcessing(false);
@@ -410,7 +429,7 @@ const AvatarEditModal = ({
410429
onClick={() => {
411430
setPreviewImage(null);
412431
setIsCameraOpen(false);
413-
webRef.current.stopCamera();
432+
stopCamera();
414433
}}
415434
disabled={isProcessing}
416435
>

src/components/Common/ContactLink.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@ type ContactLinkProps =
77
export default function ContactLink(props: ContactLinkProps) {
88
return (
99
<div>
10-
<a
11-
href={props.tel ? `tel:${props.tel}` : `mailto:${props.mailto}`}
12-
className="flex items-center gap-2 border-b border-blue-500 text-base font-medium tracking-wider text-blue-500"
13-
>
14-
<CareIcon
15-
icon={props.tel ? "l-outgoing-call" : "l-envelope-alt"}
16-
className="h-5 fill-secondary-700"
17-
/>
10+
<a href={props.tel ? `tel:${props.tel}` : `mailto:${props.mailto}`}>
11+
<CareIcon icon={props.tel ? "l-outgoing-call" : "l-envelope-alt"} />
1812
{props.tel ? props.tel : props.mailto}
1913
</a>
2014
</div>

src/components/Common/UserSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function UserSelector({
7171
className="size-6 rounded-full"
7272
/>
7373
<TooltipComponent content={formatName(selected)} side="bottom">
74-
<p className="font-medium text-gray-900 truncate max-w-56 sm:max-w-48 md:max-w-64 lg:max-w-64 xl:max-w-36">
74+
<p className="font-medium text-gray-900 truncate max-w-48 sm:max-w-56 md:max-w-64">
7575
{formatName(selected)}
7676
</p>
7777
</TooltipComponent>

0 commit comments

Comments
 (0)