diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index b9a0fd8..f2f812a 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -7,7 +7,6 @@ import { CardScheduleHealthPerDivision, } from "../../components/CardDashboard/CardDashboard"; import L from "leaflet"; -import { useParams } from "react-router-dom"; import "../../assets/css/customscroll.css"; import moment from "moment"; import { renderFormatRupiah } from "../../const/CustomFunc"; @@ -31,7 +30,7 @@ import { } from "./Components"; import { Fab, Action } from "react-tiny-fab"; import "react-tiny-fab/dist/styles.css"; -import { useHistory } from "react-router-dom"; +import { useHistory, useLocation, useParams } from "react-router-dom"; const { TextArea } = Input; @@ -126,8 +125,9 @@ const DashboardProject = () => { const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [calculationStatus, setCalculationStatus] = useState(false); const [isHierarchy, setIsHierarchy] = useState(false); - const [isScurve, setIsScurve] = useState(false); let history = useHistory(); + let location = useLocation(); + const isDashboardProject = location.pathname.includes('dashboard-project'); useEffect(() => { getProjectDetail(); @@ -137,12 +137,6 @@ const DashboardProject = () => { getComments(); getGantt(); getGanttParents(); - const currentURL = window.location.href; - if (currentURL.includes("dashboard-project")) { - setIsScurve(true); - } else { - setIsScurve(false); - } return () => { console.log("unmount RenderMap"); }; @@ -1025,7 +1019,7 @@ const DashboardProject = () => { - +
{
- {isScurve === true ? ( + {isDashboardProject ? (
{ - {isScurve === true ? ( + {isDashboardProject ? (