feat: remove 2 steps from the onboarding flow for google signups (#17787)

This commit is contained in:
Benny Joo authored and GitHub committed 2024-12-09 15:44:42 +00:00
1 parent a926e0b9d6
commit 046042a877
7 files changed
+170 -126

No files matched your search

+4 -4
View File
@@ -3,7 +3,7 @@ import classNames from "@calcom/lib/classNames";
type StepWithNav = {
maxSteps: number;
currentStep: number;
navigateToStep: (step: number) => void;
nextStep: () => void;
disableNavigation?: false;
stepLabel?: (currentStep: number, maxSteps: number) => string;
};
@@ -11,7 +11,7 @@ type StepWithNav = {
type StepWithoutNav = {
maxSteps: number;
currentStep: number;
navigateToStep?: undefined;
nextStep?: undefined;
disableNavigation: true;
stepLabel?: (currentStep: number, maxSteps: number) => string;
};
@@ -23,7 +23,7 @@ const Steps = (props: StepsProps) => {
const {
maxSteps,
currentStep,
navigateToStep,
nextStep,
disableNavigation = false,
stepLabel = (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}`,
} = props;
@@ -35,7 +35,7 @@ const Steps = (props: StepsProps) => {
return index <= currentStep - 1 ? (
<div
key={`step-${index}`}
onClick={() => navigateToStep?.(index)}
onClick={() => nextStep?.()}
className={classNames(
"bg-inverted h-1 w-full rounded-[1px]",
index < currentStep - 1 && !disableNavigation ? "cursor-pointer" : ""
@@ -13,8 +13,9 @@ const mockNavigateToStep = vi.fn();
const Props = {
maxSteps: MAX_STEPS,
currentStep: CURRENT_STEP,
navigateToStep: mockNavigateToStep,
nextStep: mockNavigateToStep,
stepLabel: (currentStep: number, totalSteps: number) => `Test Step ${currentStep} of ${totalSteps}`,
disableNavigation: undefined,
};
describe("Tests for Steps Component", () => {
@@ -52,7 +53,7 @@ describe("Tests for Steps Component", () => {
const stepIndicator = getByTestId(`step-indicator-${i}`);
if (i < CURRENT_STEP - 1) {
fireEvent.click(stepIndicator);
expect(mockNavigateToStep).toHaveBeenCalledWith(i);
expect(mockNavigateToStep).toHaveBeenCalled();
mockNavigateToStep.mockClear();
} else {
expect(mockNavigateToStep).not.toHaveBeenCalled();
@@ -60,7 +60,7 @@ function WizardForm<T extends DefaultStep>(props: {
<Steps
maxSteps={steps.length}
currentStep={step}
navigateToStep={noop}
nextStep={noop}
stepLabel={stepLabel}
data-testid="wizard-step-component"
/>
+1 -1
View File
@@ -56,7 +56,7 @@ export function WizardLayout({
</>
)}
</header>
<Steps maxSteps={maxSteps} currentStep={currentStep} navigateToStep={noop} />
<Steps maxSteps={maxSteps} currentStep={currentStep} nextStep={noop} />
</div>
<StepCard>{children}</StepCard>
</div>