diff --git a/src/frontend/src/api/Project.js b/src/frontend/src/api/Project.js index dea540343b..78f5d41b31 100755 --- a/src/frontend/src/api/Project.js +++ b/src/frontend/src/api/Project.js @@ -144,9 +144,11 @@ export const GenerateProjectTiles = (url, payload) => { const generateProjectTiles = async (url, payload) => { try { const response = await CoreModules.axios.get(url); + console.log(response, 'response-mbtiles'); dispatch(GetTilesList(`${import.meta.env.VITE_API_URL}/projects/tiles_list/${payload}/`)); dispatch(ProjectActions.SetGenerateProjectTilesLoading(false)); } catch (error) { + console.log(error, 'error-mbtiles'); dispatch(ProjectActions.SetGenerateProjectTilesLoading(false)); } finally { dispatch(ProjectActions.SetGenerateProjectTilesLoading(false)); diff --git a/src/frontend/src/api/ProjectTaskStatus.js b/src/frontend/src/api/ProjectTaskStatus.js index 22ed5e0e64..2feb3b0207 100755 --- a/src/frontend/src/api/ProjectTaskStatus.js +++ b/src/frontend/src/api/ProjectTaskStatus.js @@ -14,12 +14,14 @@ const UpdateTaskStatus = (url, style, existingData, currentProjectId, feature, m const response = await CoreModules.axios.post(url, body, { params }); const findIndexForUpdation = existingData[index].taskBoundries.findIndex((obj) => obj.id == response.data.id); + console.log(response, 'response'); let project_tasks = [...existingData[index].taskBoundries]; project_tasks[findIndexForUpdation] = { ...response.data, task_status: task_priority_str[response.data.task_status], }; + console.log(project_tasks, 'project_tasks'); let updatedProject = [...existingData]; const finalProjectOBJ = { @@ -29,6 +31,7 @@ const UpdateTaskStatus = (url, style, existingData, currentProjectId, feature, m updatedProject[index] = finalProjectOBJ; dispatch(ProjectActions.SetProjectTaskBoundries(updatedProject)); + console.log(updatedProject, 'updatedProject'); await feature.setStyle(style); dispatch(CommonActions.SetLoading(false)); @@ -41,6 +44,7 @@ const UpdateTaskStatus = (url, style, existingData, currentProjectId, feature, m }), ); } catch (error) { + console.log(error, 'error'); dispatch(CommonActions.SetLoading(false)); dispatch( HomeActions.SetSnackBar({ diff --git a/src/frontend/src/utilities/CustomDrawer.jsx b/src/frontend/src/utilities/CustomDrawer.jsx index 5780fcccce..f37573ba8b 100644 --- a/src/frontend/src/utilities/CustomDrawer.jsx +++ b/src/frontend/src/utilities/CustomDrawer.jsx @@ -9,34 +9,12 @@ import { createLoginWindow, revokeCookie } from '@/utilfunctions/login'; import { CommonActions } from '@/store/slices/CommonSlice'; import { LoginActions } from '@/store/slices/LoginSlice'; import { ProjectActions } from '@/store/slices/ProjectSlice'; +import DebugConsole from '@/utilities/DebugConsole'; export default function CustomDrawer({ open, placement, size, type, onClose, onSignOut, setOpen }) { - const [showDebugConsole, setShowDebugConsole] = useState(false); - const [logs, setLogs] = useState([]); - useEffect(() => { - if (import.meta.env.MODE === 'development') { - // Override console.log to capture logs - const originalConsoleLog = console.log; - console.log = (...args) => { - originalConsoleLog.apply(console, args); - setLogs((prevLogs) => [ - ...prevLogs, - args.map((arg) => (typeof arg === 'object' ? JSON.stringify(arg) : arg)).join(' '), - ]); - }; - - // Restore original console.log when component unmounts - return () => { - console.log = originalConsoleLog; - }; - } - }, []); - const toggleDebugConsole = () => { - setShowDebugConsole((prev) => !prev); - }; - const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme); const dispatch = CoreModules.useAppDispatch(); + const [showDebugConsole, setShowDebugConsole] = useState(false); const onMouseEnter = (event) => { const element = document.getElementById(`text${event.target.id}`); @@ -138,33 +116,7 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS return (
- {import.meta.env.MODE === 'development' && ( -
-
- - {/* Display console logs */} - {logs.map((log, index) => ( -

{log}

- ))} -
-
- )} + diff --git a/src/frontend/src/utilities/DebugConsole.tsx b/src/frontend/src/utilities/DebugConsole.tsx new file mode 100644 index 0000000000..9b064f6d53 --- /dev/null +++ b/src/frontend/src/utilities/DebugConsole.tsx @@ -0,0 +1,51 @@ +import React, { useEffect, useState } from 'react'; + +type DebugConsolePropsType = { + showDebugConsole: boolean; + setShowDebugConsole: (showStatus: boolean) => void; +}; + +const DebugConsole = ({ showDebugConsole, setShowDebugConsole }: DebugConsolePropsType) => { + const [logs, setLogs] = useState([]); + useEffect(() => { + if (import.meta.env.MODE === 'development') { + // Override console.log to capture logs + const originalConsoleLog = console.log; + console.log = (...args) => { + originalConsoleLog.apply(console, args); + setLogs((prevLogs) => [ + ...prevLogs, + args.map((arg) => (typeof arg === 'object' ? JSON.stringify(arg) : arg)).join(' '), + ]); + }; + + // Restore original console.log when component unmounts + return () => { + console.log = originalConsoleLog; + }; + } + }, []); + + return ( +
+ {import.meta.env.MODE === 'development' && ( +
+
+ + {logs.map((log, index) => ( +

{log}

+ ))} +
+
+ )} +
+ ); +}; + +export default DebugConsole; diff --git a/src/frontend/src/views/ProjectDetailsV2.tsx b/src/frontend/src/views/ProjectDetailsV2.tsx index 1ac9f3ef10..52419a631a 100644 --- a/src/frontend/src/views/ProjectDetailsV2.tsx +++ b/src/frontend/src/views/ProjectDetailsV2.tsx @@ -42,6 +42,7 @@ import Comments from '@/components/ProjectDetailsV2/Comments'; import { Geolocation } from '@/utilfunctions/Geolocation'; import Instructions from '@/components/ProjectDetailsV2/Instructions'; import { readFileFromOPFS } from '@/api/Files'; +import DebugConsole from '@/utilities/DebugConsole'; const Home = () => { const dispatch = CoreModules.useAppDispatch(); @@ -237,9 +238,12 @@ const Home = () => { return () => {}; }, [projectOpfsBasemapPath]); + const [showDebugConsole, setShowDebugConsole] = useState(false); return (
+ {/* only used to display debug console */} + {/* Customized Modal For Generate Tiles */}
@@ -377,6 +381,15 @@ const Home = () => { windowSize.width <= 640 ? 'fmtm-h-[100vh]' : 'fmtm-h-full' }`} > + {import.meta.env.MODE === 'development' && ( +
+
+ )}