refactor: [UEPR-51] refactor logic for finding current step name

This commit is contained in:
MiroslavDionisiev 2024-10-22 15:16:29 +03:00
parent a693e5f0b7
commit 9c488c11b5

View file

@ -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`