@@ -24,6 +24,11 @@ interface INewSandboxModalProps {
2424 signals : any ;
2525}
2626
27+ interface ITab {
28+ name : string ;
29+ tabIndex : number ;
30+ }
31+
2732export const NewSandboxModal = inject ( 'store' , 'signals' ) (
2833 hooksObserver (
2934 ( {
@@ -34,7 +39,7 @@ export const NewSandboxModal = inject('store', 'signals')(
3439 } : INewSandboxModalProps ) => {
3540 const [ selectedTab , setSelectedTab ] = useState ( 0 ) ;
3641
37- const tabs = [
42+ const tabs : ITab [ ] = [
3843 'Overview' ,
3944 user && 'My Templates' ,
4045 'Client Templates' ,
@@ -47,9 +52,8 @@ export const NewSandboxModal = inject('store', 'signals')(
4752 } ) )
4853 . filter ( ( { name } ) => Boolean ( name ) ) ;
4954
50- const selectTab = ( tabIndex : number ) => {
51- const tab = tabs [ tabIndex ] ;
52- setSelectedTab ( tabIndex ) ;
55+ const selectTab = ( tab : ITab ) => {
56+ setSelectedTab ( tab . tabIndex ) ;
5357
5458 track ( 'New Sandbox Modal - Open Tab' , { tabName : tab . name } ) ;
5559 } ;
@@ -62,13 +66,13 @@ export const NewSandboxModal = inject('store', 'signals')(
6266 return (
6367 < Container closing = { closing } forking = { forking } >
6468 < TabContainer forking = { forking } closing = { closing } >
65- { tabs . map ( ( { name , tabIndex } ) => (
69+ { tabs . map ( tab => (
6670 < Button
6771 key = { name }
6872 onClick = { ( ) => {
69- selectTab ( tabIndex ) ;
73+ selectTab ( tab ) ;
7074 } }
71- selected = { selectedTab === tabIndex }
75+ selected = { selectedTab === tab . tabIndex }
7276 >
7377 { name }
7478 </ Button >
0 commit comments