@@ -14,7 +14,7 @@ type Props = {
1414} ;
1515
1616const Contributions = ( props : Props ) => {
17- const [ selectedView , setSelectedView ] = useState < string > ( 'simple' ) ;
17+ const [ selectedTab , setSelectedTab ] = useState < string > ( 'simple' ) ;
1818 const [ exclude , setExclude ] = useState < boolean > ( false ) ;
1919 const [ apiResult , setApiResult ] = useState ( [ ] ) ;
2020
@@ -53,10 +53,10 @@ const Contributions = (props: Props) => {
5353 setExclude ( e . target . checked ) ;
5454 } ;
5555
56- const views = [
57- { id : 'simple' , name : 'Simple List' } ,
58- { id : 'repo' , name : 'Group By Repo' } ,
59- // { id : 'event', name : 'Group By Event' },
56+ const tabs = [
57+ { name : 'simple' , displayName : 'Simple List' } ,
58+ { name : 'repo' , displayName : 'Group By Repo' } ,
59+ // { name : 'event', displayName : 'Group By Event' },
6060 ] ;
6161
6262 return (
@@ -67,29 +67,29 @@ const Contributions = (props: Props) => {
6767 Exclude events related dependencies update
6868 </ label >
6969 < nav className = "flex flex-row sm:flex-row" >
70- { views . map ( ( view ) => {
70+ { tabs . map ( ( tab ) => {
7171 return (
72- < div key = { view . id } >
73- { selectedView == view . id ? (
72+ < div key = { tab . name } >
73+ { selectedTab == tab . name ? (
7474 < button className = "border-b-2 border-blue-500 py-4 px-6 font-medium text-blue-500 hover:text-blue-500 focus:outline-none" >
75- { view . name }
75+ { tab . displayName }
7676 </ button >
7777 ) : (
7878 < button
79- onClick = { ( ) => setSelectedView ( view . id ) }
79+ onClick = { ( ) => setSelectedTab ( tab . name ) }
8080 className = "py-4 px-6 text-gray-600 hover:text-blue-500 focus:outline-none"
8181 >
82- { view . name }
82+ { tab . displayName }
8383 </ button >
8484 ) }
8585 </ div >
8686 ) ;
8787 } ) }
8888 </ nav >
8989
90- { selectedView == 'simple' && < ContributionsSimple result = { apiResult } > </ ContributionsSimple > }
91- { selectedView == 'repo' && < ContributionsByRepo result = { apiResult } user = { props . user } > </ ContributionsByRepo > }
92- { /* {selectedView == 'event' && <ContributionsByEvent result={props.result}></ContributionsByEvent> } */ }
90+ { selectedTab == 'simple' && < ContributionsSimple result = { apiResult } > </ ContributionsSimple > }
91+ { selectedTab == 'repo' && < ContributionsByRepo result = { apiResult } user = { props . user } > </ ContributionsByRepo > }
92+ { /* {selectedTab == 'event' && <ContributionsByEvent result={props.result}></ContributionsByEvent> } */ }
9393 </ div >
9494 ) ;
9595} ;
0 commit comments