11"use client" ;
22
33import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors" ;
4- import { useHeightObserver } from "@/components/ui/DynamicHeight " ;
4+ import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow " ;
55import { Spinner } from "@/components/ui/Spinner/Spinner" ;
66import { Alert , AlertDescription , AlertTitle } from "@/components/ui/alert" ;
77import { Badge } from "@/components/ui/badge" ;
@@ -195,11 +195,6 @@ export function BlueprintPlaygroundUI(props: {
195195 props . onRun ( url ) ;
196196 }
197197
198- // This allows us to always limit the grid height to whatever is the height of left section on desktop
199- // so that entire left section is always visible, but the right section has a scrollbar if it exceeds the height of left section
200- const { height, elementRef : leftSectionRef } = useHeightObserver ( ) ;
201- const isMobile = useIsMobileViewport ( ) ;
202-
203198 return (
204199 < Form { ...form } >
205200 < form onSubmit = { form . handleSubmit ( onSubmit ) } >
@@ -240,10 +235,7 @@ export function BlueprintPlaygroundUI(props: {
240235 clientId = { props . clientId }
241236 />
242237 < div className = "grid grow grid-cols-1 lg:grid-cols-2" >
243- < div
244- className = "flex grow flex-col max-sm:border-b lg:border-r"
245- ref = { leftSectionRef }
246- >
238+ < div className = "flex max-h-[500px] grow flex-col max-sm:border-b lg:max-h-[740px] lg:border-r" >
247239 < RequestConfigSection
248240 domain = { props . domain }
249241 parameters = { parameters }
@@ -253,12 +245,7 @@ export function BlueprintPlaygroundUI(props: {
253245 />
254246 </ div >
255247
256- < div
257- className = "flex min-h-[500px] grow flex-col lg:min-h-[740px]"
258- style = { {
259- height : ! isMobile && height ? `${ height } px` : "auto" ,
260- } }
261- >
248+ < div className = "flex h-[500px] grow flex-col lg:h-[740px]" >
262249 < ResponseSection
263250 isPending = { props . isPending }
264251 response = { props . response }
@@ -417,35 +404,37 @@ function RequestConfigSection(props: {
417404 const queryParams = props . parameters . filter ( ( param ) => param . in === "query" ) ;
418405
419406 return (
420- < div className = "flex grow flex-col" >
407+ < div className = "flex grow flex-col overflow-hidden " >
421408 < div className = "flex min-h-[60px] items-center gap-2 border-b p-4 text-sm" >
422409 < ArrowUpRightIcon className = "size-5" />
423410 Request
424411 </ div >
425412
426- { pathVariables . length > 0 && (
427- < ParameterSection
428- parameters = { pathVariables }
429- title = "Path Variables"
430- form = { props . form }
431- domain = { props . domain }
432- path = { props . path }
433- supportedChainIds = { props . supportedChainIds }
434- />
435- ) }
413+ < ScrollShadow className = "flex-1" scrollableClassName = "max-h-full" >
414+ { pathVariables . length > 0 && (
415+ < ParameterSection
416+ parameters = { pathVariables }
417+ title = "Path Variables"
418+ form = { props . form }
419+ domain = { props . domain }
420+ path = { props . path }
421+ supportedChainIds = { props . supportedChainIds }
422+ />
423+ ) }
436424
437- { pathVariables . length > 0 && queryParams . length > 0 && < Separator /> }
425+ { pathVariables . length > 0 && queryParams . length > 0 && < Separator /> }
438426
439- { queryParams . length > 0 && (
440- < ParameterSection
441- parameters = { queryParams }
442- title = "Query Parameters"
443- form = { props . form }
444- domain = { props . domain }
445- path = { props . path }
446- supportedChainIds = { props . supportedChainIds }
447- />
448- ) }
427+ { queryParams . length > 0 && (
428+ < ParameterSection
429+ parameters = { queryParams }
430+ title = "Query Parameters"
431+ form = { props . form }
432+ domain = { props . domain }
433+ path = { props . path }
434+ supportedChainIds = { props . supportedChainIds }
435+ />
436+ ) }
437+ </ ScrollShadow >
449438 </ div >
450439 ) ;
451440}
@@ -758,22 +747,3 @@ function ElapsedTimeCounter() {
758747 </ span >
759748 ) ;
760749}
761-
762- const isMobileMedia = ( ) => {
763- if ( typeof window === "undefined" ) return false ;
764- return window . matchMedia ( "(max-width: 640px)" ) . matches ;
765- } ;
766-
767- function useIsMobileViewport ( ) {
768- const [ state , setState ] = useState ( isMobileMedia ) ;
769-
770- // eslint-disable-next-line no-restricted-syntax
771- useEffect ( ( ) => {
772- if ( typeof window === "undefined" ) return ;
773- const handleResize = ( ) => setState ( isMobileMedia ( ) ) ;
774- window . addEventListener ( "resize" , handleResize ) ;
775- return ( ) => window . removeEventListener ( "resize" , handleResize ) ;
776- } , [ ] ) ;
777-
778- return state ;
779- }
0 commit comments