diff --git a/src/components/journeys/editor-journey/editor-journey.jsx b/src/components/journeys/editor-journey/editor-journey.jsx index 03cf73a98..ec480858e 100644 --- a/src/components/journeys/editor-journey/editor-journey.jsx +++ b/src/components/journeys/editor-journey/editor-journey.jsx @@ -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 = { clicker: '10128368', pong: '10128515', @@ -199,28 +212,7 @@ const EditorJourney = ({onActivateDeck, setCanViewTutorialsHighlight, setShowJou popoverClass: 'gui-journey', overlayOpacity: 0, onDestroyStarted: () => { - let stepName = ''; - 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'; - } + const stepName = STEP_NAMES[driverObj.getActiveIndex()] || ''; triggerAnalyticsEvent({ event: 'editor-journey-step', editorJourneyStep: `${stepName}-closed`