From f51ed3a380accd7df6dd8ffe4a92c5f01d13ee5a Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 12 May 2025 14:32:48 +0530 Subject: [PATCH 1/2] added custome font size class --- public/assets/css/default.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/assets/css/default.css b/public/assets/css/default.css index 08b78aa8..919d49dc 100644 --- a/public/assets/css/default.css +++ b/public/assets/css/default.css @@ -189,3 +189,7 @@ text-align: left; padding-left: 50px; } */ + +.small-text{ + font-size: 12px; +} \ No newline at end of file From 926168bb0750f34dc8086dfe034d023a82588ac8 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Mon, 12 May 2025 14:33:34 +0530 Subject: [PATCH 2/2] Modified report comments section. --- .../Activities/ReportTaskComments.jsx | 153 +++++++++++------- 1 file changed, 98 insertions(+), 55 deletions(-) diff --git a/src/components/Activities/ReportTaskComments.jsx b/src/components/Activities/ReportTaskComments.jsx index 94ee1c7b..efe62d0a 100644 --- a/src/components/Activities/ReportTaskComments.jsx +++ b/src/components/Activities/ReportTaskComments.jsx @@ -27,15 +27,21 @@ const ReportTaskComments = ({ commentsData, closeModal }) => { }); const containerRef = useRef(null); + const firstRender = useRef(true); + + useEffect(() => { setComment(commentsData?.comments); }, [commentsData]); + // Scroll logic: scroll to bottom when new comments are added useEffect(() => { - if (containerRef.current) { + if (!firstRender.current && containerRef.current) { containerRef.current.scrollTop = containerRef.current.scrollHeight; + } else { + firstRender.current = false; // Mark the first render as complete } - }, [comments]); + }, [comments]); // Run this when comments array is updated const onSubmit = async (data) => { let sendComment = { @@ -70,9 +76,10 @@ const ReportTaskComments = ({ commentsData, closeModal }) => { // closeModal(); } catch (error) { setloading(false); - showToast(error.response.data?.message || "Something wrong", "error"); + showToast(error.response.data?.message || "Something went wrong", "error"); } }; + return (
{ onClick={closeModal} aria-label="Close" > -

- {`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "} - {" "} - {`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "} - - {`${commentsData?.workItem?.workArea?.areaName}`} - - {` ${commentsData?.workItem?.activityMaster?.activityName}`} +

Activity Summary

+

+ {comments && comments[0]?.comment} +

+

+ Assigned By : + + {commentsData?.assignedBy.firstName + + " " + + commentsData?.assignedBy.lastName} + {" "}

-
    - {comments && - comments?.map((data) => { - const fullName = `${data?.employee?.firstName} ${data?.employee?.lastName}`; - const bgClass = getBgClassFromHash(fullName); - return ( -
  • -
    -
    - - {`${data?.employee?.firstName?.slice( - 0, - 1 - )} ${data?.employee?.lastName?.slice(0, 1)}`} - -
    +

    + Loaction : + + {`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "} + {" "} + {`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "} + + {`${commentsData?.workItem?.workArea?.areaName}`} + + {` ${commentsData?.workItem?.activityMaster?.activityName}`} + +

    +

    + Planned Work: {commentsData?.plannedTask} +

    +

    + {" "} + Completed Work : {commentsData?.completedTask} +

    +
    +

    Team:

    +
    + {commentsData?.teamMembers?.map((member, idx) => ( + + + {member?.firstName + " " + member?.lastName} + + ))} +
    +
    -
    -

    {fullName}

    -

    - {moment.utc(data?.commentDate).local().fromNow()} -

    -
    -
    -

    - {data?.comment} -

    -
  • - ); - })} -
-
+ +