diff --git a/web/components/onboarding/index.ts b/web/components/onboarding/index.ts index f19eb9612..57a84818c 100644 --- a/web/components/onboarding/index.ts +++ b/web/components/onboarding/index.ts @@ -3,3 +3,6 @@ export * from "./invite-members"; export * from "./join-workspaces"; export * from "./user-details"; export * from "./workspace"; +export * from "./invitations"; +export * from "./onboarding-sidebar"; +export * from "./step-indicator"; diff --git a/web/components/onboarding/invitations.tsx b/web/components/onboarding/invitations.tsx index 377ca2932..5472595f5 100644 --- a/web/components/onboarding/invitations.tsx +++ b/web/components/onboarding/invitations.tsx @@ -1,7 +1,7 @@ import React, { useState } from "react"; import useSWR, { mutate } from "swr"; // components -import { Button, Loader } from "@plane/ui"; +import { Button } from "@plane/ui"; // helpers import { truncateText } from "helpers/string.helper"; @@ -24,7 +24,7 @@ type Props = { }; const workspaceService = new WorkspaceService(); -const Invitations: React.FC = (props) => { +export const Invitations: React.FC = (props) => { const { handleNextStep, setTryDiffAccount } = props; const [isJoiningWorkspaces, setIsJoiningWorkspaces] = useState(false); const [invitationsRespond, setInvitationsRespond] = useState([]); @@ -169,5 +169,3 @@ const EmptyInvitation = ({ email, setTryDiffAccount }: { email: string; setTryDi

); - -export default Invitations; diff --git a/web/components/onboarding/invite-members.tsx b/web/components/onboarding/invite-members.tsx index 705efef29..88361dd23 100644 --- a/web/components/onboarding/invite-members.tsx +++ b/web/components/onboarding/invite-members.tsx @@ -1,11 +1,9 @@ import React, { useEffect, useRef, useState } from "react"; -// next import Image from "next/image"; import { useTheme } from "next-themes"; -// headless ui import { Listbox, Transition } from "@headlessui/react"; -// react-hook-form import { Control, Controller, FieldArrayWithId, UseFieldArrayRemove, useFieldArray, useForm } from "react-hook-form"; +import { Check, ChevronDown, Plus, XCircle } from "lucide-react"; // services import { WorkspaceService } from "services/workspace.service"; // hooks @@ -13,11 +11,9 @@ import useToast from "hooks/use-toast"; // ui import { Button, Input } from "@plane/ui"; // components -import OnboardingStepIndicator from "components/account/step-indicator"; +import { OnboardingStepIndicator } from "components/onboarding/step-indicator"; // hooks import useDynamicDropdownPosition from "hooks/use-dynamic-dropdown"; -// icons -import { Check, ChevronDown, Plus, User2, XCircle } from "lucide-react"; // types import { IUser, IWorkspace, TOnboardingSteps, TUserWorkspaceRole } from "types"; // constants diff --git a/web/components/onboarding/join-workspaces.tsx b/web/components/onboarding/join-workspaces.tsx index c51c0de9b..cb2f3ee71 100644 --- a/web/components/onboarding/join-workspaces.tsx +++ b/web/components/onboarding/join-workspaces.tsx @@ -3,10 +3,7 @@ import { Controller, useForm } from "react-hook-form"; // hooks import useUser from "hooks/use-user"; // components -import Invitations from "./invitations"; -import DummySidebar from "components/account/sidebar"; -import OnboardingStepIndicator from "components/account/step-indicator"; -import { Workspace } from "./workspace"; +import { Invitations, OnboardingSidebar, OnboardingStepIndicator, Workspace } from "components/onboarding"; // types import { IWorkspace, TOnboardingSteps } from "types"; @@ -44,7 +41,7 @@ export const JoinWorkspaces: React.FC = ({ stepChange, setTryDiffAccount control={control} name="name" render={({ field: { value } }) => ( - ; setValue?: UseFormSetValue; watch?: UseFormWatch; + userFullName?: string; }; var timer: number = 0; var lastWorkspaceName: string = ""; -const DummySidebar: React.FC = (props) => { - const { workspaceName, showProject, control, setValue, watch } = props; - const { workspace: workspaceStore, user: userStore } = useMobxStore(); + +export const OnboardingSidebar: React.FC = (props) => { + const { workspaceName, showProject, control, setValue, watch, userFullName } = props; + const { + workspace: workspaceStore, + user: { currentUser }, + } = useMobxStore(); const workspace = workspaceStore.workspaces ? workspaceStore.workspaces[0] : null; const { resolvedTheme } = useTheme(); @@ -148,12 +153,12 @@ const DummySidebar: React.FC = (props) => { >
0 ? value[0].toLocaleUpperCase() : "N"} + name={value.length > 0 ? value : "New Workspace"} src={""} size={30} shape="square" fallbackBackgroundColor="black" - className="!text-base" + className="!text-base capitalize" />
@@ -165,11 +170,12 @@ const DummySidebar: React.FC = (props) => {
0 ? value : workspace ? workspace.name[0].toLocaleUpperCase() : "N"} + name={value.length > 0 ? value : workspace ? workspace.name : "New Workspace"} src={""} size={24} shape="square" - className="!text-base" + fallbackBackgroundColor="black" + className="!text-base capitalize" />
@@ -178,12 +184,12 @@ const DummySidebar: React.FC = (props) => {
@@ -194,11 +200,12 @@ const DummySidebar: React.FC = (props) => {
@@ -207,12 +214,12 @@ const DummySidebar: React.FC = (props) => {
@@ -286,5 +293,3 @@ const DummySidebar: React.FC = (props) => { ); }; - -export default DummySidebar; diff --git a/web/components/account/step-indicator.tsx b/web/components/onboarding/step-indicator.tsx similarity index 87% rename from web/components/account/step-indicator.tsx rename to web/components/onboarding/step-indicator.tsx index 148d2933b..2f98b33b5 100644 --- a/web/components/account/step-indicator.tsx +++ b/web/components/onboarding/step-indicator.tsx @@ -1,6 +1,6 @@ import React from "react"; -const OnboardingStepIndicator = ({ step }: { step: number }) => ( +export const OnboardingStepIndicator = ({ step }: { step: number }) => (
= 2 ? "bg-custom-primary-100" : "bg-onboarding-background-100"}`} /> @@ -17,5 +17,3 @@ const OnboardingStepIndicator = ({ step }: { step: number }) => ( />
); - -export default OnboardingStepIndicator; diff --git a/web/components/onboarding/user-details.tsx b/web/components/onboarding/user-details.tsx index 6dff16c93..affc814c0 100644 --- a/web/components/onboarding/user-details.tsx +++ b/web/components/onboarding/user-details.tsx @@ -7,8 +7,7 @@ import { Camera, User2 } from "lucide-react"; import { useMobxStore } from "lib/mobx/store-provider"; // components import { Button, Input } from "@plane/ui"; -import DummySidebar from "components/account/sidebar"; -import OnboardingStepIndicator from "components/account/step-indicator"; +import { OnboardingSidebar, OnboardingStepIndicator } from "components/onboarding"; import { UserImageUploadModal } from "components/core"; // types import { IUser } from "types"; @@ -25,6 +24,7 @@ const defaultValues: Partial = { type Props = { user?: IUser; + setUserName: (name: string) => void; }; const USE_CASES = [ @@ -41,8 +41,7 @@ const USE_CASES = [ const fileService = new FileService(); export const UserDetails: React.FC = observer((props) => { - const { user } = props; - // states + const { user, setUserName } = props; const [isRemoving, setIsRemoving] = useState(false); const [isImageUploadModalOpen, setIsImageUploadModalOpen] = useState(false); const { @@ -90,7 +89,17 @@ export const UserDetails: React.FC = observer((props) => { return (
- + ( + + )} + />
= observer((props) => { type="text" value={value} autoFocus={true} - onChange={onChange} + onChange={(event) => { + setUserName(event.target.value); + onChange(event); + }} ref={ref} hasError={Boolean(errors.first_name)} placeholder="Enter your full name..." diff --git a/web/pages/onboarding/index.tsx b/web/pages/onboarding/index.tsx index 517e151f6..636bc48b5 100644 --- a/web/pages/onboarding/index.tsx +++ b/web/pages/onboarding/index.tsx @@ -1,8 +1,12 @@ import { useEffect, useState, ReactElement, Fragment } from "react"; import Image from "next/image"; +import { useTheme } from "next-themes"; +import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import useSWR from "swr"; -import { useTheme } from "next-themes"; +import { ChevronDown } from "lucide-react"; +import { Menu, Transition } from "@headlessui/react"; +import { Controller, useForm } from "react-hook-form"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // services @@ -13,7 +17,8 @@ import useUserAuth from "hooks/use-user-auth"; import DefaultLayout from "layouts/default-layout"; import { UserAuthWrapper } from "layouts/auth-layout"; // components -import { InviteMembers, JoinWorkspaces, UserDetails, Workspace } from "components/onboarding"; +import { InviteMembers, JoinWorkspaces, UserDetails } from "components/onboarding"; +import { DeactivateAccountModal } from "components/account"; // ui import { Avatar, Spinner } from "@plane/ui"; // images @@ -21,10 +26,6 @@ import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png"; // types import { IUser, TOnboardingSteps } from "types"; import { NextPageWithLayout } from "types/app"; -import { ChevronDown } from "lucide-react"; -import { Menu, Transition } from "@headlessui/react"; -import { DeactivateAccountModal } from "components/account"; -import { useRouter } from "next/router"; // services const workspaceService = new WorkspaceService(); @@ -46,6 +47,12 @@ const OnboardingPage: NextPageWithLayout = observer(() => { const {} = useUserAuth("onboarding"); + const { control, setValue } = useForm<{ full_name: string }>({ + defaultValues: { + full_name: "", + }, + }); + const { data: invitations } = useSWR("USER_WORKSPACE_INVITATIONS_LIST", () => workspaceService.userWorkspaceInvitations() ); @@ -111,51 +118,70 @@ const OnboardingPage: NextPageWithLayout = observer(() => { Plane
-
- {step != 1 && ( - - )} -
- {step != 1 && ( -

- {currentUser?.first_name} {currentUser?.last_name} -

- )} +
+ ( +
+ {step != 1 && ( + 0 + ? value + : currentUser?.email + } + src={currentUser?.avatar} + size={35} + shape="square" + fallbackBackgroundColor="#FCBE1D" + className="!text-base capitalize" + /> + )} +
+ {step != 1 && ( +

+ {currentUser?.first_name + ? `${currentUser?.first_name} ${currentUser?.last_name ?? ""}` + : value.length > 0 + ? value + : null} +

+ )} - - - {user.email} - - - - - -
{ - setShowDeleteModal(true); - }} + + + {user.email} + + + - Delete -
-
-
-
-
-
+ + +
{ + setShowDeleteModal(true); + }} + > + Delete +
+
+
+ + +
+
+ )} + />
@@ -170,7 +196,7 @@ const OnboardingPage: NextPageWithLayout = observer(() => { stepChange={stepChange} /> ) : step === 2 ? ( - + setValue("full_name", value)} user={user} /> ) : (