/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import { useState } from "react"; import { observer } from "mobx-react"; // plane imports import { PRODUCT_TOUR_TRACKER_ELEMENTS } from "@plane/constants"; import { Button } from "@plane/propel/button"; import { CloseIcon, PlaneLockup } from "@plane/propel/icons"; // assets import CyclesTour from "@/app/assets/onboarding/cycles.webp?url"; import IssuesTour from "@/app/assets/onboarding/issues.webp?url"; import ModulesTour from "@/app/assets/onboarding/modules.webp?url"; import PagesTour from "@/app/assets/onboarding/pages.webp?url"; import ViewsTour from "@/app/assets/onboarding/views.webp?url"; // hooks import { useCommandPalette } from "@/hooks/store/use-command-palette"; import { useUser } from "@/hooks/store/user"; // local imports import { TourSidebar } from "./sidebar"; export type TOnboardingTourProps = { onComplete: () => void; }; export type TTourSteps = "welcome" | "work-items" | "cycles" | "modules" | "views" | "pages"; const TOUR_STEPS: { key: TTourSteps; title: string; description: string; image: string; prevStep?: TTourSteps; nextStep?: TTourSteps; }[] = [ { key: "work-items", title: "Plan with work items", description: "The work item is the building block of the Plane. Most concepts in Plane are either associated with work items and their properties.", image: IssuesTour, nextStep: "cycles", }, { key: "cycles", title: "Move with cycles", description: "Cycles help you and your team to progress faster, similar to the sprints commonly used in agile development.", image: CyclesTour, prevStep: "work-items", nextStep: "modules", }, { key: "modules", title: "Break into modules", description: "Modules break your big thing into Projects or Features, to help you organize better.", image: ModulesTour, prevStep: "cycles", nextStep: "views", }, { key: "views", title: "Views", description: "Create custom filters to display only the work items that matter to you. Save and share your filters in just a few clicks.", image: ViewsTour, prevStep: "modules", nextStep: "pages", }, { key: "pages", title: "Document with pages", description: "Use Pages to quickly jot down work items when you're in a meeting or starting a day.", image: PagesTour, prevStep: "views", }, ]; export const TourRoot = observer(function TourRoot(props: TOnboardingTourProps) { const { onComplete } = props; // states const [step, setStep] = useState("welcome"); // store hooks const { toggleCreateProjectModal } = useCommandPalette(); const { data: currentUser } = useUser(); const currentStepIndex = TOUR_STEPS.findIndex((tourStep) => tourStep.key === step); const currentStep = TOUR_STEPS[currentStepIndex]; return ( <> {step === "welcome" ? (

Welcome to Plane, {currentUser?.first_name} {currentUser?.last_name}

We{"'"}re glad that you decided to try out Plane. You can now manage your projects with ease. Get started by creating a project.

) : (
{currentStep?.title}

{currentStep?.title}

{currentStep?.description}

{currentStep?.prevStep && ( )} {currentStep?.nextStep && ( )}
{currentStepIndex === TOUR_STEPS.length - 1 && ( )}
)} ); });