diff --git a/public/locale/en.json b/public/locale/en.json index f86d78fa3aa..3ba6ba86831 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -349,6 +349,7 @@ "assigned_to": "Assigned to", "assigned_volunteer": "Assigned Volunteer", "async_operation_warning": "This operation may take some time. Please check back later.", + "attach_file": "Attach File", "atypical_presentation_details": "Atypical presentation details", "audio__allow_permission": "Please allow microphone permission in site settings", "audio__allow_permission_button": "Click here to know how to allow", @@ -913,6 +914,7 @@ "medicines_administered": "Medicine(s) administered", "medicines_administered_error": "Error administering medicine(s)", "member_id_required": "Member Id is required", + "mention": "Mention", "middleware_hostname": "Middleware Hostname", "middleware_hostname_example": "e.g. example.ohc.network", "middleware_hostname_sourced_from": "Middleware hostname sourced from {{ source }}", @@ -965,6 +967,7 @@ "no_linked_facilities": "No Linked Facilities", "no_log_update_delta": "No changes since previous log update", "no_log_updates": "No log updates found", + "no_matching_users": "No matching users found", "no_medical_history_available": "No Medical History Available", "no_notices_for_you": "No notices for you.", "no_patients_found": "No Patients Found", @@ -985,6 +988,7 @@ "normal": "Normal", "not_eligible": "Not Eligible", "not_specified": "Not Specified", + "note": "Note", "notes": "Notes", "notes_placeholder": "Type your Notes", "notice_board": "Notice Board", @@ -1161,6 +1165,7 @@ "reload": "Reload", "remove": "Remove", "rename": "Rename", + "replies": "Replies", "reply": "Reply", "report": "Report", "req_atleast_one_digit": "Require at least one digit", @@ -1347,6 +1352,7 @@ "type_d_cylinders": "D Type Cylinders", "type_to_search": "Type to search", "type_your_comment": "Type your comment", + "type_your_message": "Type your message here...", "type_your_reason_here": "Type your reason here", "unable_to_get_current_position": "Unable to get current position.", "unconfirmed": "Unconfirmed", @@ -1391,6 +1397,7 @@ "use_existing_abha_address": "Use Existing ABHA Address", "user_deleted_successfuly": "User Deleted Successfuly", "user_management": "User Management", + "user_mentions": "User Mentions", "username": "Username", "users": "Users", "vacant": "Vacant", diff --git a/src/components/Common/DiscussionNotesEditor.tsx b/src/components/Common/DiscussionNotesEditor.tsx index be0ca45dea6..f9e9e284740 100644 --- a/src/components/Common/DiscussionNotesEditor.tsx +++ b/src/components/Common/DiscussionNotesEditor.tsx @@ -1,8 +1,11 @@ -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { t } from "i18next"; +import React, { useEffect, useRef, useState } from "react"; import CareIcon from "@/CAREUI/icons/CareIcon"; -import { Submit } from "@/components/Common/ButtonV2"; +import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; + import { FilePreviewCard } from "@/components/Common/FilePreviewCard"; import MentionsDropdown from "@/components/Common/MentionDropdown"; import NotePreview from "@/components/Common/NotePreview"; @@ -65,7 +68,6 @@ const DiscussionNotesEditor: React.FC = ({ "xls", "xlsx", "ods", - "pdf", ], }); @@ -167,17 +169,34 @@ const DiscussionNotesEditor: React.FC = ({ ) : ( - { + // auto expand textarea + const textarea = e.currentTarget; + textarea.style.height = "auto"; + textarea.style.height = `${textarea.scrollHeight}px`; + if (maxRows) { + const lineHeight = parseInt( + window.getComputedStyle(textarea).lineHeight, + ); + const maxHeight = lineHeight * maxRows; + if (textarea.scrollHeight > maxHeight) { + textarea.style.height = `${maxHeight}px`; + textarea.style.overflowY = "auto"; + } else { + textarea.style.overflowY = "hidden"; + } + } + }} /> )} {fileUpload.files.length > 0 && ( @@ -196,46 +215,52 @@ const DiscussionNotesEditor: React.FC = ({ {/* toolbar*/}
-
@@ -259,7 +285,6 @@ const DiscussionNotesEditor: React.FC = ({ @@ -270,49 +295,4 @@ const DiscussionNotesEditor: React.FC = ({ ); }; -interface AutoExpandingTextareaProps - extends React.TextareaHTMLAttributes { - maxRows?: number; -} - -const AutoExpandingTextarea = React.forwardRef< - HTMLTextAreaElement, - AutoExpandingTextareaProps ->(({ maxRows, ...props }, ref) => { - const adjustHeight = useCallback( - (textarea: HTMLTextAreaElement) => { - textarea.style.height = "auto"; - - const style = window.getComputedStyle(textarea); - const borderHeight = - parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth); - const paddingHeight = - parseInt(style.paddingTop) + parseInt(style.paddingBottom); - - const lineHeight = parseInt(style.lineHeight); - const maxHeight = maxRows - ? lineHeight * maxRows + borderHeight + paddingHeight - : Infinity; - - const newHeight = Math.min( - textarea.scrollHeight + borderHeight, - maxHeight, - ); - textarea.style.height = `${newHeight}px`; - }, - [maxRows], - ); - - useEffect(() => { - const textarea = (ref as React.RefObject).current; - if (textarea) { - adjustHeight(textarea); - } - }, [props.value, adjustHeight]); - - return