Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import { ProjectStep } from "./steps/project-step";
import { ServerStep } from "./steps/server-step";
import { WelcomeStep } from "./steps/welcome-step";

const { useStepper, steps, Scoped } = defineStepper(
const { useStepper, steps } = defineStepper([
{ id: "welcome", title: "Welcome" },
{ id: "plan", title: "Pick a plan" },
{ id: "project", title: "New project" },
{ id: "server", title: "Connect server" },
{ id: "deploy", title: "Ship something" },
{ id: "complete", title: "You're live" },
);
]);

type StepId = (typeof steps)[number]["id"];
const isStepId = (id: string | undefined): id is StepId =>
Expand All @@ -43,9 +43,9 @@ interface Props {
export const OnboardingWizard = ({ onClose }: Props) => {
const router = useRouter();
const persisted = getOnboardingState();
const stepper = useStepper(
isStepId(persisted.stepId) ? persisted.stepId : undefined,
);
const stepper = useStepper({
defaultStep: isStepId(persisted.stepId) ? persisted.stepId : undefined,
});
const [projectId, setProjectId] = useState<string | undefined>(
persisted.projectId,
);
Expand Down Expand Up @@ -125,7 +125,7 @@ export const OnboardingWizard = ({ onClose }: Props) => {
)}
</div>

<Scoped>
<>
<ol className="hidden md:flex flex-col gap-0.5 mt-12">
{visibleStepIds.map((id, index) => {
const step = steps.find((s) => s.id === id)!;
Expand Down Expand Up @@ -178,7 +178,7 @@ export const OnboardingWizard = ({ onClose }: Props) => {
);
})}
</ol>
</Scoped>
</>

<div className="hidden md:flex flex-col gap-4 mt-auto pt-8 border-t border-zinc-800">
{!isLastVisible && (
Expand Down Expand Up @@ -237,7 +237,7 @@ export const OnboardingWizard = ({ onClose }: Props) => {

<div className="flex-1 overflow-y-auto">
<div className="mx-auto w-full max-w-2xl px-6 py-14 lg:py-20">
{stepper.switch({
{stepper.match({
welcome: () => <WelcomeStep onNext={goToNextVisible} />,
plan: () => <PlanStep onNext={goToNextVisible} />,
project: () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const defaultTemplateInfo: TemplateInfo = {
suggestions: [],
};

export const { useStepper, steps, Scoped } = defineStepper(
export const { useStepper, steps } = defineStepper([
{
id: "needs",
title: "Describe your needs",
Expand All @@ -87,7 +87,7 @@ export const { useStepper, steps, Scoped } = defineStepper(
id: "review",
title: "Review and Finalize",
},
);
]);

interface Props {
environmentId: string;
Expand Down Expand Up @@ -171,26 +171,24 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
<h2 className="text-lg font-semibold">Steps</h2>
<div className="flex items-center gap-2">
<span className="text-sm text-muted-foreground">
Step {stepper.current.index + 1} of {steps.length}
Step {stepper.index + 1} of {steps.length}
</span>
<div />
</div>
</div>
<Scoped>
<>
<nav aria-label="Checkout Steps" className="group my-4">
<ol
className="flex items-center justify-between gap-2"
aria-orientation="horizontal"
>
{stepper.all.map((step, index, array) => (
{stepper.steps.map((step, index, array) => (
<React.Fragment key={step.id}>
<li className="flex items-center gap-4 shrink-0">
<Button
type="button"
role="tab"
variant={
index <= stepper.current.index ? "secondary" : "ghost"
}
variant={index <= stepper.index ? "secondary" : "ghost"}
aria-current={
stepper.current.id === step.id ? "step" : undefined
}
Expand All @@ -206,17 +204,15 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
{index < array.length - 1 && (
<Separator
className={`flex-1 ${
index < stepper.current.index
? "bg-primary"
: "bg-muted"
index < stepper.index ? "bg-primary" : "bg-muted"
}`}
/>
)}
</React.Fragment>
))}
</ol>
</nav>
{stepper.switch({
{stepper.match({
needs: () => (
<>
{!haveAtleasOneProviderEnabled && (
Expand Down Expand Up @@ -292,7 +288,7 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
/>
),
})}
</Scoped>
</>
</div>
<DialogFooter>
<div className="flex items-center justify-between w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { Dialog, DialogContent, DialogFooter } from "@/components/ui/dialog";
import { cn } from "@/lib/utils";
import { api } from "@/utils/api";

const { useStepper, steps, Scoped } = defineStepper(
const { useStepper, steps } = defineStepper([
{ id: "welcome", title: "Welcome" },
{ id: "project", title: "New project" },
{ id: "server", title: "Connect server" },
{ id: "deploy", title: "Ship something" },
{ id: "complete", title: "You're live" },
);
]);

const features = [
{
Expand Down Expand Up @@ -182,7 +182,7 @@ export const WelcomeSubscription = () => {
}}
>
<DialogContent className="sm:max-w-2xl">
<Scoped>
<>
<nav aria-label="Steps" className="flex items-center gap-2 pt-2">
{visibleStepIds.map((id, index) => {
const isDone = index < visibleIndex;
Expand Down Expand Up @@ -217,10 +217,10 @@ export const WelcomeSubscription = () => {
);
})}
</nav>
</Scoped>
</>

<div className="py-2">
{stepper.switch({
{stepper.match({
welcome: () => <WelcomeIntro onNext={goToNextVisible} />,
project: () => (
<ProjectStep
Expand Down
2 changes: 1 addition & 1 deletion apps/dokploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@octokit/webhooks": "^14.2.0",
"@openpanel/nextjs": "^1.5.4",
"@react-email/components": "^1.0.12",
"@stepperize/react": "4.0.1",
"@stepperize/react": "8.0.1",
"@stripe/stripe-js": "^4.10.0",
"@tailwindcss/typography": "^0.5.20",
"@tanstack/react-query": "^5.107.1",
Expand Down
6 changes: 4 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.