Skip to content

Commit

Permalink
Merge branch 'develop' into valueset_bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 authored Feb 20, 2025
2 parents a5c47d9 + 213fb25 commit 440d9c0
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 223 deletions.
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@
"edit_caution_note": "A new prescription will be added to the consultation with the edited details and the current prescription will be discontinued.",
"edit_cover_photo": "Edit Cover Photo",
"edit_facility": "Edit Facility",
"edit_facility_details": "Edit Facility Details",
"edit_history": "Edit History",
"edit_location": "Edit Location",
"edit_location_description": "Edit the Location to make any changes",
Expand Down
41 changes: 30 additions & 11 deletions src/components/Common/AvatarEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const AvatarEditModal = ({
const [selectedFile, setSelectedFile] = useState<File>();
const [preview, setPreview] = useState<string>();
const [isCameraOpen, setIsCameraOpen] = useState<boolean>(false);
const webRef = useRef<any>(null);
const [previewImage, setPreviewImage] = useState(null);
const webRef = useRef<Webcam>(null);
const [previewImage, setPreviewImage] = useState<string | null>(null);
const [isCaptureImgBeingUploaded, setIsCaptureImgBeingUploaded] =
useState(false);
const [constraint, setConstraint] = useState<IVideoConstraint>(
Expand All @@ -81,16 +81,35 @@ const AvatarEditModal = ({
}, []);

const captureImage = () => {
setPreviewImage(webRef.current.getScreenshot());
const canvas = webRef.current.getCanvas();
canvas?.toBlob((blob: Blob) => {
const myFile = new File([blob], "image.png", {
type: blob.type,
});
setSelectedFile(myFile);
if (webRef.current) {
setPreviewImage(webRef.current.getScreenshot());
}
const canvas = webRef.current?.getCanvas();
canvas?.toBlob((blob) => {
if (blob) {
const myFile = new File([blob], "image.png", {
type: blob.type,
});
setSelectedFile(myFile);
} else {
toast.error(t("failed_to_capture_image"));
}
});
};

const stopCamera = useCallback(() => {
try {
if (webRef.current) {
const openCamera = webRef.current?.video?.srcObject as MediaStream;
if (openCamera) {
openCamera.getTracks().forEach((track) => track.stop());
}
}
} catch {
toast.error("Failed to stop camera");
} finally {
setIsCameraOpen(false);
}
}, []);
const closeModal = () => {
setPreview(undefined);
setIsProcessing(false);
Expand Down Expand Up @@ -410,7 +429,7 @@ const AvatarEditModal = ({
onClick={() => {
setPreviewImage(null);
setIsCameraOpen(false);
webRef.current.stopCamera();
stopCamera();
}}
disabled={isProcessing}
>
Expand Down
10 changes: 2 additions & 8 deletions src/components/Common/ContactLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ type ContactLinkProps =
export default function ContactLink(props: ContactLinkProps) {
return (
<div>
<a
href={props.tel ? `tel:${props.tel}` : `mailto:${props.mailto}`}
className="flex items-center gap-2 border-b border-blue-500 text-base font-medium tracking-wider text-blue-500"
>
<CareIcon
icon={props.tel ? "l-outgoing-call" : "l-envelope-alt"}
className="h-5 fill-secondary-700"
/>
<a href={props.tel ? `tel:${props.tel}` : `mailto:${props.mailto}`}>
<CareIcon icon={props.tel ? "l-outgoing-call" : "l-envelope-alt"} />
{props.tel ? props.tel : props.mailto}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/UserSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function UserSelector({
className="size-6 rounded-full"
/>
<TooltipComponent content={formatName(selected)} side="bottom">
<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">
<p className="font-medium text-gray-900 truncate max-w-48 sm:max-w-56 md:max-w-64">
{formatName(selected)}
</p>
</TooltipComponent>
Expand Down
Loading

0 comments on commit 440d9c0

Please sign in to comment.