Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC - Doctor Notes Enhancement #8016

Open
wants to merge 98 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
7443efd
reply feature for doctor notes
UdaySagar-Git May 13, 2024
3128fd7
code reviews
UdaySagar-Git May 15, 2024
51edb8d
code review
UdaySagar-Git May 16, 2024
ab2ec7e
Merge branch 'develop' into doctors-notes
rithviknishad May 20, 2024
2a3793a
Merge branch 'develop' into doctors-notes
nihal467 May 22, 2024
c23309f
profile picture feature
UdaySagar-Git Jun 7, 2024
7abc974
bug fix
UdaySagar-Git Jun 8, 2024
8eb0dd2
minor ui fix
UdaySagar-Git Jun 8, 2024
1bb7be9
add profile image in the side bar
UdaySagar-Git Jun 11, 2024
9852ae5
Merge branch 'doctors-notes' into gsoc-doctor-notes
UdaySagar-Git Jun 11, 2024
37a5947
Merge branch 'issues/3924/support-for-profile-pic' into gsoc-doctor-n…
UdaySagar-Git Jun 11, 2024
81450b4
Rich text editor
UdaySagar-Git Jun 20, 2024
6600560
Merge branch 'develop' into rich-text-editor
UdaySagar-Git Jun 20, 2024
de5a78e
Merge branch 'rich-text-editor' into gsoc-doctor-notes
UdaySagar-Git Jun 20, 2024
b955e78
code suggestions
UdaySagar-Git Jun 27, 2024
966970f
removes npm i packages
UdaySagar-Git Jun 27, 2024
9b2ae15
thread view
UdaySagar-Git Jun 28, 2024
a1446bd
code suggestions
UdaySagar-Git Jul 3, 2024
f1caca3
Merge branch 'develop' into rich-text-editor
UdaySagar-Git Jul 4, 2024
a3d1bc3
removes depricated commands
UdaySagar-Git Jul 4, 2024
16853d1
use usereducer
UdaySagar-Git Jul 4, 2024
10941b6
removes undo rendo
UdaySagar-Git Jul 4, 2024
e0ee2f5
support for mentions
UdaySagar-Git Jul 4, 2024
02ce215
mention style and strike through style
UdaySagar-Git Jul 5, 2024
d5a450e
file uploads
UdaySagar-Git Jul 5, 2024
ccafa0f
improved ui
UdaySagar-Git Jul 5, 2024
c2709a1
bug fix for file preview
UdaySagar-Git Jul 6, 2024
704cfba
support for camera captures and audio recordings
UdaySagar-Git Jul 6, 2024
9a88d4b
Merge branch 'issues/3924/support-for-profile-pic' into gsoc-doctor-n…
UdaySagar-Git Jul 6, 2024
dd73c02
Merge branch 'rich-text-editor' into gsoc-doctor-notes
UdaySagar-Git Jul 6, 2024
3956329
Merge branch 'rich-text-editor' into gsoc-doctor-notes
UdaySagar-Git Jul 6, 2024
2b93ad7
Merge branch 'thread-view' into gsoc-doctor-notes
UdaySagar-Git Jul 6, 2024
eeeab48
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Jul 6, 2024
a2b9061
mention hover card
UdaySagar-Git Jul 7, 2024
b926262
Merge branch 'rich-text-editor' into gsoc-doctor-notes
UdaySagar-Git Jul 7, 2024
2943843
code refactor for a reusable component
UdaySagar-Git Jul 8, 2024
891cfbf
Merge branch 'rich-text-editor' into gsoc-doctor-notes
UdaySagar-Git Jul 8, 2024
720d8da
integrated with doctor notes
UdaySagar-Git Jul 8, 2024
c8d8935
ui improvements
UdaySagar-Git Jul 8, 2024
32b4695
code suggestions
UdaySagar-Git Jul 9, 2024
82da842
fix cypress tests
UdaySagar-Git Jul 9, 2024
ca7d6ac
fix cypress tests
UdaySagar-Git Jul 9, 2024
b30e989
code suggeestions
UdaySagar-Git Jul 9, 2024
2066844
fix button clicks to remove styles if already updated
UdaySagar-Git Jul 9, 2024
2a57f8d
ui improvements
UdaySagar-Git Jul 10, 2024
149b74b
improvements in thread view
UdaySagar-Git Jul 10, 2024
85c1c5b
fix quote and hyperlink
UdaySagar-Git Jul 10, 2024
5f6ce4c
fix strike through
UdaySagar-Git Jul 10, 2024
4aba764
code refactor
UdaySagar-Git Jul 10, 2024
9720d23
sugeestions
UdaySagar-Git Jul 12, 2024
20a01ef
suggestions
UdaySagar-Git Jul 12, 2024
bdaa6b5
ui enhancement
UdaySagar-Git Jul 12, 2024
3036acf
fix bug
UdaySagar-Git Jul 12, 2024
362b80b
support for file upload
UdaySagar-Git Jul 12, 2024
6a472cb
fix preview
UdaySagar-Git Jul 12, 2024
266b494
fix deploy and minor fix
UdaySagar-Git Jul 12, 2024
e29837f
bug fix - enter uploading a notes
UdaySagar-Git Jul 12, 2024
cdfdf8f
bug fix
UdaySagar-Git Jul 12, 2024
f6c39b3
code review
UdaySagar-Git Jul 12, 2024
913f898
suggestions
UdaySagar-Git Jul 12, 2024
8364851
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Jul 20, 2024
e2b826a
Merge branch 'develop' into issues/3924/support-for-profile-pic
UdaySagar-Git Aug 15, 2024
de199bc
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Aug 15, 2024
cc51d0e
refetch user on save
UdaySagar-Git Aug 15, 2024
4dcebd7
Merge branch 'issues/3924/support-for-profile-pic' into gsoc-doctor-n…
UdaySagar-Git Aug 16, 2024
cca0084
improvements in thread view , to view in same page
UdaySagar-Git Aug 19, 2024
212bf59
Show Uploaded files under patient consultation page
UdaySagar-Git Aug 19, 2024
d3f2801
some ui fixes by keeping track of parent note
UdaySagar-Git Aug 20, 2024
646d770
mention preview improvements
UdaySagar-Git Aug 21, 2024
ad6acc4
improve filtering for mentions
UdaySagar-Git Aug 21, 2024
a26c956
supports for controlling dropdown menu with keyboard arrows and enter…
UdaySagar-Git Aug 21, 2024
2719bca
redirects to notes page on clicking on notification
UdaySagar-Git Aug 21, 2024
18989ea
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Aug 21, 2024
b7d617c
Avoid unnecessary `toReversed` fn. invocation (#8392)
rithviknishad Aug 22, 2024
9d2640d
Corrected Spelling mistake of daily rounds fields: ventilator_fi02 to…
SagarSharma2809 Aug 22, 2024
d67a23a
Fix Scroll Issue with Pressure Sores Popup (#8400)
gigincg Aug 22, 2024
e14acb4
Migrate to Headless UI v2 (#8260)
khavinshankar Aug 22, 2024
2ab8f4d
Fixed: #8265: Neurological Tables Padding Issue (#8386)
thevishvammoliya Aug 22, 2024
7f51640
Hide N/A and null values in event log #8376 (#8381)
Nithin9585 Aug 22, 2024
1340a23
Update react-pdf; pdfjs worker; Fixes for il8n (#8395)
gigincg Aug 22, 2024
c26c3de
Enable Facility Cover Image Uploads on Mobile Screens (#8402)
gigincg Aug 22, 2024
da6bed1
Improve Notes TextArea; Improve i18n (#8396)
gigincg Aug 22, 2024
fa7c1fd
Fix pdf previews (#8405)
sainak Aug 23, 2024
8aa4e9f
Fix clipping issue login page (#7891)
sunny-thakurwar Aug 23, 2024
62febd1
Fixes facility cover image from not reloading after upload (#8412)
rithviknishad Aug 23, 2024
5bff760
Refactored FileUpload component (#8329)
UdaySagar-Git Aug 23, 2024
a170fdb
fix merge
UdaySagar-Git Aug 23, 2024
cc4b73c
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Aug 23, 2024
54153b8
lint fix
UdaySagar-Git Aug 23, 2024
c900e9a
ui fixes
UdaySagar-Git Aug 23, 2024
66fb4fc
switch to plain markdown
UdaySagar-Git Aug 24, 2024
7dd1d81
improved dispaly of files ui to use existing components
UdaySagar-Git Aug 24, 2024
a66e9a2
shows fileuploads in notes under patient consultation page
UdaySagar-Git Aug 24, 2024
16664d5
santize markdown , fix mention trigger even after insertion , fix cur…
UdaySagar-Git Aug 24, 2024
8859914
fix lists and quotes
UdaySagar-Git Aug 24, 2024
85ea7e8
imporve styling
UdaySagar-Git Aug 24, 2024
c61e2ec
fix reload to happen only after all file uploads to prevent incomplet…
UdaySagar-Git Aug 24, 2024
2222e31
removes unused packages
UdaySagar-Git Aug 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"redux-thunk": "^2.4.2",
"rehype-raw": "^6.1.1",
"rescript-webapi": "^0.8.0",
"turndown": "^7.2.0",
"use-keyboard-shortcut": "^1.1.6",
"uuid": "^9.0.1",
"xlsx": "^0.18.5"
Expand All @@ -123,6 +124,7 @@
"@types/react-google-recaptcha": "^2.1.9",
"@types/react-qr-reader": "^2.1.7",
"@types/react-transition-group": "^4.4.10",
"@types/turndown": "^5.0.4",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.6.0",
Expand Down
21 changes: 11 additions & 10 deletions src/Components/Common/FilePreviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ type FilePreviewProps = {
};

const previewExtensions = [
".html",
".htm",
".pdf",
".mp4",
".webm",
".jpg",
".jpeg",
".png",
".gif",
".webp",
"html",
"htm",
"pdf",
"mp4",
"mp3",
"webm",
"jpg",
"jpeg",
"png",
"gif",
"webp",
];

const FilePreviewDialog = (props: FilePreviewProps) => {
Expand Down
173 changes: 173 additions & 0 deletions src/Components/Common/RichTextEditor/AudioRecorder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import CareIcon from "../../../CAREUI/icons/CareIcon";
import useRecorder from "../../../Utils/useRecorder";
import ButtonV2 from "../components/ButtonV2";
import { useEffect, useState } from "react";

const AudioRecorder = ({
setFile,
modalOpenForAudio,
setModalOpenForAudio,
}: {
setFile: (file: File) => void;
modalOpenForAudio: boolean;
setModalOpenForAudio: React.Dispatch<React.SetStateAction<boolean>>;
}) => {
const [audioBlobExists, setAudioBlobExists] = useState(false);
const [resetAudioRecording, setAudioResetRecording] = useState(false);
const [isMicPermission, setIsMicPermission] = useState(true);
const [audioBlob, setAudioBlob] = useState<Blob>();

const handleAudioUpload = () => {
if (!audioBlob) return;
const f = new File([audioBlob], "audio.mp3", {
type: audioBlob.type,
});
setFile(f);
deleteAudioBlob();
};

useEffect(() => {
if (modalOpenForAudio) {
setAudioBlobExists(false);
setAudioResetRecording(true);
startRecording();
}
}, [modalOpenForAudio]);

const [
audioURL,
isRecording,
startRecording,
stopRecording,
newBlob,
resetRecording,
] = useRecorder(setIsMicPermission);
const [time, setTime] = useState(0);
useEffect(() => {
setAudioBlob(newBlob);
let interval: number | NodeJS.Timeout | undefined;
if (isRecording) {
interval = setInterval(() => {
setTime((prevTime) => prevTime + 10);
}, 10);
} else {
clearInterval(interval);
setTime(0);
}
if (resetAudioRecording) {
resetRecording();
setAudioResetRecording(false);
}
return () => clearInterval(interval);
}, [isRecording, newBlob, resetAudioRecording]);

useEffect(() => {
const checkMicPermission = async () => {
try {
const permissions = await navigator.permissions.query({
name: "microphone" as PermissionName,
});
setIsMicPermission(permissions.state === "granted");
} catch (error) {
setIsMicPermission(false);
}
};

checkMicPermission();

return () => {
setIsMicPermission(true);
};
}, []);

const deleteAudioBlob = () => {
setAudioBlobExists(false);
setAudioResetRecording(true);
setModalOpenForAudio(false);
};

return (
<div className="flex w-full flex-col items-center justify-between gap-2 lg:flex-row">
{audioBlobExists && (
<div className="flex w-full items-center md:w-auto">
<ButtonV2
variant="danger"
className="w-full"
onClick={() => {
deleteAudioBlob();
}}
>
<CareIcon icon="l-trash" className="h-4" /> Delete
</ButtonV2>
</div>
)}
<div className="flex flex-col items-center gap-4 md:flex-row md:flex-wrap lg:flex-nowrap">
<div className="w-full md:w-auto">
<div>
{isRecording && (
<>
<div className="flex justify-end space-x-2">
<div className="flex bg-gray-100 p-2 text-primary-700">
<CareIcon
icon="l-record-audio"
className="mr-2 animate-pulse"
/>
<div className="mx-2">
(
<span>
{("0" + Math.floor((time / 60000) % 60)).slice(-2)}:
</span>
<span>
{("0" + Math.floor((time / 1000) % 60)).slice(-2)}
</span>
)
</div>
recording...
</div>
<ButtonV2
onClick={() => {
stopRecording();
setAudioBlobExists(true);
}}
>
<CareIcon icon="l-microphone-slash" className="text-lg" />
stop
</ButtonV2>
</div>
</>
)}
</div>
{audioURL && audioBlobExists && (
<div className="my-4">
<audio
className="m-auto max-h-full max-w-full object-contain"
src={audioURL}
controls
/>{" "}
</div>
)}
</div>

{!audioBlobExists && !isMicPermission && (
<span className="text-sm font-medium text-warning-500">
<CareIcon
icon="l-exclamation-triangle"
className="mr-1 text-base"
/>
Please allow browser permission before you start speaking
</span>
)}
</div>
{audioBlobExists && (
<div className="flex w-full items-center md:w-auto">
<ButtonV2 onClick={handleAudioUpload} className="w-full">
<CareIcon icon="l-cloud-upload" className="text-xl" />
Save
</ButtonV2>
</div>
)}
</div>
);
};

export default AudioRecorder;
Loading
Loading