11import { useEffect , useMemo , useRef , useState , useCallback } from "react" ;
22import type { MouseEvent } from "react" ;
3- import { useSetAtom } from "jotai" ;
3+ import { useAtomValue , useSetAtom } from "jotai" ;
44import { ToastProvider , ToastViewport } from "@humansignal/ui/lib/toast/toast" ;
55import { cnm } from "@humansignal/shad/utils" ;
66import { PreviewPanel } from "../PreviewPanel" ;
7- import { configAtom , loadingAtom , errorAtom , interfacesAtom } from "../../atoms/configAtoms" ;
7+ import { EditorPanel } from "../EditorPanel" ;
8+ import { TopBar } from "./TopBar" ;
9+ import { configAtom , loadingAtom , errorAtom , interfacesAtom , displayModeAtom } from "../../atoms/configAtoms" ;
810import {
911 getQueryParams ,
1012 replaceBrTagsWithNewlines ,
1113 getInterfacesFromParams ,
1214 throwUnlessXmlLike ,
1315} from "../../utils/query" ;
14- import { TopBar } from "./TopBar" ;
15- import { EditorPanel } from "../EditorPanel" ;
1616import styles from "./PlaygroundApp.module.scss" ;
1717
1818const DEFAULT_EDITOR_WIDTH_PERCENT = 50 ;
@@ -24,6 +24,7 @@ export const PlaygroundApp = () => {
2424 const setLoading = useSetAtom ( loadingAtom ) ;
2525 const setError = useSetAtom ( errorAtom ) ;
2626 const setInterfaces = useSetAtom ( interfacesAtom ) ;
27+ const displayMode = useAtomValue ( displayModeAtom ) ;
2728 const [ editorWidth , setEditorWidth ] = useState ( DEFAULT_EDITOR_WIDTH_PERCENT ) ;
2829 const dragging = useRef ( false ) ;
2930
@@ -118,26 +119,34 @@ export const PlaygroundApp = () => {
118119 >
119120 < ToastProvider >
120121 { /* Minimal top bar */ }
121- < TopBar />
122+ { displayMode !== "preview" && < TopBar /> }
122123 { /* Editor/Preview split */ }
123124 < div className = "flex flex-1 min-h-0 min-w-0 relative" >
124125 { /* Editor Panel */ }
125- < EditorPanel editorWidth = { editorWidth } />
126+ { displayMode !== "preview" && < EditorPanel editorWidth = { editorWidth } /> }
126127 { /* Resizable Divider */ }
127- < div
128- className = "w-2 cursor-col-resize bg-neutral-emphasis hover:bg-primary-border active:bg-primary-border transition-colors duration-100 z-10"
129- onMouseDown = { ( e : MouseEvent ) => {
130- if ( e . button !== 0 ) return ;
131- e . preventDefault ( ) ;
132- dragging . current = true ;
133- } }
134- onDoubleClick = { handleDividerDoubleClick }
135- role = "separator"
136- aria-orientation = "vertical"
137- tabIndex = { - 1 }
138- />
128+ { displayMode !== "preview" && (
129+ < div
130+ className = "w-2 cursor-col-resize bg-neutral-emphasis hover:bg-primary-border active:bg-primary-border transition-colors duration-100 z-10"
131+ onMouseDown = { ( e : MouseEvent ) => {
132+ if ( e . button !== 0 ) return ;
133+ e . preventDefault ( ) ;
134+ dragging . current = true ;
135+ } }
136+ onDoubleClick = { handleDividerDoubleClick }
137+ role = "separator"
138+ aria-orientation = "vertical"
139+ tabIndex = { - 1 }
140+ />
141+ ) }
142+
139143 { /* Preview Panel */ }
140- < div className = "flex flex-col min-w-0 h-full" style = { previewPanelStyle } >
144+ < div
145+ className = { cnm ( "flex flex-col min-w-0 h-full" , {
146+ "flex-row flex-1 w-full" : displayMode !== "all" ,
147+ } ) }
148+ style = { previewPanelStyle }
149+ >
141150 < div className = "flex-1 min-h-0 min-w-0" >
142151 < PreviewPanel />
143152 </ div >
0 commit comments