@@ -25,8 +25,7 @@ import { ExploreDataScope } from '@/types/explore-section/application';
25
25
import { VirtualLabInfo } from '@/types/virtual-lab/common' ;
26
26
import { ensureString } from '@/util/type-guards' ;
27
27
import { classNames } from '@/util/utils' ;
28
-
29
- const menuItemWidth = `${ Math . floor ( 100 / Object . keys ( EXPERIMENT_DATA_TYPES ) . length ) - 0.01 } %` ;
28
+ import { DataTypeGroup } from '@/types/explore-section/data-types' ;
30
29
31
30
const dataScope = ExploreDataScope . SelectedBrainRegion ;
32
31
@@ -60,14 +59,24 @@ export default function ExploreListingLayout({
60
59
children : ReactNode ;
61
60
virtualLabInfo ?: VirtualLabInfo ;
62
61
} ) {
63
- const [ , setCurrentExplorerArtifact ] = useCurrentExplorerArtifact ( ) ;
64
- const pathname = usePathname ( ) ;
65
- const splittedPathname = pathname . split ( '/' ) ;
66
- const interactivePageHref = splittedPathname . slice ( 0 , splittedPathname . length - 2 ) . join ( '/' ) ;
67
62
const router = useRouter ( ) ;
68
63
const params = useParams ( ) ;
69
- const config = pathname . includes ( 'experimental' ) ? EXPERIMENT_DATA_TYPES : MODEL_DATA_TYPES ;
64
+ const pathname = usePathname ( ) ;
65
+
70
66
const selectedBrainRegion = useAtomValue ( selectedBrainRegionAtom ) ;
67
+ const [ , setCurrentExplorerArtifact ] = useCurrentExplorerArtifact ( ) ;
68
+
69
+ const splittedPathname = pathname . split ( '/' ) ;
70
+ const interactivePageHref = splittedPathname . slice ( 0 , splittedPathname . length - 2 ) . join ( '/' ) ;
71
+
72
+ const dataTypeGroup = pathname . includes ( 'experimental' )
73
+ ? DataTypeGroup . ExperimentalData
74
+ : DataTypeGroup . ModelData ;
75
+
76
+ const config =
77
+ dataTypeGroup === DataTypeGroup . ExperimentalData ? EXPERIMENT_DATA_TYPES : MODEL_DATA_TYPES ;
78
+
79
+ const showCircuitMenu = dataTypeGroup === DataTypeGroup . ModelData ;
71
80
const activePath = pathname ?. split ( '/' ) . pop ( ) || 'morphology' ;
72
81
73
82
const onClick : MenuProps [ 'onClick' ] = async ( info ) => {
@@ -84,6 +93,9 @@ export default function ExploreListingLayout({
84
93
router . push ( key ) ;
85
94
} ;
86
95
96
+ const nMenuItems = Object . keys ( config ) . length + ( showCircuitMenu ? 1 : 0 ) ;
97
+ const menuItemWidth = `${ Math . floor ( 100 / nMenuItems ) - 0.04 } %` ;
98
+
87
99
const items : {
88
100
key : string ;
89
101
title : string ;
@@ -114,19 +126,21 @@ export default function ExploreListingLayout({
114
126
} ;
115
127
} ) ;
116
128
117
- const circuitActive = activePath === 'circuit' ;
118
-
119
- items . push ( {
120
- key : 'circuit' ,
121
- title : 'Circuit' ,
122
- label : `Circuit (${ circuitsFlat . length } )` ,
123
- className : 'text-center font-semibold' ,
124
- style : {
125
- backgroundColor : circuitActive ? 'white' : '#002766' ,
126
- color : circuitActive ? '#002766' : 'white' ,
127
- flexBasis : menuItemWidth ,
128
- } ,
129
- } ) ;
129
+ if ( showCircuitMenu ) {
130
+ const circuitActive = activePath === 'circuit' ;
131
+
132
+ items . push ( {
133
+ key : 'circuit' ,
134
+ title : 'Circuit' ,
135
+ label : `Circuit (${ circuitsFlat . length } )` ,
136
+ className : 'text-center font-semibold' ,
137
+ style : {
138
+ backgroundColor : circuitActive ? 'white' : '#002766' ,
139
+ color : circuitActive ? '#002766' : 'white' ,
140
+ flexBasis : menuItemWidth ,
141
+ } ,
142
+ } ) ;
143
+ }
130
144
131
145
if ( params ?. id )
132
146
return < ErrorBoundary FallbackComponent = { SimpleErrorComponent } > { children } </ ErrorBoundary > ;
@@ -136,14 +150,14 @@ export default function ExploreListingLayout({
136
150
< ErrorBoundary FallbackComponent = { SimpleErrorComponent } >
137
151
< BackToInteractiveExplorationBtn href = { interactivePageHref } />
138
152
139
- < div className = { classNames ( 'flex-1 overflow-hidden' ) } >
153
+ < div className = " overflow-x- hidden" >
140
154
< Menu
141
155
onClick = { onClick }
142
156
selectedKeys = { [ activePath ] }
143
157
mode = "horizontal"
144
158
theme = "dark"
145
159
style = { { backgroundColor : '#002766' } }
146
- className = "flex w-full justify-start"
160
+ className = "flex w-[calc(100%+6px)] justify-start"
147
161
items = { items }
148
162
/>
149
163
0 commit comments