@@ -42,6 +42,31 @@ class Tab extends React.Component {
4242 }
4343 } ;
4444
45+ renderTabStatus = ( ) => {
46+ const { isNotSynced, tabCount } = this . props ;
47+ const { hovering } = this . state ;
48+
49+ if ( hovering && isNotSynced && tabCount === 1 ) {
50+ return < StyledNotSyncedIcon show = { 'true' } /> ;
51+ }
52+ if ( hovering && isNotSynced && tabCount > 1 ) {
53+ return < StyledCloseIcon onClick = { this . closeTab } show = { 'true' } /> ;
54+ }
55+ if ( hovering && tabCount === 1 ) {
56+ return < StyledCloseIcon onClick = { this . closeTab } show = { undefined } /> ;
57+ }
58+ if ( hovering && tabCount > 1 ) {
59+ return < StyledCloseIcon onClick = { this . closeTab } show = { 'true' } /> ;
60+ }
61+ if ( ! hovering && isNotSynced ) {
62+ return < StyledNotSyncedIcon show = { 'true' } /> ;
63+ }
64+ if ( ! hovering && ! isNotSynced ) {
65+ return < StyledNotSyncedIcon show = { undefined } /> ;
66+ }
67+ return < StyledNotSyncedIcon show = { undefined } /> ;
68+ } ;
69+
4570 render ( ) {
4671 const {
4772 active,
@@ -51,13 +76,10 @@ class Tab extends React.Component {
5176 onDoubleClick,
5277 module,
5378 dirName,
54- tabCount,
5579 hasError,
5680 isNotSynced,
5781 } = this . props ;
5882
59- const { hovering } = this . state ;
60-
6183 return (
6284 < Container
6385 active = { active }
@@ -76,17 +98,8 @@ class Tab extends React.Component {
7698 />
7799 < TabTitle > { module . title } </ TabTitle >
78100 { dirName && < TabDir > ../{ dirName } </ TabDir > }
79- { this . props . closeTab && isNotSynced ? (
80- < StyledNotSyncedIcon
81- onClick = { tabCount > 1 ? this . closeTab : null }
82- show = { 'true' }
83- />
84- ) : (
85- < StyledCloseIcon
86- onClick = { this . closeTab }
87- show = { tabCount > 1 && ( active || hovering ) ? 'true' : undefined }
88- />
89- ) }
101+
102+ { this . renderTabStatus ( ) }
90103 </ Container >
91104 ) ;
92105 }
0 commit comments