import { useState } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; // hooks import type { NextPage, NextPageContext } from "next"; import useUser from "hooks/use-user"; // lib import { requiredAuth } from "lib/auth"; // layouts import DefaultLayout from "layouts/default-layout"; // components import Welcome from "components/onboarding/welcome"; import PlanWithIssues from "components/onboarding/plan-with-issues"; import MoveWithCycles from "components/onboarding/move-with-cycles"; import BreakIntoModules from "components/onboarding/break-into-modules"; import UserDetails from "components/onboarding/user-details"; import Workspace from "components/onboarding/workspace"; import InviteMembers from "components/onboarding/invite-members"; import CommandMenu from "components/onboarding/command-menu"; // images import Logo from "public/onboarding/logo.svg"; import userService from "services/user.service"; const Onboarding: NextPage = () => { const [step, setStep] = useState(1); const [workspace, setWorkspace] = useState(); const router = useRouter(); const { user } = useUser(); return (
{step <= 3 ? (
Plane Logo
{step === 1 ? ( ) : step === 2 ? ( ) : ( )}
) : (
{step === 4 ? ( ) : step === 5 ? ( ) : step === 6 ? ( ) : step === 7 ? ( ) : ( )}
)}
); }; export const getServerSideProps = async (ctx: NextPageContext) => { const user = await requiredAuth(ctx.req?.headers.cookie); const redirectAfterSignIn = ctx.req?.url; if (!user) { return { redirect: { destination: `/signin?next=${redirectAfterSignIn}`, permanent: false, }, }; } return { props: { user, }, }; }; export default Onboarding;