Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable deleting levelbuilder-specified libraries #33941

Merged
merged 2 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"builtOnCodeStudio": "Built on Code Studio",
"by": "By",
"cancel": "Cancel",
"cannotDeleteLibrary": "You cannot delete preset libraries",
"cannotDeleteUsedImage": "You cannot delete images that are currently used in your project",
"catActions": "Actions",
"catColour": "Color",
Expand Down
16 changes: 15 additions & 1 deletion apps/src/code-studio/components/libraries/LibraryListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ const styles = {
':hover': {
color: color.white,
backgroundColor: color.dark_red
},
':disabled': {
color: color.light_gray,
borderColor: color.light_gray,
backgroundColor: color.lightest_gray,
cursor: 'default'
}
}
};
Expand Down Expand Up @@ -141,12 +147,20 @@ export class LibraryListItem extends React.Component {
</button>
)}
{this.props.onRemove && (
<Tooltip text={i18n.removeFromProject()} place="bottom">
<Tooltip
text={
library.fromLevelbuilder
? i18n.cannotDeleteLibrary()
: i18n.removeFromProject()
}
place="bottom"
>
<button
type="button"
key={'remove-' + library.id}
onClick={() => this.props.onRemove(library.name)}
style={[styles.actionBtn, styles.removeBtn]}
disabled={!!library.fromLevelbuilder}
>
<FontAwesome icon="trash-o" style={styles.iconPadding} />
</button>
Expand Down