mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
refactor: [UEPR-51] refactor logic for finding current step name
This commit is contained in:
parent
a693e5f0b7
commit
9c488c11b5
1 changed files with 14 additions and 22 deletions
|
@ -93,6 +93,19 @@ const messages = defineMessages({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const STEP_NAMES = [
|
||||||
|
'pick-genre-step',
|
||||||
|
'game-step',
|
||||||
|
'animation-step',
|
||||||
|
'music-step',
|
||||||
|
'clicker-game-step',
|
||||||
|
'pong-game-step',
|
||||||
|
'animate-character-step',
|
||||||
|
'make-fly-animation-step',
|
||||||
|
'record-sound-step',
|
||||||
|
'make-music-step'
|
||||||
|
];
|
||||||
|
|
||||||
const projectIds = {
|
const projectIds = {
|
||||||
clicker: '10128368',
|
clicker: '10128368',
|
||||||
pong: '10128515',
|
pong: '10128515',
|
||||||
|
@ -199,28 +212,7 @@ const EditorJourney = ({onActivateDeck, setCanViewTutorialsHighlight, setShowJou
|
||||||
popoverClass: 'gui-journey',
|
popoverClass: 'gui-journey',
|
||||||
overlayOpacity: 0,
|
overlayOpacity: 0,
|
||||||
onDestroyStarted: () => {
|
onDestroyStarted: () => {
|
||||||
let stepName = '';
|
const stepName = STEP_NAMES[driverObj.getActiveIndex()] || '';
|
||||||
if (driverObj.getActiveIndex() === 0) {
|
|
||||||
stepName = 'pick-genre-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 1) {
|
|
||||||
stepName = 'game-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 2) {
|
|
||||||
stepName = 'animation-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 3) {
|
|
||||||
stepName = 'music-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 4) {
|
|
||||||
stepName = 'clicker-game-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 5) {
|
|
||||||
stepName = 'pong-game-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 6) {
|
|
||||||
stepName = 'animate-character-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 7) {
|
|
||||||
stepName = 'make-fly-animation-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 8) {
|
|
||||||
stepName = 'record-sound-step';
|
|
||||||
} else if (driverObj.getActiveIndex() === 9) {
|
|
||||||
stepName = 'make-music-step';
|
|
||||||
}
|
|
||||||
triggerAnalyticsEvent({
|
triggerAnalyticsEvent({
|
||||||
event: 'editor-journey-step',
|
event: 'editor-journey-step',
|
||||||
editorJourneyStep: `${stepName}-closed`
|
editorJourneyStep: `${stepName}-closed`
|
||||||
|
|
Loading…
Reference in a new issue