@@ -5,6 +5,15 @@ import BasePreview from 'app/components/Preview';
55import CodeEditor from 'app/components/CodeEditor' ;
66import type { Editor , Settings } from 'app/components/CodeEditor/types' ;
77import Tab from 'app/pages/Sandbox/Editor/Content/Tabs/Tab' ;
8+ import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons' ;
9+ import getType from 'app/utils/get-type' ;
10+
11+ import { StyledNotSyncedIcon } from 'app/pages/Sandbox/Editor/Content/Tabs/ModuleTab/elements' ;
12+ import {
13+ TabTitle ,
14+ TabDir ,
15+ StyledCloseIcon ,
16+ } from 'app/pages/Sandbox/Editor/Content/Tabs/Tab/elements' ;
817
918import DevTools from 'app/components/Preview/DevTools' ;
1019
@@ -77,6 +86,30 @@ export default class Content extends React.PureComponent<Props, State> {
7786 this . errors = [ ] ;
7887 }
7988
89+ renderTabStatus = ( hovering , closeTab ) => {
90+ const { isNotSynced, tabCount } = this . props ;
91+
92+ if ( hovering && isNotSynced && tabCount === 1 ) {
93+ return < StyledNotSyncedIcon show = { 'true' } / > ;
94+ }
95+ if ( hovering && isNotSynced && tabCount > 1 ) {
96+ return < StyledCloseIcon onClick = { closeTab } show = { 'true' } /> ;
97+ }
98+ if ( hovering && tabCount === 1 ) {
99+ return < StyledCloseIcon onClick = { closeTab } show = { undefined } /> ;
100+ }
101+ if ( hovering && tabCount > 1 ) {
102+ return < StyledCloseIcon onClick = { closeTab } show = { 'true' } /> ;
103+ }
104+ if ( ! hovering && isNotSynced ) {
105+ return < StyledNotSyncedIcon show = { 'true' } /> ;
106+ }
107+ if ( ! hovering && ! isNotSynced ) {
108+ return < StyledNotSyncedIcon show = { undefined } /> ;
109+ }
110+ return < StyledNotSyncedIcon show = { undefined } /> ;
111+ } ;
112+
80113 errors: Array < ModuleError > ;
81114 editor: ?Editor ;
82115 preview: ?BasePreview ;
@@ -326,7 +359,18 @@ export default class Content extends React.PureComponent<Props, State> {
326359 position = { i }
327360 closeTab = { this . closeTab }
328361 dirName = { dirName }
329- />
362+ >
363+ { ( { hovering, closeTab } ) => (
364+ // TODO deduplicate this
365+ < React . Fragment >
366+ < EntryIcons type = { getType ( module . title ) } />
367+ < TabTitle > { module . title } </ TabTitle >
368+ { dirName && < TabDir > ../{ dirName } </ TabDir > }
369+
370+ { this . renderTabStatus ( hovering , closeTab ) }
371+ </ React . Fragment >
372+ ) }
373+ </ Tab >
330374 ) ;
331375 } ) }
332376 </ Tabs >
0 commit comments