From aef1c7b8fb044ad2336967c77e8b901fdc379a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LAGACHE?= Date: Thu, 18 Jun 2026 16:04:39 +0200 Subject: [PATCH] feat(onboarding): show Next button in shell when navigating backwards --- src/features/onboarding/onboarding-shell.tsx | 138 ++++++++++++------- 1 file changed, 90 insertions(+), 48 deletions(-) diff --git a/src/features/onboarding/onboarding-shell.tsx b/src/features/onboarding/onboarding-shell.tsx index f16de398..d0fc2fcd 100644 --- a/src/features/onboarding/onboarding-shell.tsx +++ b/src/features/onboarding/onboarding-shell.tsx @@ -1,62 +1,104 @@ "use client"; -import Image from "next/image"; +import { useEffect, useState } from "react"; import { useOnboarding } from "@onboardjs/react"; import { Button } from "@/components/ui/button"; import { OnboardingStepper } from "@/features/onboarding/onboarding-stepper"; import { OnboardingChecklist } from "@/features/onboarding/onboarding-checklist"; -import Logo from "@/app/icon0.svg"; +import { Heart } from "lucide-react"; +import { AuthLogoSection } from "../auth/auth-logo-section"; + +const STEP_ORDER = [ + "login", + "account-info", + "security", + "preferences", + "org-create", + "invite-members", + "notifier", + "storage", + "defaults", + "agent-create", + "agent-key", + "agent-waiting", + "project-create", + "db-settings", + "finish", +]; export const OnboardingShell = () => { - const { state, previous, skip, renderStep } = useOnboarding(); + const { state, previous, skip, next, renderStep } = useOnboarding(); - if (!state) return null; + const currentStepId = String(state?.currentStep?.id ?? ""); + const currentIndex = STEP_ORDER.indexOf(currentStepId); - const showSplit = state.currentStep?.id !== "agent-waiting" && state.currentStep?.id !== "finish"; + const [latestIndex, setLatestIndex] = useState(currentIndex); - return ( -
- {/* Logo */} -
- Portabase - Portabase + useEffect(() => { + setLatestIndex((prev) => Math.max(prev, currentIndex)); + }, [currentIndex]); + + if (!state) return null; + + const showSplit = + currentStepId !== "agent-waiting" && currentStepId !== "finish"; + + const isGoingBack = currentIndex < latestIndex; + + return ( +
+ +
+
+ +
{renderStep()}
+
+ +
+ {state.isSkippable && ( + + )} + {isGoingBack && ( + + )}
- - {/* Card */} -
-
- -
{renderStep()}
-
- - {state.isSkippable && ( - - )} -
-
- {showSplit && ( -
- -
- )} -
- - {/* Footer */} -

Made with ♥ by Portabase

+
- ); + {showSplit && ( +
+ +
+ )} +
+ + +
+ ); };