11import ThemeIcon from "../../images/icons/menu/theme.svg" ;
22import PreviewIcon from "../../images/icons/menu/preview.svg" ;
33import React , { Component } from "react" ;
4- import { observer } from "mobx-react" ;
4+ import { inject , observer } from "mobx-react" ;
55import PropTypes from "prop-types" ;
66import className from "classnames" ;
77import ReactSVG from "react-svg" ;
88import Controls from "./controls/Controls.react" ;
9- import EditorStore from "../stores/EditorStore" ;
109
10+ @inject ( [ "editorStore" ] )
1111@observer
1212class AppHeader extends Component {
1313 static propTypes = {
14+ editorStore : PropTypes . object ,
1415 toggleTheme : PropTypes . func . isRequired ,
1516 togglePreview : PropTypes . func . isRequired ,
1617 isThemeToggled : PropTypes . bool . isRequired ,
1718 isPreviewToggled : PropTypes . bool . isRequired
1819 }
1920
2021 revealFolder = ( ) => {
21- if ( EditorStore . path !== "" ) {
22- require ( "opn" ) ( EditorStore . directory ) ;
22+ if ( this . props . editorStore . path ) {
23+ require ( "opn" ) ( this . props . editorStore . directory ) ;
2324 }
2425 }
2526
@@ -33,15 +34,15 @@ class AppHeader extends Component {
3334 } ) ;
3435
3536 const titleClasses = className ( "app-header-title" , {
36- "is-clickable" : EditorStore . path !== ""
37+ "is-clickable" : this . props . editorStore . path
3738 } ) ;
3839
3940 return (
4041 < div className = "app-header qilin-panel" >
4142 < Controls />
4243
4344 < div className = { titleClasses } onClick = { this . revealFolder } >
44- { EditorStore . filename }
45+ { this . props . editorStore . filename }
4546 </ div >
4647
4748 < div className = "app-header-buttons" >
0 commit comments