Skip to content

Commit 7932dac

Browse files
committed
Merge remote-tracking branch 'origin/staging-next' into staging-next
2 parents 390a488 + 7c90b9c commit 7932dac

14 files changed

Lines changed: 33 additions & 62 deletions

File tree

apps/src/StudioApp.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -499,17 +499,24 @@ StudioApp.prototype.init = function (config) {
499499

500500
StudioApp.prototype.initProjectTemplateWorkspaceIconCallout = function () {
501501
if (getStore().getState().pageConstants.showProjectTemplateWorkspaceIcon) {
502-
addCallouts([{
503-
id: 'projectTemplateWorkspaceIconCallout',
504-
element_id: '#projectTemplateWorkspaceIcon',
505-
localized_text: msg.workspaceProjectTemplateLevel(),
506-
qtip_config: {
507-
position: {
508-
my: 'top center',
509-
at: 'bottom center',
510-
},
511-
},
512-
}]);
502+
// The callouts can't appear until the DOM is 100% rendered by react. The
503+
// safest method is to kick off a requestAnimationFrame from an async
504+
// setTimeout()
505+
setTimeout(() => {
506+
requestAnimationFrame(() => {
507+
addCallouts([{
508+
id: 'projectTemplateWorkspaceIconCallout',
509+
element_id: '.projectTemplateWorkspaceIcon:visible',
510+
localized_text: msg.workspaceProjectTemplateLevel(),
511+
qtip_config: {
512+
position: {
513+
my: 'top center',
514+
at: 'bottom center',
515+
},
516+
},
517+
}]);
518+
});
519+
}, 0);
513520
}
514521
};
515522

apps/src/applab/DesignModeHeaders.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import commonStyles from '../commonStyles';
55
import color from '../util/color';
66
import PaneHeader, {PaneButton, PaneSection} from '../templates/PaneHeader';
77
import SettingsCog from '../lib/ui/SettingsCog';
8+
import ProjectTemplateWorkspaceIcon from '../templates/ProjectTemplateWorkspaceIcon';
89

910
export default class DesignModeHeaders extends React.Component {
1011
static propTypes = {
1112
handleVersionHistory: PropTypes.func.isRequired,
1213
onToggleToolbox: PropTypes.func.isRequired,
1314
isToolboxVisible: PropTypes.bool.isRequired,
15+
showProjectTemplateWorkspaceIcon: PropTypes.bool.isRequired,
1416
isRtl: PropTypes.bool.isRequired,
1517
isRunning: PropTypes.bool.isRequired,
1618
showMakerToggle: PropTypes.bool.isRequired,
@@ -136,6 +138,7 @@ export default class DesignModeHeaders extends React.Component {
136138
onClick={this.props.handleVersionHistory}
137139
/>
138140
<PaneSection id="design-workspace-header" className="workspace-header">
141+
{this.props.showProjectTemplateWorkspaceIcon && <ProjectTemplateWorkspaceIcon/>}
139142
<span>{applabMsg.designWorkspaceHeader()}</span>
140143
</PaneSection>
141144
</PaneHeader>

apps/src/applab/DesignWorkspace.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class DesignWorkspace extends React.Component {
1818
isDimmed: PropTypes.bool.isRequired,
1919

2020
// provided by redux
21+
showProjectTemplateWorkspaceIcon: PropTypes.bool.isRequired,
2122
isRunning: PropTypes.bool.isRequired,
2223
isRtl: PropTypes.bool.isRequired,
2324
showMakerToggle: PropTypes.bool,
@@ -35,6 +36,7 @@ class DesignWorkspace extends React.Component {
3536
handleVersionHistory={this.props.handleVersionHistory}
3637
onToggleToolbox={this.onToggleToolbox}
3738
isToolboxVisible={this.state.isToolboxVisible}
39+
showProjectTemplateWorkspaceIcon={this.props.showProjectTemplateWorkspaceIcon}
3840
isRtl={this.props.isRtl}
3941
isRunning={this.props.isRunning}
4042
showMakerToggle={this.props.showMakerToggle}
@@ -56,6 +58,7 @@ class DesignWorkspace extends React.Component {
5658
}
5759
}
5860
export default connect(state => ({
61+
showProjectTemplateWorkspaceIcon: !!state.pageConstants.showProjectTemplateWorkspaceIcon,
5962
isRtl: state.isRtl,
6063
isRunning: !!state.runState.isRunning,
6164
showMakerToggle: !!state.pageConstants.showMakerToggle,

apps/src/code-studio/initApp/loadApp.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,6 @@ export function setupApp(appOptions) {
189189
window.location.href = lastServerResponse.nextRedirect;
190190
}
191191
},
192-
backToPreviousLevel: function () {
193-
var lastServerResponse = reporting.getLastServerResponse();
194-
if (lastServerResponse.previousLevelRedirect) {
195-
window.location.href = lastServerResponse.previousLevelRedirect;
196-
}
197-
},
198192
showInstructionsWrapper: function (showInstructions) {
199193
// Always skip all pre-level popups on share levels or when configured thus
200194
if (this.share || appOptions.level.skipInstructionsPopup) {

apps/src/code-studio/reporting.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ function reportComplete(report, response) {
342342
if (response) {
343343
lastServerResponse.report_error = report.error;
344344
lastServerResponse.nextRedirect = response.redirect;
345-
lastServerResponse.previousLevelRedirect = response.previous_level;
346345
lastServerResponse.videoInfo = response.video_info;
347346
lastServerResponse.endOfStageExperience = response.end_of_stage_experience;
348347
lastServerResponse.previousStageInfo = response.stage_changing && response.stage_changing.previous;

apps/src/feedback.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ FeedbackUtils.prototype.displayFeedback = function (options, requiredBlocks,
179179
hideTryAgain: options.hideTryAgain,
180180
keepPlayingText: options.keepPlayingText,
181181
continueText: options.continueText,
182-
showPreviousButton: options.level.showPreviousLevelButton,
183182
isK1: options.level.isK1,
184183
freePlay: options.level.freePlay,
185184
finalLevel: finalLevel
@@ -188,16 +187,14 @@ FeedbackUtils.prototype.displayFeedback = function (options, requiredBlocks,
188187

189188
var againButton = feedback.querySelector('#again-button');
190189
var hintRequestButton = feedback.querySelector('#hint-request-button');
191-
var previousLevelButton = feedback.querySelector('#back-button');
192190
var continueButton = feedback.querySelector('#continue-button');
193191

194192
// Don't show the continue button on share pages.
195193
if (this.studioApp_.share) {
196194
continueButton.style.display = 'none';
197195
}
198196

199-
const hasNeitherBackButton = !againButton && !previousLevelButton;
200-
const onlyContinue = continueButton && hasNeitherBackButton;
197+
const onlyContinue = continueButton && !againButton;
201198
const defaultContinue = onlyContinue || options.defaultToContinue;
202199

203200
/**
@@ -314,13 +311,6 @@ FeedbackUtils.prototype.displayFeedback = function (options, requiredBlocks,
314311
});
315312
}
316313

317-
if (previousLevelButton) {
318-
dom.addClickTouchEvent(previousLevelButton, function () {
319-
feedbackDialog.hide();
320-
options.backToPreviousLevel();
321-
});
322-
}
323-
324314
// If there is a hint request button, hide the hint that would ordinarily
325315
// be shown (including any feedback blocks), and add code to restore the
326316
// hint if the button gets pressed.
@@ -617,9 +607,6 @@ FeedbackUtils.prototype.getFeedbackButtons_ = function (options) {
617607
}
618608

619609
ReactDOM.render(React.createElement(DialogButtons, {
620-
previousLevel:
621-
!this.canContinueToNextLevel(options.feedbackType) &&
622-
options.showPreviousButton,
623610
tryAgain: tryAgainText,
624611
continueText: options.continueText || (options.finalLevel ? msg.finish() : msg.continue()),
625612
nextLevel: this.canContinueToNextLevel(options.feedbackType),

apps/src/maze/levels.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ module.exports = {
365365
[0, 3, 1, 1, 1, 1, 0, 0],
366366
[0, 0, 0, 0, 0, 0, 0, 0]
367367
],
368-
'levelIncompleteError': mazeMsg.ifInRepeatError(),
369-
'showPreviousLevelButton': true
368+
'levelIncompleteError': mazeMsg.ifInRepeatError()
370369
},
371370
'2_15': {
372371
'toolbox': toolbox(2, 15),

apps/src/templates/DialogButtons.jsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var DialogButtons = React.createClass({
2020
},
2121

2222
render: function () {
23-
var okButton, cancelButton, confirmButton, previousButton, hintButton, againButton, nextButton;
23+
var okButton, cancelButton, confirmButton, hintButton, againButton, nextButton;
2424

2525
var style = {
2626
confirmButton: {
@@ -63,14 +63,6 @@ var DialogButtons = React.createClass({
6363
);
6464
}
6565

66-
if (this.props.previousLevel) {
67-
previousButton = (
68-
<LegacyButton type="primary" id="back-button" className="launch">
69-
{msg.backToPreviousLevel()}
70-
</LegacyButton>
71-
);
72-
}
73-
7466
if (this.props.tryAgain) {
7567
if (this.props.isK1 && !this.props.freePlay) {
7668
againButton = (
@@ -131,7 +123,6 @@ var DialogButtons = React.createClass({
131123
{okButton}
132124
{cancelButton}
133125
{confirmButton}
134-
{previousButton}
135126
{hintButton}
136127
{againButton}
137128
{nextButton}

apps/src/templates/ProjectTemplateWorkspaceIcon.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class ProjectTemplateWorkspaceIcon extends React.Component {
3535
>
3636
<img
3737
style={styles.projectTemplateIcon}
38-
id="projectTemplateWorkspaceIcon"
38+
className="projectTemplateWorkspaceIcon"
3939
src={IMAGE_BASE_URL + 'connect.svg'}
4040
data-tip data-for={this.tooltipId}
4141
aria-describedby={this.tooltipId}

apps/src/weblab/WebLab.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ WebLab.prototype.init = function (config) {
150150
container.className = container.className + " pin_bottom";
151151

152152
// NOTE: if we called studioApp_.init(), these calls would not be needed...
153+
this.studioApp_.initProjectTemplateWorkspaceIconCallout();
153154
this.studioApp_.alertIfCompletedWhilePairing(config);
154155
this.studioApp_.initVersionHistoryUI(config);
155156

@@ -163,12 +164,6 @@ WebLab.prototype.init = function (config) {
163164
onPuzzleComplete: this.onFinish.bind(this),
164165
unsubmitUrl: this.level.unsubmitUrl
165166
});
166-
167-
// The project template workspace icon callout appears too far to the left
168-
// if we don't delay this slightly (currently 0.25 seconds)
169-
setTimeout(() => {
170-
this.studioApp_.initProjectTemplateWorkspaceIconCallout();
171-
}, 250);
172167
};
173168

174169
// Push initial level properties into the Redux store

0 commit comments

Comments
 (0)