diff --git a/client/components/__test__/FileNode.test.jsx b/client/components/__test__/FileNode.test.jsx
index 8b72261d..b70ebf14 100644
--- a/client/components/__test__/FileNode.test.jsx
+++ b/client/components/__test__/FileNode.test.jsx
@@ -24,6 +24,7 @@ describe('', () => {
showFolderChildren: jest.fn(),
hideFolderChildren: jest.fn(),
canEdit: true,
+ authenticated: false
};
component = shallow();
});
diff --git a/client/modules/IDE/components/FileNode.jsx b/client/modules/IDE/components/FileNode.jsx
index 772b23c4..62e4db3e 100644
--- a/client/modules/IDE/components/FileNode.jsx
+++ b/client/modules/IDE/components/FileNode.jsx
@@ -87,6 +87,11 @@ export class FileNode extends React.Component {
setTimeout(() => this.hideFileOptions(), 0);
}
+ handleClickUploadFile = () => {
+ this.props.openUploadFileModal(this.props.id);
+ setTimeout(this.hideFileOptions, 0);
+ }
+
handleClickDelete = () => {
if (window.confirm(`Are you sure you want to delete ${this.props.name}?`)) {
this.setState({ isDeleting: true });
@@ -252,19 +257,18 @@ export class FileNode extends React.Component {
Create file
-
-
-
+ { this.props.authenticated &&
+
+
+
+ }
}
@@ -318,7 +322,8 @@ FileNode.propTypes = {
showFolderChildren: PropTypes.func.isRequired,
hideFolderChildren: PropTypes.func.isRequired,
canEdit: PropTypes.bool.isRequired,
- openUploadFileModal: PropTypes.func.isRequired
+ openUploadFileModal: PropTypes.func.isRequired,
+ authenticated: PropTypes.bool.isRequired
};
FileNode.defaultProps = {
@@ -329,7 +334,8 @@ FileNode.defaultProps = {
function mapStateToProps(state, ownProps) {
// this is a hack, state is updated before ownProps
- return state.files.find(file => file.id === ownProps.id) || { name: 'test', fileType: 'file' };
+ const fileNode = state.files.find(file => file.id === ownProps.id) || { name: 'test', fileType: 'file' };
+ return Object.assign({}, fileNode, { authenticated: state.user.authenticated });
}
function mapDispatchToProps(dispatch) {