-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1396 from NSUWAL123/test-project-details-mobile
Test project details mobile
- Loading branch information
Showing
5 changed files
with
73 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div> | ||
{import.meta.env.MODE === 'development' && ( | ||
<div> | ||
<div | ||
className={`fmtm-fixed fmtm-bottom-0 fmtm-w-full fmtm-h-[33vh] fmtm-bg-white fmtm-border fmtm-px-4 fmtm-py-8 fmtm-flex-col fmtm-z-[1000] fmtm-overflow-y-auto ${ | ||
showDebugConsole ? '!fmtm-flex' : '!fmtm-hidden' | ||
}`} | ||
> | ||
<button style={{ alignSelf: 'flex-end', marginBottom: '10px' }} onClick={() => setShowDebugConsole(false)}> | ||
Close | ||
</button> | ||
{logs.map((log, index) => ( | ||
<p key={index}>{log}</p> | ||
))} | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DebugConsole; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters