@@ -10,6 +10,7 @@ import {
1010 InputAdornment ,
1111 Popover ,
1212 SvgIcon ,
13+ Switch ,
1314 TextField ,
1415 Tooltip ,
1516 Typography ,
@@ -185,6 +186,7 @@ const getMarketOrder = (marketId: CustomMarket): number => {
185186export const MarketSwitcher = ( ) => {
186187 const [ anchorEl , setAnchorEl ] = useState < HTMLElement | null > ( null ) ;
187188 const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
189+ const [ showLegacy , setShowLegacy ] = useState ( false ) ;
188190 const searchRef = useRef < HTMLInputElement > ( null ) ;
189191 const open = Boolean ( anchorEl ) ;
190192
@@ -489,8 +491,13 @@ export const MarketSwitcher = () => {
489491 />
490492 </ Box >
491493
492- { /* Scrollable content */ }
493- < Box sx = { { overflowY : 'auto' , flex : 1 , pb : 1 } } >
494+ { /* Content (scrolls on mobile, extends on desktop) */ }
495+ < Box
496+ sx = { {
497+ pb : 1 ,
498+ ...( mobile && { overflowY : 'auto' , flex : 1 } ) ,
499+ } }
500+ >
494501 { /* Favourites */ }
495502 { pinned . length > 0 && (
496503 < Box >
@@ -520,7 +527,9 @@ export const MarketSwitcher = () => {
520527 < Box sx = { { display : 'flex' , flexWrap : 'wrap' , px : 1.5 } } >
521528 { ethereum . map ( ( id ) => renderGridItem ( id , mobile ) ) }
522529 </ Box >
523- < Divider sx = { { my : 1 } } />
530+ { ( other . length > 0 || l2 . length > 0 || ( showLegacy && legacy . length > 0 ) ) && (
531+ < Divider sx = { { my : 1 } } />
532+ ) }
524533 </ Box >
525534 ) }
526535
@@ -531,7 +540,7 @@ export const MarketSwitcher = () => {
531540 < Box sx = { { display : 'flex' , flexWrap : 'wrap' , px : 1.5 } } >
532541 { other . map ( ( id ) => renderGridItem ( id , mobile ) ) }
533542 </ Box >
534- < Divider sx = { { my : 1 } } />
543+ { ( l2 . length > 0 || ( showLegacy && legacy . length > 0 ) ) && < Divider sx = { { my : 1 } } /> }
535544 </ Box >
536545 ) }
537546
@@ -542,12 +551,12 @@ export const MarketSwitcher = () => {
542551 < Box sx = { { display : 'flex' , flexWrap : 'wrap' , px : 1.5 } } >
543552 { l2 . map ( ( id ) => renderGridItem ( id , mobile ) ) }
544553 </ Box >
545- < Divider sx = { { my : 1 } } />
554+ { showLegacy && legacy . length > 0 && < Divider sx = { { my : 1 } } /> }
546555 </ Box >
547556 ) }
548557
549558 { /* Legacy */ }
550- { legacy . length > 0 && (
559+ { showLegacy && legacy . length > 0 && (
551560 < Box >
552561 { sectionHeader ( < Trans > Legacy</ Trans > ) }
553562 < Box sx = { { display : 'flex' , flexWrap : 'wrap' , px : 1.5 } } >
@@ -565,6 +574,35 @@ export const MarketSwitcher = () => {
565574 </ Box >
566575 ) }
567576 </ Box >
577+
578+ { /* Legacy markets toggle */ }
579+ < Box
580+ sx = { {
581+ borderTop : '1px solid' ,
582+ borderColor : 'divider' ,
583+ px : '24px' ,
584+ py : 1 ,
585+ display : 'flex' ,
586+ alignItems : 'center' ,
587+ gap : 1 ,
588+ } }
589+ >
590+ < Typography
591+ sx = { {
592+ fontSize : '14px' ,
593+ fontWeight : 500 ,
594+ letterSpacing : '0.15px' ,
595+ color : 'text.secondary' ,
596+ } }
597+ >
598+ < Trans > Show legacy markets</ Trans >
599+ </ Typography >
600+ < Switch
601+ checked = { showLegacy }
602+ onChange = { ( e ) => setShowLegacy ( e . target . checked ) }
603+ inputProps = { { 'aria-label' : t `Show legacy markets` } }
604+ />
605+ </ Box >
568606 </ >
569607 ) ;
570608
@@ -722,7 +760,6 @@ export const MarketSwitcher = () => {
722760 elevation : 0 ,
723761 sx : {
724762 width : 535 ,
725- maxHeight : 520 ,
726763 overflow : 'hidden' ,
727764 display : 'flex' ,
728765 flexDirection : 'column' ,
0 commit comments