Share the replace project confirmation string between new and upload
This commit is contained in:
1 parent
ebd372a090
commit
4927e12e80
3 files changed
+11
-14
No files matched your search
@@ -67,13 +67,8 @@ import languageIcon from '../language-selector/language-icon.svg';
|
||||
|
||||
import scratchLogo from './scratch-logo.svg';
|
||||
|
||||
const messages = defineMessages({
|
||||
confirmNav: {
|
||||
id: 'gui.menuBar.confirmNewWithoutSaving',
|
||||
defaultMessage: 'Replace contents of the current project?',
|
||||
description: 'message for prompting user to confirm that they want to create new project without saving'
|
||||
}
|
||||
});
|
||||
import sharedMessages from '../../lib/shared-messages';
|
||||
|
||||
const ariaMessages = defineMessages({
|
||||
language: {
|
||||
id: 'gui.menuBar.LanguageSelector',
|
||||
@@ -173,7 +168,7 @@ class MenuBar extends React.Component {
|
||||
// they'll lose their work.
|
||||
if (this.props.projectChanged && !this.props.canCreateNew) {
|
||||
readyToReplaceProject = confirm( // eslint-disable-line no-alert
|
||||
this.props.intl.formatMessage(messages.confirmNav)
|
||||
this.props.intl.formatMessage(sharedMessages.replaceProjectWarning)
|
||||
);
|
||||
}
|
||||
this.props.onRequestCloseFile();
|
||||
|
||||
@@ -6,6 +6,8 @@ import {defineMessages, injectIntl, intlShape} from 'react-intl';
|
||||
|
||||
import analytics from '../lib/analytics';
|
||||
import log from '../lib/log';
|
||||
import sharedMessages from '../lib/shared-messages';
|
||||
|
||||
import {
|
||||
LoadingStates,
|
||||
getIsLoadingUpload,
|
||||
@@ -43,11 +45,6 @@ const messages = defineMessages({
|
||||
id: 'gui.projectLoader.loadError',
|
||||
defaultMessage: 'The project file that was selected failed to load.',
|
||||
description: 'An error that displays when a local project file fails to load.'
|
||||
},
|
||||
uploadWarning: {
|
||||
id: 'gui.projectLoader.uploadWarning',
|
||||
defaultMessage: 'Replace the contents of the current project?',
|
||||
description: 'A warning before uploading a file on top of another project.'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -109,7 +106,7 @@ class SBFileUploader extends React.Component {
|
||||
// has changed and is not showing with ID. If it has an ID, this operation
|
||||
// does not currently overwrite that project, so it is safe to do without confirmation.
|
||||
const uploadAllowed = (isShowingWithoutId && projectChanged) ?
|
||||
confirm(intl.formatMessage(messages.uploadWarning)) : // eslint-disable-line no-alert
|
||||
confirm(intl.formatMessage(sharedMessages.replaceProjectWarning)) : // eslint-disable-line no-alert
|
||||
true;
|
||||
|
||||
if (uploadAllowed) this.props.requestProjectUpload(loadingState);
|
||||
|
||||
@@ -20,5 +20,10 @@ export default defineMessages({
|
||||
defaultMessage: 'pop',
|
||||
description: 'Name of the pop sound, the default sound added to a sprite',
|
||||
id: 'gui.sharedMessages.pop'
|
||||
},
|
||||
replaceProjectWarning: {
|
||||
id: 'gui.sharedMessages.replaceProjectWarning',
|
||||
defaultMessage: 'Replace contents of the current project?',
|
||||
description: 'Confirmation that user wants to overwrite the current project contents'
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user