From 655967746ff97eeba7311f5d95c89a762bb02f85 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Wed, 30 Apr 2025 16:03:48 +0530 Subject: [PATCH] handle modal visibility with React state instead of Bootstrap --- .../Project/Infrastructure/WorkItem.jsx | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/components/Project/Infrastructure/WorkItem.jsx b/src/components/Project/Infrastructure/WorkItem.jsx index ae279024..ab85c28d 100644 --- a/src/components/Project/Infrastructure/WorkItem.jsx +++ b/src/components/Project/Infrastructure/WorkItem.jsx @@ -2,7 +2,6 @@ import React, { useState, useEffect } from "react"; import { useModal } from "../../../ModalContext"; import AssignRoleModel from "../AssignRole"; import { useParams } from "react-router-dom"; -import GlobalModel from "../../common/GlobalModel"; const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { const { projectId } = useParams(); @@ -22,7 +21,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { useEffect(() => { setNewWorkItem(workItem); - }, [workItem]); // This hook will run whenever the workItem prop changes + }, [workItem]); let assigndata = { building: forBuilding, @@ -33,22 +32,24 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { const hasWorkItem = NewWorkItem && NewWorkItem; useEffect(() => { - const tooltipTriggerList = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]')); + const tooltipTriggerList = Array.from( + document.querySelectorAll('[data-bs-toggle="tooltip"]') + ); tooltipTriggerList.forEach((el) => new bootstrap.Tooltip(el)); }, []); - return ( <> - - + + @@ -75,7 +76,6 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { {NewWorkItem?.workItem?.completedWork} - {/* ************************************************ */}
{ >
- {/* for greather than mobile view */}
{!projectId && ( @@ -134,14 +133,16 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { type="button" className="btn p-0 dropdown-toggle hide-arrow" > - + data-bs-original-title="Delete Activity" + >
- {/* for mobile view */}
{ {" "} - Delete + Delete - {!projectId && ( - {" "} - Assign - )} + {!projectId && ( + + {" "} + Assign + + )}