forked from github/plane
fix: product tour modal bugs (#2657)
* fix: product tour * style: product tour navigation buttons * refactor: step logic
This commit is contained in:
parent
14ac885e55
commit
bf48d93a25
@ -1,16 +1,15 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// mobx store
|
||||||
import useUser from "hooks/use-user";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// components
|
// components
|
||||||
import { TourSidebar } from "components/onboarding";
|
import { TourSidebar } from "components/onboarding";
|
||||||
// ui
|
// ui
|
||||||
import { Button } from "@plane/ui";
|
import { Button } from "@plane/ui";
|
||||||
// icons
|
// icons
|
||||||
import { X } from "lucide-react";
|
import { X } from "lucide-react";
|
||||||
// images
|
// assets
|
||||||
import PlaneWhiteLogo from "public/plane-logos/white-horizontal.svg";
|
import PlaneWhiteLogo from "public/plane-logos/white-horizontal.svg";
|
||||||
import IssuesTour from "public/onboarding/issues.webp";
|
import IssuesTour from "public/onboarding/issues.webp";
|
||||||
import CyclesTour from "public/onboarding/cycles.webp";
|
import CyclesTour from "public/onboarding/cycles.webp";
|
||||||
@ -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 [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 currentStepIndex = TOUR_STEPS.findIndex((tourStep) => tourStep.key === step);
|
||||||
const currentStep = TOUR_STEPS[currentStepIndex];
|
const currentStep = TOUR_STEPS[currentStepIndex];
|
||||||
@ -91,7 +93,7 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
|
|||||||
<div className="h-3/5 bg-custom-primary-100 grid place-items-center">
|
<div className="h-3/5 bg-custom-primary-100 grid place-items-center">
|
||||||
<Image src={PlaneWhiteLogo} alt="Plane White Logo" />
|
<Image src={PlaneWhiteLogo} alt="Plane White Logo" />
|
||||||
</div>
|
</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">
|
<h3 className="font-semibold sm:text-xl">
|
||||||
Welcome to Plane, {user?.first_name} {user?.last_name}
|
Welcome to Plane, {user?.first_name} {user?.last_name}
|
||||||
</h3>
|
</h3>
|
||||||
@ -99,6 +101,7 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
|
|||||||
We{"'"}re glad that you decided to try out Plane. You can now manage your projects with ease. Get
|
We{"'"}re glad that you decided to try out Plane. You can now manage your projects with ease. Get
|
||||||
started by creating a project.
|
started by creating a project.
|
||||||
</p>
|
</p>
|
||||||
|
<div className="flex items-end h-full">
|
||||||
<div className="flex items-center gap-6 mt-8">
|
<div className="flex items-center gap-6 mt-8">
|
||||||
<Button variant="primary" onClick={() => setStep("issues")}>
|
<Button variant="primary" onClick={() => setStep("issues")}>
|
||||||
Take a Product Tour
|
Take a Product Tour
|
||||||
@ -114,6 +117,7 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="relative w-4/5 md:w-1/2 lg:w-3/5 h-3/5 sm:h-3/4 bg-custom-background-100 rounded-[10px] grid grid-cols-10 overflow-hidden">
|
<div className="relative w-4/5 md:w-1/2 lg:w-3/5 h-3/5 sm:h-3/4 bg-custom-background-100 rounded-[10px] grid grid-cols-10 overflow-hidden">
|
||||||
<button
|
<button
|
||||||
@ -148,8 +152,14 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{TOUR_STEPS.findIndex((tourStep) => tourStep.key === step) === TOUR_STEPS.length - 1 && (
|
{currentStepIndex === TOUR_STEPS.length - 1 && (
|
||||||
<Button variant="primary" onClick={onComplete}>
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
onClick={() => {
|
||||||
|
onComplete();
|
||||||
|
commandPaletteStore.toggleCreateProjectModal(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
Create my first project
|
Create my first project
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@ -160,4 +170,4 @@ export const TourRoot: React.FC<Props> = ({ onComplete }) => {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export * from "./signin";
|
export * from "./signin";
|
||||||
|
export * from "./workspace-dashboard";
|
||||||
|
@ -3,4 +3,3 @@ export * from "./form";
|
|||||||
export * from "./modal";
|
export * from "./modal";
|
||||||
export * from "./view-list-item";
|
export * from "./view-list-item";
|
||||||
export * from "./views-list";
|
export * from "./views-list";
|
||||||
export * from "./workspace-dashboard";
|
|
||||||
|
@ -2,7 +2,7 @@ import { ReactElement } from "react";
|
|||||||
// layouts
|
// layouts
|
||||||
import { AppLayout } from "layouts/app-layout";
|
import { AppLayout } from "layouts/app-layout";
|
||||||
// components
|
// components
|
||||||
import { WorkspaceDashboardView } from "components/views";
|
import { WorkspaceDashboardView } from "components/page-views";
|
||||||
import { WorkspaceDashboardHeader } from "components/headers/workspace-dashboard";
|
import { WorkspaceDashboardHeader } from "components/headers/workspace-dashboard";
|
||||||
// types
|
// types
|
||||||
import { NextPageWithLayout } from "types/app";
|
import { NextPageWithLayout } from "types/app";
|
||||||
|
Loading…
Reference in New Issue
Block a user