Follow-up from "Onboarding experiment new project step"
The following discussion from !32145 (merged) should be addressed:
-
@nicolasdular started a discussion: (+1 comment) Suggestion (non-blocking): I can see that we are repeating the progress-bar set up: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/assets/javascripts/registrations/welcome/index.js
What do you think about extracting this to a helper function?
function progressBarSteps() { const el = document.getElementById('progress-bar'); if (!el) return null; const isInSubscriptionFlow = parseBoolean(el.dataset.isInSubscriptionFlow); const isOnboardingIssuesExperimentEnabled = parseBoolean( el.dataset.isOnboardingIssuesExperimentEnabled, ); let steps; if (isInSubscriptionFlow && isOnboardingIssuesExperimentEnabled) { steps = ONBOARDING_ISSUES_EXPERIMENT_AND_SUBSCRIPTION_FLOW_STEPS; } else if (isInSubscriptionFlow) { steps = SUBSCRIPTON_FLOW_STEPS; } else if (isOnboardingIssuesExperimentEnabled) { steps = ONBOARDING_ISSUES_EXPERIMENT_FLOW_STEPS; } }
// In /projects/new/index.js & /welcome/index.js return new Vue({ el, render(createElement) { return createElement(ProgressBar, { props: { steps: progressBarSteps(), currentStep: STEPS.yourProject }, }); }, });
Does that make sense? Anyway, in my opinion it is non-blocking and could be resolved as a follow-up.