@@ -14,8 +14,8 @@ const Component = () => {
1414 const stackComponentsTypes : any [ ] = useSelector (
1515 stackComponentSelectors . stackComponentTypes ,
1616 ) ;
17-
18- const [ selectedComp , setSelectedComp ] = useState ( stackComponentsTypes ? stackComponentsTypes [ 0 ] : '' )
17+
18+ const [ selectedComp , setSelectedComp ] = useState ( window . location . href . split ( '/' ) [ 6 ] )
1919 const [ search , setSearch ] = useState ( '' )
2020
2121 useEffect ( ( ) => {
@@ -38,6 +38,18 @@ const Component = () => {
3838 return searchFil ( )
3939 } )
4040
41+ const formatText = ( text : string ) => {
42+ return text . charAt ( 0 ) . toUpperCase ( ) + text . slice ( 1 ) . replace ( '_' , ' ' )
43+ }
44+
45+ const formatSectionColor = ( text : string ) => {
46+ return selectedComp === text ? '#443E99' : '#fff'
47+ }
48+
49+ const formatTextColor = ( text : string ) => {
50+ return selectedComp === text ? '#fff' : '#443E99'
51+ }
52+
4153 return (
4254 < Box style = { { borderRight : '1px solid #A8A8A8' , padding : '0 50px 0 33px' , marginTop : '12rem' } } >
4355
@@ -49,70 +61,70 @@ const Component = () => {
4961 { stacks ?. map ( ( item : any , index : number ) => (
5062 < Box key = { index } >
5163 { item === 'artifact_store' && (
52- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , backgroundColor : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
64+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , backgroundColor : formatSectionColor ( item ) } } marginTop = 'sm' >
5365 < Box > < icons . artifact_store color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
54- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
66+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
5567 </ FlexBox >
5668 ) }
5769 { item === 'alerter' && (
58- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
70+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
5971 < Box > < icons . alerter color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
60- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
72+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
6173 </ FlexBox >
6274 ) }
6375 { item === 'annotator' && (
64- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
65- < Box > < icons . annotator color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
66- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
76+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
77+ < Box > < icons . annotator color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
78+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
6779 </ FlexBox >
6880 ) }
6981 { item === 'container_registry' && (
70- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
82+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
7183 < Box > < icons . container_registry color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
72- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
84+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
7385 </ FlexBox >
7486 ) }
7587 { item === 'experiment_tracker' && (
76- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
88+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
7789 < Box > < icons . experiment_tracker color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
78- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
90+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
7991 </ FlexBox >
8092 ) }
8193
8294 { item === 'feature_store' && (
83- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
95+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
8496 < Box > < icons . feature_store color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
85- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
97+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
8698 </ FlexBox >
8799 ) }
88100 { item === 'model_deployer' && (
89- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
101+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
90102 < Box > < icons . model_deployer color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
91- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
103+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
92104 </ FlexBox >
93105 ) }
94106 { item === 'secrets_manager' && (
95- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
107+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
96108 < Box > < icons . secrets_manager color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
97- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
109+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
98110 </ FlexBox >
99111 ) }
100112 { item === 'orchestrator' && (
101- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
113+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
102114 < Box > < icons . orchestrator color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
103- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
115+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
104116 </ FlexBox >
105117 ) }
106118 { item === 'step_operator' && (
107- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
119+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
108120 < Box > < icons . step_operator color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
109- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
121+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
110122 </ FlexBox >
111123 ) }
112124 { item === 'data_validator' && (
113- < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : selectedComp === item ? '#443E99' : '#fff' } } marginTop = 'sm' >
125+ < FlexBox onClick = { ( ) => selectSection ( item ) } style = { { ...sectionStyle , background : formatSectionColor ( item ) } } marginTop = 'sm' >
114126 < Box > < icons . data_validator color = { selectedComp === item ? iconColors . white : iconColors . primary } size = { iconSizes . md } /> </ Box >
115- < Box > < Paragraph style = { { color : selectedComp === item ? '#fff' : '#443E99' , ...textStyle } } > { item . replace ( '_' , ' ' ) } </ Paragraph > </ Box >
127+ < Box > < Paragraph style = { { color : formatTextColor ( item ) , ...textStyle } } > { formatText ( item ) } </ Paragraph > </ Box >
116128 </ FlexBox >
117129 ) }
118130 </ Box >
0 commit comments