11'use client' ;
22import React , { useEffect , useState , useRef , useMemo } from 'react' ;
33import { usePathname } from 'next/navigation' ;
4- import Loader from '@/components/CustomLoaders/Loader' ;
54import { Button } from '@nextui-org/react' ;
6- import CustomImage from '@/components/ImageComponents/CustomImage' ;
75import imagePath from '@/app/imagePath' ;
6+ import Loader from '@/components/CustomLoaders/Loader' ;
7+ import CustomImage from '@/components/ImageComponents/CustomImage' ;
88import CustomModal from '@/components/CustomModal/CustomModal' ;
99import CustomInput from '@/components/CustomInput/CustomInput' ;
1010import { createPullRequest } from '@/api/DashboardService' ;
1111import toast from 'react-hot-toast' ;
1212
1313export default function Code ( ) {
1414 const [ projectURL , setProjectURL ] = useState ( '' ) ;
15- const initialURL = useRef < string | null > ( null ) ;
16- const iframeRef = useRef < HTMLIFrameElement | null > ( null ) ;
17- const pathName = usePathname ( ) ;
1815 const [ isIframeLoaded , setIsIframeLoaded ] = useState ( false ) ;
1916 const [ prTitle , setPRTitle ] = useState < string | null > ( '' ) ;
2017 const [ prDescription , setPRDescription ] = useState < string | null > ( '' ) ;
2118 const [ isCreatePRModalOpen , setIsCreatePRModalOpen ] = useState <
2219 boolean | null
2320 > ( false ) ;
21+ const initialURL = useRef < string | null > ( null ) ;
22+ const iframeRef = useRef < HTMLIFrameElement | null > ( null ) ;
23+ const pathName = usePathname ( ) ;
2424
2525 useEffect ( ( ) => {
2626 const storedURL = localStorage . getItem ( 'projectURL' ) ;
@@ -96,7 +96,7 @@ export default function Code() {
9696 title = { 'Embedded Workspace' }
9797 style = { {
9898 width : '100%' ,
99- height : 'calc(100vh - 92px )' ,
99+ height : 'calc(100vh - 50px )' ,
100100 border : 'none' ,
101101 position : pathName === '/code' ? 'relative' : 'absolute' ,
102102 top : pathName === '/code' ? '0' : '-9999px' ,
@@ -109,9 +109,11 @@ export default function Code() {
109109
110110 return (
111111 < div
112- className = { `relative ${
113- pathName !== '/code' && 'hidden'
114- } proxima_nova h-screen w-full`}
112+ className = {
113+ pathName !== '/code'
114+ ? 'invisible'
115+ : 'proxima_nova w-full` relative h-screen'
116+ }
115117 >
116118 < CustomModal
117119 isOpen = { isCreatePRModalOpen }
@@ -155,10 +157,11 @@ export default function Code() {
155157 </ CustomModal . Footer >
156158 </ CustomModal >
157159
158- < div className = { 'code_header pl-2' } >
160+ < div className = { pathName !== '/code' ? 'hidden' : 'code_header pl-2' } >
159161 < span className = { 'secondary_color text-[13px] font-semibold' } >
160162 Code Editor
161163 </ span >
164+
162165 < Button
163166 className = {
164167 'rounded-none bg-transparent px-3 text-[13px] font-semibold text-white hover:bg-gray-600'
@@ -175,8 +178,12 @@ export default function Code() {
175178 </ div >
176179
177180 { ! isIframeLoaded && pathName === '/code' && (
178- < div className = "absolute left-0 top-0 flex h-[720px] w-full items-center justify-center" >
179- < Loader size = { 120 } text = "Please wait..." />
181+ < div
182+ className = {
183+ 'absolute left-0 top-0 flex h-[720px] w-full items-center justify-center'
184+ }
185+ >
186+ < Loader size = { 120 } text = { 'Please wait...' } />
180187 </ div >
181188 ) }
182189 { iframeElement }
0 commit comments