clean up ideview page

This commit is contained in:
Cassie Tarakajian 2017-11-13 14:44:23 -05:00
parent 9c655122b2
commit 9f9b09b99d

View file

@ -3,7 +3,6 @@ import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
import SplitPane from 'react-split-pane'; import SplitPane from 'react-split-pane';
import Editor from '../components/Editor'; import Editor from '../components/Editor';
import Sidebar from '../components/Sidebar'; import Sidebar from '../components/Sidebar';
@ -406,131 +405,93 @@ class IDEView extends React.Component {
</SplitPane> </SplitPane>
</SplitPane> </SplitPane>
</div> </div>
{(() => { { this.props.ide.modalIsVisible &&
if (this.props.ide.modalIsVisible) { <NewFileModal
return ( canUploadMedia={this.props.user.authenticated}
<NewFileModal closeModal={this.props.closeNewFileModal}
canUploadMedia={this.props.user.authenticated} createFile={this.props.createFile}
closeModal={this.props.closeNewFileModal} />
createFile={this.props.createFile} }
/> { this.props.ide.newFolderModalVisible &&
); <NewFolderModal
} closeModal={this.props.closeNewFolderModal}
return ''; createFolder={this.props.createFolder}
})()} />
{(() => { }
if (this.props.ide.newFolderModalVisible) { { this.props.location.pathname.match(/sketches$/) &&
return ( <Overlay
<NewFolderModal ariaLabel="project list"
closeModal={this.props.closeNewFolderModal} title="Open a Sketch"
createFolder={this.props.createFolder} previousPath={this.props.ide.previousPath}
/> >
); <SketchList
} username={this.props.params.username}
return ''; user={this.props.user}
})()} />
{(() => { // eslint-disable-line </Overlay>
if (this.props.location.pathname.match(/sketches$/)) { }
return ( { this.props.location.pathname.match(/assets$/) &&
<Overlay <Overlay
ariaLabel="project list" title="Assets"
title="Open a Sketch" ariaLabel="asset list"
previousPath={this.props.ide.previousPath} previousPath={this.props.ide.previousPath}
> >
<SketchList <AssetList
username={this.props.params.username} username={this.props.params.username}
user={this.props.user} user={this.props.user}
/> />
</Overlay> </Overlay>
); }
} { this.props.location.pathname === '/about' &&
})()} <Overlay
{(() => { // eslint-disable-line previousPath={this.props.ide.previousPath}
if (this.props.location.pathname.match(/assets$/)) { title="Welcome"
return ( ariaLabel="about"
<Overlay >
title="Assets" <About previousPath={this.props.ide.previousPath} />
ariaLabel="asset list" </Overlay>
previousPath={this.props.ide.previousPath} }
> { this.props.ide.shareModalVisible &&
<AssetList <Overlay
username={this.props.params.username} title="Share This Sketch"
user={this.props.user} ariaLabel="share"
/> closeOverlay={this.props.closeShareModal}
</Overlay> >
); <ShareModal
} projectId={this.props.project.id}
})()} projectName={this.props.project.name}
{(() => { // eslint-disable-line ownerUsername={this.props.project.owner.username}
if (this.props.location.pathname === '/about') { />
return ( </Overlay>
<Overlay }
previousPath={this.props.ide.previousPath} { this.props.ide.keyboardShortcutVisible &&
title="Welcome" <Overlay
ariaLabel="about" title="Keyboard Shortcuts"
> ariaLabel="keyboard shortcuts"
<About previousPath={this.props.ide.previousPath} /> closeOverlay={this.props.closeKeyboardShortcutModal}
</Overlay> >
); <KeyboardShortcutModal />
} </Overlay>
})()} }
{(() => { // eslint-disable-line { this.props.ide.errorType &&
if (this.props.ide.shareModalVisible) { <Overlay
return ( title="Error"
<Overlay ariaLabel="error"
title="Share This Sketch" closeOverlay={this.props.hideErrorModal}
ariaLabel="share" >
closeOverlay={this.props.closeShareModal} <ErrorModal
> type={this.props.ide.errorType}
<ShareModal />
projectId={this.props.project.id} </Overlay>
projectName={this.props.project.name} }
ownerUsername={this.props.project.owner.username} { this.props.ide.helpType &&
/> <Overlay
</Overlay> title="Serve over HTTPS"
); closeOverlay={this.props.hideHelpModal}
} >
})()} <HTTPSModal />
{(() => { // eslint-disable-line </Overlay>
if (this.props.ide.keyboardShortcutVisible) { }
return (
<Overlay
title="Keyboard Shortcuts"
ariaLabel="keyboard shortcuts"
closeOverlay={this.props.closeKeyboardShortcutModal}
>
<KeyboardShortcutModal />
</Overlay>
);
}
})()}
{(() => { // eslint-disable-line
if (this.props.ide.errorType) {
return (
<Overlay
title="Error"
ariaLabel="error"
closeOverlay={this.props.hideErrorModal}
>
<ErrorModal
type={this.props.ide.errorType}
/>
</Overlay>
);
}
})()}
{(() => { // eslint-disable-line
if (this.props.ide.helpType) {
return (
<Overlay
title="Serve over HTTPS"
closeOverlay={this.props.hideHelpModal}
>
<HTTPSModal />
</Overlay>
);
}
})()}
</div> </div>
); );
} }