Merge branch 'nimishagarwal76-blur_file_menu'
This commit is contained in:
commit
8bd698a8fe
3 changed files with 22 additions and 7 deletions
|
@ -65,6 +65,9 @@ export class FileNode extends React.Component {
|
|||
|
||||
toggleFileOptions(e) {
|
||||
e.preventDefault();
|
||||
if (!this.props.canEdit) {
|
||||
return;
|
||||
}
|
||||
if (this.state.isOptionsOpen) {
|
||||
this.setState({ isOptionsOpen: false });
|
||||
} else {
|
||||
|
@ -88,7 +91,7 @@ export class FileNode extends React.Component {
|
|||
renderChild(childId) {
|
||||
return (
|
||||
<li key={childId}>
|
||||
<ConnectedFileNode id={childId} parentId={this.props.id} />
|
||||
<ConnectedFileNode id={childId} parentId={this.props.id} canEdit={this.props.canEdit} />
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
@ -250,7 +253,8 @@ FileNode.propTypes = {
|
|||
newFile: PropTypes.func.isRequired,
|
||||
newFolder: PropTypes.func.isRequired,
|
||||
showFolderChildren: PropTypes.func.isRequired,
|
||||
hideFolderChildren: PropTypes.func.isRequired
|
||||
hideFolderChildren: PropTypes.func.isRequired,
|
||||
canEdit: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
FileNode.defaultProps = {
|
||||
|
@ -261,8 +265,7 @@ FileNode.defaultProps = {
|
|||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
// this is a hack, state is updated before ownProps
|
||||
return state.files.find(file => file.id === ownProps.id) || { ...ownProps, name: 'test', fileType: 'file' };
|
||||
// return state.files.find(file => file.id === ownProps.id);
|
||||
return state.files.find(file => file.id === ownProps.id) || { name: 'test', fileType: 'file' };
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
|
|
|
@ -41,11 +41,12 @@ class Sidebar extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const canEditProject = this.userCanEditProject();
|
||||
const sidebarClass = classNames({
|
||||
'sidebar': true,
|
||||
'sidebar--contracted': !this.props.isExpanded,
|
||||
'sidebar--project-options': this.props.projectOptionsVisible,
|
||||
'sidebar--cant-edit': !this.userCanEditProject()
|
||||
'sidebar--cant-edit': !canEditProject
|
||||
});
|
||||
|
||||
return (
|
||||
|
@ -82,7 +83,10 @@ class Sidebar extends React.Component {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<ConnectedFileNode id={this.props.files.filter(file => file.name === 'root')[0].id} />
|
||||
<ConnectedFileNode
|
||||
id={this.props.files.filter(file => file.name === 'root')[0].id}
|
||||
canEdit={canEditProject}
|
||||
/>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@
|
|||
@include icon();
|
||||
@include themify() {
|
||||
padding: #{4 / $base-font-size}rem 0;
|
||||
background-color: map-get($theme-map, 'file-selected-color');
|
||||
padding-right: #{6 / $base-font-size}rem;
|
||||
}
|
||||
display: none;
|
||||
|
@ -137,9 +136,18 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
.sidebar__file-item:hover > .file-item__content & {
|
||||
display: inline-block;
|
||||
.sidebar--cant-edit & {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
& svg {
|
||||
width: #{10 / $base-font-size}rem;
|
||||
}
|
||||
.sidebar__file-item--open > .file-item__content & {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar__file-item-options {
|
||||
|
|
Loading…
Reference in a new issue