@@ -11,10 +11,11 @@ import styled from 'styled-components';
1111
1212import chrome from 'ui/chrome' ;
1313import { MainRouteParams } from '../../common/types' ;
14- import { RootState } from '../../reducers' ;
1514import { ShortcutsProvider } from '../shortcuts' ;
1615import { Content } from './content' ;
1716import { SideTabs } from './side_tabs' ;
17+ import { structureSelector } from '../../selectors' ;
18+ import { RootState } from '../../reducers' ;
1819
1920const Root = styled . div `
2021 position: absolute;
@@ -34,6 +35,7 @@ const Container = styled.div`
3435interface Props extends RouteComponentProps < MainRouteParams > {
3536 loadingFileTree : boolean ;
3637 loadingStructureTree : boolean ;
38+ hasStructure : boolean ;
3739}
3840
3941class CodeMain extends React . Component < Props > {
@@ -56,14 +58,15 @@ class CodeMain extends React.Component<Props> {
5658 }
5759
5860 public render ( ) {
59- const { loadingFileTree, loadingStructureTree } = this . props ;
61+ const { loadingFileTree, loadingStructureTree, hasStructure } = this . props ;
6062 return (
6163 < Root >
6264 < Container >
6365 < React . Fragment >
6466 < SideTabs
6567 loadingFileTree = { loadingFileTree }
6668 loadingStructureTree = { loadingStructureTree }
69+ hasStructure = { hasStructure }
6770 />
6871 < Content />
6972 </ React . Fragment >
@@ -77,9 +80,7 @@ class CodeMain extends React.Component<Props> {
7780const mapStateToProps = ( state : RootState ) => ( {
7881 loadingFileTree : state . file . loading ,
7982 loadingStructureTree : state . symbol . loading ,
83+ hasStructure : structureSelector ( state ) . length > 0 && ! state . symbol . error ,
8084} ) ;
8185
82- export const Main = connect (
83- mapStateToProps
84- // @ts -ignore
85- ) ( CodeMain ) ;
86+ export const Main = connect ( mapStateToProps ) ( CodeMain ) ;
0 commit comments