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
54 changes: 32 additions & 22 deletions web/components/onboarding/tour/root.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { useState } from "react";

import Image from "next/image";

// hooks
import useUser from "hooks/use-user";
import { observer } from "mobx-react-lite";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// components
import { TourSidebar } from "components/onboarding";
// ui
import { Button } from "@plane/ui";
// icons
import { X } from "lucide-react";
// images
// assets
import PlaneWhiteLogo from "public/plane-logos/white-horizontal.svg";
import IssuesTour from "public/onboarding/issues.webp";
import CyclesTour from "public/onboarding/cycles.webp";
Expand Down Expand Up @@ -75,10 +74,13 @@ const TOUR_STEPS: {
},
];

export const TourRoot: React.FC<Props> = ({ onComplete }) => {
export const TourRoot: React.FC<Props> = observer((props) => {
const { onComplete } = props;
// states
const [step, setStep] = useState<TTourSteps>("welcome");

const { user } = useUser();
const { user: userStore, commandPalette: commandPaletteStore } = useMobxStore();
const user = userStore.currentUser;

const currentStepIndex = TOUR_STEPS.findIndex((tourStep) => tourStep.key === step);
const currentStep = TOUR_STEPS[currentStepIndex];
Expand All @@ -91,25 +93,27 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
<div className="h-3/5 bg-custom-primary-100 grid place-items-center">
<Image src={PlaneWhiteLogo} alt="Plane White Logo" />
</div>
<div className="h-2/5 overflow-y-auto p-6">
<div className="h-2/5 flex flex-col overflow-y-auto p-6">
<h3 className="font-semibold sm:text-xl">
Welcome to Plane, {user?.first_name} {user?.last_name}
</h3>
<p className="text-custom-text-200 text-sm mt-3">
We{"'"}re glad that you decided to try out Plane. You can now manage your projects with ease. Get
started by creating a project.
</p>
<div className="flex items-center gap-6 mt-8">
<Button variant="primary" onClick={() => setStep("issues")}>
Take a Product Tour
</Button>
<button
type="button"
className="outline-custom-text-100 bg-transparent text-custom-primary-100 text-xs font-medium"
onClick={onComplete}
>
No thanks, I will explore it myself
</button>
<div className="flex items-end h-full">
<div className="flex items-center gap-6 mt-8">
<Button variant="primary" onClick={() => setStep("issues")}>
Take a Product Tour
</Button>
<button
type="button"
className="outline-custom-text-100 bg-transparent text-custom-primary-100 text-xs font-medium"
onClick={onComplete}
>
No thanks, I will explore it myself
</button>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -148,8 +152,14 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
</Button>
)}
</div>
{TOUR_STEPS.findIndex((tourStep) => tourStep.key === step) === TOUR_STEPS.length - 1 && (
<Button variant="primary" onClick={onComplete}>
{currentStepIndex === TOUR_STEPS.length - 1 && (
<Button
variant="primary"
onClick={() => {
onComplete();
commandPaletteStore.toggleCreateProjectModal(true);
}}
>
Create my first project
</Button>
)}
Expand All @@ -160,4 +170,4 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
)}
</>
);
};
});
1 change: 1 addition & 0 deletions web/components/page-views/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./signin";
export * from "./workspace-dashboard";
1 change: 0 additions & 1 deletion web/components/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export * from "./form";
export * from "./modal";
export * from "./view-list-item";
export * from "./views-list";
export * from "./workspace-dashboard";
2 changes: 1 addition & 1 deletion web/pages/[workspaceSlug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement } from "react";
// layouts
import { AppLayout } from "layouts/app-layout";
// components
import { WorkspaceDashboardView } from "components/views";
import { WorkspaceDashboardView } from "components/page-views";
import { WorkspaceDashboardHeader } from "components/headers/workspace-dashboard";
// types
import { NextPageWithLayout } from "types/app";
Expand Down