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 122 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
122 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)
0xvish 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
71a328b
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Sep 20, 2024
7164603
fix conflicts
UdaySagar-Git Sep 20, 2024
5dc990f
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Oct 1, 2024
17a6fb7
fix build and add missing imports
UdaySagar-Git Oct 1, 2024
4e06cf2
cleanup and some fixes
UdaySagar-Git Oct 1, 2024
88dae0b
fix file name during upload
UdaySagar-Git Oct 2, 2024
d61a2fd
Merge branch 'develop' into gsoc-doctor-notes
nihal467 Oct 3, 2024
ea1f0fe
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Oct 5, 2024
1996f6e
fix cypress test run
UdaySagar-Git Oct 5, 2024
5d869c4
Merge branch 'develop' into gsoc-doctor-notes
khavinshankar Oct 9, 2024
93f3f86
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Oct 13, 2024
287aa4f
ui improvements and bug fixes
UdaySagar-Git Oct 13, 2024
0e6fded
Merge branch 'develop' into gsoc-doctor-notes
UdaySagar-Git Oct 17, 2024
09a23eb
fix build
UdaySagar-Git Oct 18, 2024
ade1875
Merge branch 'develop' into gsoc-doctor-notes
khavinshankar Oct 23, 2024
76164b1
suggestions
UdaySagar-Git Oct 23, 2024
e7580d1
refactor file upload logic to use existing modals
UdaySagar-Git Oct 23, 2024
e9e9a5b
Merge remote-tracking branch 'upstream/develop' into gsoc-doctor-notes
UdaySagar-Git Oct 23, 2024
49a8af9
fix imports
UdaySagar-Git Oct 23, 2024
c930f08
try moving files
UdaySagar-Git Oct 23, 2024
d500866
Fix casing issues
UdaySagar-Git Oct 23, 2024
618a407
Re-index all files
UdaySagar-Git Oct 23, 2024
cfccbff
use child_notes field
UdaySagar-Git Oct 24, 2024
ce0aa97
rename 'parent_note' to 'root_note'
UdaySagar-Git Oct 25, 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
105 changes: 105 additions & 0 deletions src/Components/Common/MarkdownPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React, { useEffect, useState } from "react";
import ReactMarkdown from "react-markdown";
import rehypeRaw from "rehype-raw";
import { UserModel } from "../Users/models";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";

interface UserCardProps {
user: UserModel;
}

interface CustomLinkProps {
className?: string;
"data-username"?: string;
}

const UserCard: React.FC<UserCardProps> = ({ user }) => (
<div className="z-10 flex w-64 items-center space-x-3 rounded-lg bg-gray-200 px-3 pb-3 shadow-lg">
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-primary text-lg font-semibold text-white">
{user.first_name[0]}
</div>
<div className="space-y-0">
<h3 className="text-sm font-semibold text-gray-800">
{user.first_name} {user.last_name}
</h3>
<p className="text-xs text-gray-500">@{user.username}</p>
<p className="text-xs text-gray-500">{user.user_type}</p>
</div>
</div>
);

const MarkdownPreview: React.FC<{ markdown: string }> = ({ markdown }) => {
const [userCache, setUserCache] = useState<Record<string, UserModel>>({});
const facilityId = "81092ced-8720-44cb-b4c5-3f0ad0540153";
UdaySagar-Git marked this conversation as resolved.
Show resolved Hide resolved

const { data: facilityUsers } = useQuery(routes.getFacilityUsers, {
pathParams: { facility_id: facilityId },
});

useEffect(() => {
if (facilityUsers?.results) {
const newCache: Record<string, UserModel> = {};
facilityUsers.results.forEach((user) => {
if (user.username) {
newCache[user.username] = user as UserModel;
}
});
setUserCache(newCache);
}
}, [facilityUsers]);
UdaySagar-Git marked this conversation as resolved.
Show resolved Hide resolved

const processedMarkdown = markdown
.replace(
/!\[mention_user\]\(user_id:(\d+), username:([^)]+)\)/g,
(_, userId, username) =>
`<a class="user-mention" href="/user/profile/${username}" data-user-id="${userId}" data-username="${username}">@${username}</a>`,
)
.replace(/~(.*?)~/g, (_, text) => `<del>${text}</del>`);

const CustomLink: React.FC<CustomLinkProps> = (props) => {
if (props.className?.includes("user-mention") && props["data-username"]) {
const username = props["data-username"];
return (
<span className="group relative inline-block">
<span
onClick={(e) => {
e.stopPropagation();
}}
className="cursor-pointer rounded bg-blue-100 px-1 font-normal text-slate-800 no-underline"
>
@{username}
</span>
{userCache[username] && (
<div className="tooltip-text invisible absolute bottom-full z-10 mb-2 opacity-0 transition-opacity duration-300 ease-in-out group-hover:visible group-hover:opacity-100">
<UserCard user={userCache[username]} />
<div className="absolute left-2 top-full border-8 border-solid border-transparent border-t-gray-200 shadow-md"></div>
</div>
)}
</span>
);
}
return (
<a
{...props}
target="_blank"
onClick={(e) => e.stopPropagation()}
className="text-blue-500 underline"
/>
);
};

return (
<ReactMarkdown
className="prose text-sm prose-p:m-0"
rehypePlugins={[rehypeRaw]}
components={{
a: CustomLink,
}}
>
{processedMarkdown}
</ReactMarkdown>
);
};

export default MarkdownPreview;
51 changes: 51 additions & 0 deletions src/Components/Common/MentionDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useEffect, useState } from "react";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
import useSlug from "../../Common/hooks/useSlug";

const MentionsDropdown: React.FC<{
onSelect: (user: any) => void;
UdaySagar-Git marked this conversation as resolved.
Show resolved Hide resolved
position: { top: number; left: number };
editorRef: React.RefObject<HTMLDivElement>;
}> = ({ onSelect, position, editorRef }) => {
const facilityId = useSlug("facility");
const { data } = useQuery(routes.getFacilityUsers, {
pathParams: { facility_id: facilityId },
});

const users = data?.results || [];

const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0 });

useEffect(() => {
if (editorRef.current) {
const editorRect = editorRef.current.getBoundingClientRect();
setDropdownPosition({
top: position.top - editorRect.top + editorRef.current.scrollTop,
left: position.left - editorRect.left,
});
}
}, [position, editorRef]);

return (
<div
className="absolute z-10 max-h-36 w-64 overflow-y-scroll rounded-md bg-white text-sm shadow-lg"
style={{ top: dropdownPosition.top, left: dropdownPosition.left }}
>
{users.map((user) => (
<div
key={user.id}
className="flex cursor-pointer items-center gap-2 p-2 hover:bg-gray-100"
onClick={() => onSelect(user)}
>
<span className="flex h-5 w-5 items-center justify-center rounded-full bg-primary text-xs font-semibold text-white">
{user.first_name[0]}
</span>
{user.username}
</div>
))}
</div>
);
};

export default MentionsDropdown;
Loading
Loading