style: dark mode

This commit is contained in:
LAKHAN BAHETI 2023-11-18 20:05:23 +05:30
parent 8551faf314
commit da29dd3094
16 changed files with 550 additions and 450 deletions

View File

@ -176,6 +176,24 @@ module.exports = {
},
backdrop: "rgba(0, 0, 0, 0.25)",
},
onboarding: {
background: {
100: convertToRGB("--color-onboarding-background-100"),
200: convertToRGB("--color-onboarding-background-200"),
300: convertToRGB("--color-onboarding-background-300"),
400: convertToRGB("--color-onboarding-background-400"),
},
text:{
100: convertToRGB("--color-onboarding-text-100"),
200: convertToRGB("--color-onboarding-text-200"),
300: convertToRGB("--color-onboarding-text-300"),
400: convertToRGB("--color-onboarding-text-400"),
},
border: {
100: convertToRGB("--color-onboarding-border-100"),
200: convertToRGB("--color-onboarding-border-200"),
},
},
},
keyframes: {
leftToaster: {

View File

@ -16,13 +16,12 @@ import { AlertTriangle } from "lucide-react";
type Props = {
isOpen: boolean;
onClose: () => void;
heading: string;
};
const authService = new AuthService();
const DeleteAccountModal: React.FC<Props> = (props) => {
const { isOpen, onClose, heading } = props;
const { isOpen, onClose } = props;
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const router = useRouter();
const { setToastAlert } = useToast();
@ -72,20 +71,20 @@ const DeleteAccountModal: React.FC<Props> = (props) => {
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-custom-background-100 text-left shadow-custom-shadow-md transition-all sm:my-8 sm:w-[40rem]">
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-onboarding-background-200 text-left shadow-custom-shadow-md transition-all sm:my-8 sm:w-[40rem]">
<div className="px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="">
<div className="flex items-center gap-x-4">
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
<AlertTriangle className="h-6 w-6 text-red-600" aria-hidden="true" />
</div>
<Dialog.Title as="h3" className="text-2xl font-medium leading-6 text-custom-text-100">
{heading}
<Dialog.Title as="h3" className="text-2xl font-medium leading-6 text-onboarding-text-100">
Not the right workspace?
</Dialog.Title>
</div>
<div className="mt-6 px-4">
<p className="text-custom-text-400 font-normal text-base">
<p className="text-onboarding-text-300 font-normal text-base">
<li>Delete this account if you have another and wont use this account.</li>
<li>Switch to another account if youd like to come back to this account another time.</li>
</p>
@ -96,9 +95,9 @@ const DeleteAccountModal: React.FC<Props> = (props) => {
<span className="text-sm font-medium hover:cursor-pointer" onClick={handleSignOut}>
Switch account
</span>
<Button variant="outline-danger" size="sm" tabIndex={1} loading={isDeleteLoading}>
<button className="py-1.5 px-3 font-medium rounded-sm text-red-500 border border-red-500 text-sm ">
{isDeleteLoading ? "Deleting..." : "Delete account"}
</Button>
</button>
</div>
</Dialog.Panel>
</Transition.Child>

View File

@ -9,6 +9,7 @@ import useToast from "hooks/use-toast";
import useTimer from "hooks/use-timer";
// icons
import { XCircle } from "lucide-react";
import { useTheme } from "next-themes";
// types
type EmailCodeFormValues = {
@ -93,10 +94,6 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
const emailOld = getValues("email");
useEffect(() => {
setErrorResendingCode(false);
}, [emailOld]);
useEffect(() => {
const submitForm = (e: KeyboardEvent) => {
if (!codeSent && e.key === "Enter") {
@ -133,21 +130,21 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-custom-text-100">
Moving to the runway
</h1>
<div className="text-center text-sm text-custom-text-100 mt-3">
<div className="text-center text-sm text-onboarding-text-200 mt-3">
<p>Paste the code you got at </p>
<span className="text-center text-sm text-custom-primary-80 mt-1 font-semibold ">{sentEmail} </span>
<span>below.</span>
<span className="text-onboarding-text-200">below.</span>
</div>
</>
) : (
<>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-custom-text-100">
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100">
Lets get you prepped!
</h1>
<p className="text-center text-sm text-custom-text-100 mt-3">
<p className="text-center text-sm text-onboarding-text-200 mt-3">
This whole thing will take less than two minutes.
</p>
<p className="text-center text-sm text-custom-text-100 mt-1">Promise!</p>
<p className="text-center text-sm text-onboarding-text-200 mt-1">Promise!</p>
</>
)}
@ -164,7 +161,7 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
) || "Email address is not valid",
}}
render={({ field: { value, onChange, ref } }) => (
<div className="flex items-center relative rounded-md bg-white">
<div className={`flex items-center relative rounded-md bg-onboarding-background-200`}>
<Input
id="email"
name="email"
@ -174,8 +171,8 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
ref={ref}
hasError={Boolean(errors.email)}
placeholder="orville.wright@firstflight.com"
className="w-full h-[46px] placeholder:text-custom-text-400/50 border-custom-border-200 pr-12"
></Input>
className={`w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12`}
/>
{value.length > 0 && (
<XCircle
className="h-5 w-5 absolute stroke-custom-text-400 hover:cursor-pointer right-3"
@ -191,11 +188,11 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
<>
<div>
{codeResent && sentEmail === getValues("email") ? (
<div className="text-sm my-2.5 text-custom-text-400 m-0">
<div className="text-sm my-2.5 text-onboarding-text-300 m-0">
You got a new code at <span className="font-semibold text-custom-primary-80">{sentEmail}</span>.
</div>
) : sentEmail != getValues("email") && getValues("email").length > 0 ? (
<div className="text-sm my-2.5 text-custom-text-400 m-0">
<div className="text-sm my-2.5 text-onboarding-text-300 m-0">
Hit enter
<span> </span>or <span className="italic">Tab</span> to get a new code
</div>
@ -203,7 +200,7 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
<div className="my-4" />
)}
</div>
<div className={`flex items-center relative rounded-md bg-onboarding-background-200`}>
<Controller
control={control}
name="token"
@ -220,10 +217,11 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
ref={ref}
hasError={Boolean(errors.token)}
placeholder="get-set-fly"
className="border-custom-border-300 bg-white h-[46px] w-full"
className="border-onboarding-border-100 h-[46px] w-full"
/>
)}
/>
</div>
</>
)}
{codeSent ? (
@ -241,7 +239,7 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
{isLoading ? "Signing in..." : "Next step"}
</Button>
<div className="w-[70%] my-4 mx-auto">
<p className="text-xs text-custom-text-200">
<p className="text-xs text-onboarding-text-300">
When you click the button above, you agree with our{" "}
<a
href="https://plane.so/terms-and-conditions"

View File

@ -43,14 +43,16 @@ export const GithubLoginButton: FC<GithubLoginButtonProps> = (props) => {
<Link
href={`https://github.com/login/oauth/authorize?client_id=${clientId}&redirect_uri=${loginCallBackURL}&scope=read:user,user:email`}
>
<button className="flex w-full items-center justify-center gap-2 rounded border border-custom-primary-20 p-2 text-sm font-medium text-custom-text-100 duration-300 hover:bg-custom-background-80 h-[46px]">
<button
className={`flex w-full items-center justify-center gap-2 hover:bg-onboarding-background-300 rounded border border-onboarding-border-200 p-2 text-sm font-medium text-custom-text-100 duration-300 h-[46px]`}
>
<Image
src={theme === "dark" ? githubWhiteImage : githubBlackImage}
height={20}
width={20}
alt="GitHub Logo"
/>
<span>Sign in with GitHub</span>
<span className="text-onboarding-text-200">Sign in with GitHub</span>
</button>
</Link>
</div>

View File

@ -1,9 +1,9 @@
import React from "react";
import React, { useEffect } from "react";
import { Avatar, DiceIcon, PhotoFilterIcon } from "@plane/ui";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// react-hook-form
import { Control, Controller, UseFormSetValue } from "react-hook-form";
import { Control, Controller, UseFormSetValue, UseFormWatch } from "react-hook-form";
// types
import { IWorkspace } from "types";
// icons
@ -80,13 +80,13 @@ type Props = {
showProject: boolean;
control?: Control<IWorkspace, any>;
setValue?: UseFormSetValue<IWorkspace>;
watch?: UseFormWatch<IWorkspace>;
};
var timer: number = 0;
var lastWorkspaceName: string = "";
const DummySidebar: React.FC<Props> = (props) => {
const { workspaceName, showProject, control, setValue } = props;
const { workspaceName, showProject, control, setValue, watch } = props;
const { workspace: workspaceStore, user: userStore } = useMobxStore();
const workspace = workspaceStore.workspaces ? workspaceStore.workspaces[0] : null;
const handleZoomWorkspace = (value: string) => {
@ -104,14 +104,20 @@ const DummySidebar: React.FC<Props> = (props) => {
setValue!("name", lastWorkspaceName);
clearInterval(interval);
}
console.log("timer", timer);
timer--;
}, 1000);
}
};
console.log("CALLED");
useEffect(() => {
if (watch) {
watch();
}
});
return (
<div className="border-r relative ">
<div className="border-r h-full border-onboarding-border-100 relative ">
<div>
{control && setValue ? (
<Controller
@ -122,8 +128,8 @@ const DummySidebar: React.FC<Props> = (props) => {
handleZoomWorkspace(value);
}
return timer > 0 ? (
<div className="py-6 pl-4 top-3 mt-4 transition-all bg-custom-background-100 w-full max-w-screen-sm flex items-center ml-6 border-8 border-custom-primary-20 rounded-md">
<div className="bg-slate-200 w-full p-1 flex items-center">
<div className="py-6 pl-4 top-3 mt-4 transition-all bg-onboarding-background-200 w-full max-w-screen-sm flex items-center ml-6 border-8 border-onboarding-background-100 rounded-md">
<div className="bg-onboarding-background-100 w-full p-1 flex items-center">
<div className="flex flex-shrink-0">
<Avatar
name={value.length > 0 ? value[0].toLocaleUpperCase() : "N"}
@ -135,11 +141,11 @@ const DummySidebar: React.FC<Props> = (props) => {
/>
</div>
<span className="text-xl font-medium text-custom-text-300 ml-2 truncate">{value}</span>
<span className="text-xl font-medium text-onboarding-text-100 ml-2 truncate">{value}</span>
</div>
</div>
) : (
<div className="flex transition-all w-full items-center gap-y-2 px-4 pt-6 truncate">
<div className="flex transition-all w-full border border-transparent items-center gap-y-2 px-4 pt-6 truncate">
<div className="flex flex-shrink-0">
<Avatar
name={value.length > 0 ? value : workspace ? workspace.name[0].toLocaleUpperCase() : "N"}
@ -211,26 +217,24 @@ const DummySidebar: React.FC<Props> = (props) => {
<div
className={`flex items-center justify-center rounded flex-shrink-0 p-2 outline-none
"shadow-custom-sidebar-shadow-2xs border-[0.5px] border-custom-border-200"
shadow-custom-sidebar-shadow-2xs border-[0.5px] border-onboarding-border-200
`}
>
<Search className="h-4 w-4 text-custom-sidebar-text-300" />
<Search className="h-4 w-4 text-onboarding-text-200" />
</div>
</div>
{workspaceLinks.map((link) => {
return (
{workspaceLinks.map((link) => (
<a className="block w-full">
<div
className={`group flex w-full items-center gap-2.5 rounded-md px-3 py-2 text-base font-medium outline-none
text-custom-sidebar-text-200 focus:bg-custom-sidebar-background-80
text-onboarding-text-200 focus:bg-custom-sidebar-background-80
`}
>
{<link.Icon className="h-4 w-4" />}
{link.name}
</div>
</a>
);
})}
))}
</div>
{showProject && (
@ -243,8 +247,7 @@ const DummySidebar: React.FC<Props> = (props) => {
<span> Plane web</span>
<ChevronDown className="h-4 w-4" />
</div>
{projectLinks.map((link) => {
return (
{projectLinks.map((link) => (
<a className="block w-full">
<div
className={`group flex w-full items-center gap-2.5 rounded-md px-3 py-2 text-base font-medium outline-none
@ -255,8 +258,7 @@ const DummySidebar: React.FC<Props> = (props) => {
{link.name}
</div>
</a>
);
})}
))}
</div>
</div>
)}

View File

@ -1,23 +1,21 @@
import React from "react";
const OnboardingStepIndicator = ({ step }: { step: number }) => {
return (
const OnboardingStepIndicator = ({ step }: { step: number }) => (
<div className="flex items-center justify-center">
<div className="h-4 w-4 rounded-full bg-custom-primary-100 z-10" />
<div className={`h-1 w-14 -ml-1 ${step >= 2 ? "bg-custom-primary-100" : "bg-custom-primary-20"}`} />
<div className={`h-1 w-14 -ml-1 ${step >= 2 ? "bg-custom-primary-100" : "bg-onboarding-background-100"}`} />
<div
className={` z-10 -ml-1 rounded-full ${
step >= 2 ? "bg-custom-primary-100 h-4 w-4" : " h-3 w-3 bg-custom-primary-20"
step >= 2 ? "bg-custom-primary-100 h-4 w-4" : " h-3 w-3 bg-onboarding-background-100"
}`}
/>
<div className={`h-1 w-14 -ml-1 ${step >= 3 ? "bg-custom-primary-100" : "bg-custom-primary-20"}`} />
<div className={`h-1 w-14 -ml-1 ${step >= 3 ? "bg-custom-primary-100" : "bg-onboarding-background-100"}`} />
<div
className={`rounded-full -ml-1 z-10 ${
step >= 3 ? "bg-custom-primary-100 h-4 w-4" : "h-3 w-3 bg-custom-primary-20"
step >= 3 ? "bg-custom-primary-100 h-4 w-4" : "h-3 w-3 bg-onboarding-background-100"
}`}
/>
</div>
);
};
export default OnboardingStepIndicator;

View File

@ -1,7 +1,7 @@
// react
import React, { useState } from "react";
// components
import { Button } from "@plane/ui";
import { Button, Loader } from "@plane/ui";
// helpers
import { truncateText } from "helpers/string.helper";
@ -17,24 +17,29 @@ import { ROLE } from "constants/workspace";
// types
import { IWorkspaceMemberInvitation } from "types";
// icons
import { CheckCircle2 } from "lucide-react";
import { CheckCircle2, Search } from "lucide-react";
type Props = {
handleNextStep: () => void;
updateLastWorkspace: () => void;
setTryDiffAccount: () => void;
};
const workspaceService = new WorkspaceService();
const Invitations: React.FC<Props> = (props) => {
const { handleNextStep, updateLastWorkspace } = props;
const { handleNextStep, setTryDiffAccount } = props;
const [isJoiningWorkspaces, setIsJoiningWorkspaces] = useState(false);
const [invitationsRespond, setInvitationsRespond] = useState<string[]>([]);
const { workspace: workspaceStore } = useMobxStore();
const {
workspace: workspaceStore,
user: { updateCurrentUser },
} = useMobxStore();
const { data: invitations, mutate: mutateInvitations } = useSWR(USER_WORKSPACE_INVITATIONS, () =>
workspaceService.userWorkspaceInvitations()
);
const {
data: invitations,
mutate: mutateInvitations,
isLoading,
} = useSWR(USER_WORKSPACE_INVITATIONS, () => workspaceService.userWorkspaceInvitations());
const handleInvitation = (workspace_invitation: IWorkspaceMemberInvitation, action: "accepted" | "withdraw") => {
if (action === "accepted") {
@ -44,6 +49,13 @@ const Invitations: React.FC<Props> = (props) => {
}
};
const updateLastWorkspace = async () => {
if (!workspaceStore.workspaces) return;
await updateCurrentUser({
last_workspace_id: workspaceStore.workspaces[0].id,
});
};
const submitInvitations = async () => {
if (invitationsRespond.length <= 0) return;
@ -61,18 +73,22 @@ const Invitations: React.FC<Props> = (props) => {
.finally(() => setIsJoiningWorkspaces(false));
};
return (
<div className="space-y-4">
return invitations && invitations.length > 0 ? (
<div>
<div className="space-y-4 md:w-2/3 ">
<p className="font-semibold pb-2 text-xl sm:text-2xl">Choose a workspace to join </p>
<div>
{invitations &&
invitations.length > 0 &&
invitations.map((invitation) => {
const isSelected = invitationsRespond.includes(invitation.id);
return (
<div
key={invitation.id}
className={`flex cursor-pointer items-center gap-2 border p-3.5 rounded ${
isSelected ? "border-custom-primary-100" : "border-custom-border-200 hover:bg-custom-primary-10"
isSelected
? "border-custom-primary-100"
: "border-onboarding-border-200 hover:bg-onboarding-background-300/30"
}`}
onClick={() => handleInvitation(invitation, isSelected ? "withdraw" : "accepted")}
>
@ -109,7 +125,46 @@ const Invitations: React.FC<Props> = (props) => {
{isJoiningWorkspaces ? "Joining..." : "Join your team"}
</Button>
</div>
<div className="py-3 px-4 mt-8 bg-onboarding-background-300/30 rounded-sm flex justify-between items-center">
<div className="flex items-center">
<Search className="h-4 w-4 mr-2" />
<span className="text-sm text-custom-text-200">Don&apos;t see your workspace?</span>
</div>
<div>
<div
className="bg-onboarding-background-200 py-3 text-center hover:cursor-pointer text-custom-text-200 rounded-md text-sm font-medium border border-custom-border-200"
onClick={setTryDiffAccount}
>
Try a different email address
</div>
<p className="text-xs mt-2 text-custom-text-300">
Your right e-mail address could be from a Google or GitHub login.
</p>
</div>
</div>
</div>
) : (
<EmptyInvitation />
);
};
const EmptyInvitation = () => (
<div className="items-center md:w-4/5 bg-onboarding-background-300/30 my-16 border-onboarding-border-200 py-5 px-10 rounded border justify-center ">
<p className="text-lg text-onboarding-text-300 text-center font-semibold">Is your Team already on Plane?</p>
<p className="text-sm text-onboarding-text-300 mt-6 text-center">
We couldnt find any existing workspaces for the email address bhavesh@caravel.ai
</p>
<div
className="bg-onboarding-background-200 mt-6 py-3 text-center hover:cursor-pointer text-custom-text-200 rounded-md text-sm font-medium border border-custom-border-200"
onClick={() => {}}
>
Try a different email address
</div>
<p className="text-xs mt-2 text-center text-custom-text-300">
Your right e-mail address could be from a Google or GitHub login.
</p>
</div>
);
export default Invitations;

View File

@ -12,12 +12,16 @@ import { Button, Input } from "@plane/ui";
// hooks
import useDynamicDropdownPosition from "hooks/use-dynamic-dropdown";
// icons
import { Check, ChevronDown, Plus, X, XCircle } from "lucide-react";
import { Check, ChevronDown, Plus, User2, X, XCircle } from "lucide-react";
// types
import { IUser, IWorkspace, TOnboardingSteps, TUserWorkspaceRole } from "types";
// constants
import { ROLE } from "constants/workspace";
import OnboardingStepIndicator from "components/account/step-indicator";
import { useTheme } from "next-themes";
import user1 from "public/users/user-1.png";
import user2 from "public/users/user-2.png";
import Image from "next/image";
type Props = {
finishOnboarding: () => Promise<void>;
@ -59,7 +63,7 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
return (
<div className="group relative grid grid-cols-11 gap-4">
<div className="col-span-7">
<div className="col-span-7 bg-onboarding-background-200 rounded-md">
<Controller
control={control}
name={`emails.${index}.email`}
@ -80,12 +84,12 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
ref={ref}
hasError={Boolean(errors.emails?.[index]?.email)}
placeholder="Enter their email..."
className="text-xs sm:text-sm w-full h-11 placeholder:text-custom-text-400/50"
className="text-xs sm:text-sm w-full h-12 placeholder:text-onboarding-text-400 border-onboarding-border-100"
/>
)}
/>
</div>
<div className="col-span-3">
<div className="col-span-3 bg-onboarding-background-200 rounded-md border items-center flex border-onboarding-border-100">
<Controller
control={control}
name={`emails.${index}.role`}
@ -104,11 +108,11 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
type="button"
ref={buttonRef}
onClick={() => setIsDropdownOpen((prev) => !prev)}
className="flex items-center px-2.5 h-11 py-2 text-xs justify-between gap-1 w-full rounded-md border border-custom-border-200 duration-300"
className="flex items-center px-2.5 h-11 py-2 text-xs justify-between gap-1 w-full rounded-md duration-300"
>
<span className="text-xs sm:text-sm">{ROLE[value]}</span>
<span className="text-xs text-onboarding-text-400 sm:text-sm">{ROLE[value]}</span>
<ChevronDown className="h-4 w-4" />
<ChevronDown className="h-4 w-4 stroke-onboarding-text-400" />
</Listbox.Button>
<Transition
@ -123,7 +127,7 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
>
<Listbox.Options
ref={dropdownRef}
className="fixed w-36 z-10 border border-custom-border-200 mt-1 overflow-y-auto rounded-md bg-custom-background-90 text-xs shadow-lg focus:outline-none max-h-48"
className="fixed w-36 z-10 border border-onboarding-border-100 mt-1 overflow-y-auto rounded-md bg-onboarding-background-200 text-xs shadow-lg focus:outline-none max-h-48"
>
<div className="space-y-1 p-2">
{Object.entries(ROLE).map(([key, value]) => (
@ -132,8 +136,8 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
value={parseInt(key)}
className={({ active, selected }) =>
`cursor-pointer select-none truncate rounded px-1 py-1.5 ${
active || selected ? "bg-custom-background-80" : ""
} ${selected ? "text-custom-text-100" : "text-custom-text-200"}`
active || selected ? "bg-onboarding-background-400/40" : ""
} ${selected ? "text-onboarding-text-100" : "text-custom-text-200"}`
}
>
{({ selected }) => (
@ -168,6 +172,7 @@ export const InviteMembers: React.FC<Props> = (props) => {
const { finishOnboarding, stepChange, user, workspace } = props;
const { setToastAlert } = useToast();
const { resolvedTheme } = useTheme();
const {
control,
@ -224,33 +229,43 @@ export const InviteMembers: React.FC<Props> = (props) => {
return (
<div className="flex py-14">
<div className="hidden lg:block w-1/4 p-3 ml-auto rounded bg-gradient-to-b from-white to-custom-primary-10/30 border border-custom-border-100">
<p className="text-base text-custom-text-400 font-semibold">Members</p>
<div
className={`hidden lg:block w-1/4 p-3 ml-auto rounded bg-gradient-to-b ${
resolvedTheme === "light" ? "from-white to-custom-primary-10/30" : " bg-onboarding-background-100/10"
} border border-onboarding-border-100 border-opacity-10`}
>
<p className="text-base text-onboarding-text-400 font-semibold">Members</p>
{Array.from({ length: 4 }).map(() => (
<div className="flex items-center gap-2 mt-4">
<div className="w-8 h-8 flex-shrink-0 rounded-full bg-custom-primary-10"></div>
<div className="w-8 h-8 flex justify-center items-center flex-shrink-0 rounded-full bg-onboarding-background-400">
<User2 className="h-4 w-4 stroke-onboarding-background-300 fill-onboarding-background-400" />
</div>
<div className="w-full">
<div className="rounded-md h-2.5 my-2 bg-custom-primary-30 w-2/3" />
<div className="rounded-md h-2 bg-custom-primary-20 w-1/2" />
<div className="rounded-md h-2.5 my-2 bg-onboarding-background-100 w-2/3" />
<div className="rounded-md h-2 bg-onboarding-background-400 w-1/2" />
</div>
</div>
))}
<div className="relative mt-20 h-32">
<div className="flex absolute bg-custom-background-100 p-2 rounded-full gap-x-2 border border-custom-border-200 w-full mt-1 -left-1/2">
<div className="w-8 h-8 flex-shrink-0 rounded-full bg-custom-primary-10"></div>
<div className="flex absolute bg-onboarding-background-200 p-2 rounded-full gap-x-2 border border-onboarding-border-100 w-full mt-1 -left-1/2">
<div className="w-8 h-8 flex-shrink-0 rounded-full bg-custom-primary-10">
<Image src={user2} alt="user" />
</div>
<div>
<p className="text-sm font-medium">Murphy cooper</p>
<p className="text-custom-text-400 text-sm">murphy@plane.so</p>
<p className="text-onboarding-text-400 text-sm">murphy@plane.so</p>
</div>
</div>
<div className="flex absolute bg-custom-background-100 p-2 rounded-full gap-x-2 border border-custom-border-200 -left-1/3 mt-14 w-full">
<div className="w-8 h-8 flex-shrink-0 rounded-full bg-custom-primary-10"></div>
<div className="flex absolute bg-onboarding-background-200 p-2 rounded-full gap-x-2 border border-onboarding-border-100 -left-1/3 mt-14 w-full">
<div className="w-8 h-8 flex-shrink-0 rounded-full bg-custom-primary-10">
<Image src={user1} alt="user" />
</div>
<div>
<p className="text-sm font-medium">Else Thompson</p>
<p className="text-custom-text-400 text-sm">Elsa@plane.so</p>
<p className="text-onboarding-text-400 text-sm">Elsa@plane.so</p>
</div>
</div>
</div>
@ -298,7 +313,7 @@ export const InviteMembers: React.FC<Props> = (props) => {
Copy invite link
</Button> */}
<span className="text-sm text-custom-text-400/50 hover:cursor-pointer" onClick={nextStep}>
<span className="text-sm text-onboarding-text-400 hover:cursor-pointer" onClick={nextStep}>
Do this later
</span>
</div>

View File

@ -1,43 +1,26 @@
import React, { useState } from "react";
// services
import { WorkspaceService } from "services/workspace.service";
// 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 { Button, Input } from "@plane/ui";
// hooks
import useToast from "hooks/use-toast";
// mobx
import { useMobxStore } from "lib/mobx/store-provider";
// types
import { IWorkspace, TOnboardingSteps } from "types";
// constants
import { RESTRICTED_URLS, ROLE } from "constants/workspace";
// react-hook-form
import { Controller, useForm } from "react-hook-form";
// icons
import { Search } from "lucide-react";
import { Workspace } from "./workspace";
type Props = {
finishOnboarding: () => Promise<void>;
stepChange: (steps: Partial<TOnboardingSteps>) => Promise<void>;
updateLastWorkspace: () => Promise<void>;
setTryDiffAccount: () => void;
};
// services
const workspaceService = new WorkspaceService();
export const JoinWorkspaces: React.FC<Props> = ({ stepChange, updateLastWorkspace, setTryDiffAccount }) => {
const [slugError, setSlugError] = useState(false);
const [invalidSlug, setInvalidSlug] = useState(false);
export const JoinWorkspaces: React.FC<Props> = ({ stepChange, setTryDiffAccount }) => {
const { user } = useUser();
const { workspace: workspaceStore } = useMobxStore();
const { setToastAlert } = useToast();
const {
handleSubmit,
control,
@ -57,60 +40,15 @@ export const JoinWorkspaces: React.FC<Props> = ({ stepChange, updateLastWorkspac
await stepChange({ workspace_join: true, workspace_create: true });
};
const handleCreateWorkspace = async (formData: IWorkspace) => {
const slug = formData.slug.split("/");
formData.slug = slug[slug.length - 1];
// TODO: remove this after adding organization size in backend
formData.organization_size = "Just myself";
console.log(formData.slug);
await workspaceService
.workspaceSlugCheck(formData.slug)
.then(async (res) => {
if (res.status === true && !RESTRICTED_URLS.includes(formData.slug)) {
setSlugError(false);
await workspaceStore
.createWorkspace(formData)
.then(async (res) => {
setToastAlert({
type: "success",
title: "Success!",
message: "Workspace created successfully.",
});
const payload: Partial<TOnboardingSteps> = {
workspace_create: true,
workspace_join: true,
};
await updateLastWorkspace();
await stepChange(payload);
})
.catch(() =>
setToastAlert({
type: "error",
title: "Error!",
message: "Workspace could not be created. Please try again.",
})
);
} else setSlugError(true);
})
.catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Some error occurred while creating workspace. Please try again.",
});
});
};
return (
<div className="flex h-full w-full overflow-y-auto">
<div className="flex h-full w-full">
<div className="hidden lg:block w-3/12">
<Controller
control={control}
name="name"
render={({ field: { value, ref } }) => (
render={({ field: { value } }) => (
<DummySidebar
watch={watch}
setValue={setValue}
control={control}
showProject={false}
@ -120,118 +58,27 @@ export const JoinWorkspaces: React.FC<Props> = ({ stepChange, updateLastWorkspac
/>
</div>
<div className="lg:w-3/5 md:w-4/5 md:px-0 px-7 w-full my-16 mx-auto">
<div className="w-full lg:w-1/2 md:w-4/5 md:px-0 px-7 my-16 mx-auto">
<div className="flex justify-between items-center">
<p className="font-semibold text-xl sm:text-2xl">What will your workspace </p>
<p className="font-semibold text-onboarding-text-200 text-xl sm:text-2xl">What will your workspace </p>
<OnboardingStepIndicator step={1} />
</div>
<form className="mt-5 md:w-2/3" onSubmit={handleSubmit(handleCreateWorkspace)}>
<div className="mb-5">
<p className="text-base text-custom-text-400 mb-1">Name it.</p>
<Controller
<Workspace
stepChange={stepChange}
user={user}
control={control}
name="name"
rules={{
required: "Workspace name is required",
validate: (value) =>
/^[\w\s-]*$/.test(value) || `Name can only contain (" "), ( - ), ( _ ) & alphanumeric characters.`,
maxLength: {
value: 80,
message: "Workspace name should not exceed 80 characters",
},
}}
render={({ field: { value, ref, onChange } }) => (
<div className="flex items-center relative rounded-md bg-white">
<Input
id="name"
name="name"
type="text"
value={value}
onChange={(event) => {
onChange(event.target.value);
setValue("name", event.target.value);
if (window && window.location.host) {
const host = window.location.host;
const slug = event.currentTarget.value.split("/");
setValue(
"slug",
`${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`
);
}
}}
placeholder="Enter workspace name..."
ref={ref}
hasError={Boolean(errors.name)}
className="w-full h-[46px] text-base placeholder:text-custom-text-400/50 placeholder:text-base border-custom-border-200"
></Input>
</div>
)}
handleSubmit={handleSubmit}
setValue={setValue}
errors={errors}
isSubmitting={isSubmitting}
/>
{errors.name && <span className="text-sm text-red-500">{errors.name.message}</span>}
<p className="text-base text-custom-text-400 mt-4 mb-1">You can edit the slug.</p>
<Controller
control={control}
name="slug"
render={({ field: { value, onChange, ref } }) => (
<div className="flex items-center relative rounded-md bg-white">
<Input
id="slug"
name="slug"
type="text"
prefix="asdasdasdas"
value={value.toLocaleLowerCase().trim().replace(/ /g, "-")}
onChange={(e) => {
const host = window.location.host;
const slug = e.currentTarget.value.split("/");
/^[a-zA-Z0-9_-]+$/.test(slug[slug.length - 1]) ? setInvalidSlug(false) : setInvalidSlug(true);
setValue(
"slug",
`${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`
);
}}
ref={ref}
hasError={Boolean(errors.slug)}
className="w-full h-[46px] border-custom-border-300"
></Input>
</div>
)}
/>
{slugError && <span className="-mt-3 text-sm text-red-500">Workspace URL is already taken!</span>}
{invalidSlug && (
<span className="text-sm text-red-500">{`URL can only contain ( - ), ( _ ) & alphanumeric characters.`}</span>
)}
</div>
<Button variant="primary" type="submit" size="md" disabled={!isValid} loading={isSubmitting}>
Make it live
</Button>
</form>
<div className="flex md:w-4/5 items-center my-5">
<hr className="border-custom-border-200 w-full" />
<div className="flex md:w-4/5 items-center my-8">
<hr className="border-onboarding-border-100 w-full" />
<p className="text-center text-sm text-custom-text-400 mx-3 flex-shrink-0">Or</p>
<hr className="border-custom-border-200 w-full" />
</div>
<div className="md:w-2/3 w-full">
<Invitations handleNextStep={handleNextStep} updateLastWorkspace={updateLastWorkspace} />
</div>
<div className="py-3 px-4 mt-8 bg-custom-primary-10 rounded-sm flex justify-between items-center">
<div className="flex items-center">
<Search className="h-4 w-4 mr-2" />
<span className="text-sm text-custom-text-200">Don't see your workspace?</span>
</div>
<div>
<div
className="bg-white py-3 text-center hover:cursor-pointer text-custom-text-200 rounded-md text-sm font-medium border border-custom-border-200"
onClick={setTryDiffAccount}
>
Try a different email address
</div>
<p className="text-xs mt-2 text-custom-text-300">
Your right e-mail address could be from a Google or GitHub login.
</p>
<hr className="border-onboarding-border-100 w-full" />
</div>
<div className="w-full">
<Invitations setTryDiffAccount={setTryDiffAccount} handleNextStep={handleNextStep} />
</div>
</div>
</div>

View File

@ -106,11 +106,11 @@ export const UserDetails: React.FC<Props> = observer((props) => {
<div className="flex mt-5 w-full ">
<button type="button" onClick={() => setIsImageUploadModalOpen(true)}>
{!watch("avatar") || watch("avatar") === "" ? (
<div className="h-16 hover:cursor-pointer justify-center items-center flex w-16 rounded-full flex-shrink-0 mr-3 relative bg-custom-primary-20">
<div className="h-6 w-6 flex justify-center items-center bottom-1 border border-custom-primary-10 -right-1 bg-custom-background-100 rounded-full absolute">
<Camera className="h-4 w-4 stroke-custom-primary-40" />
<div className="h-16 hover:cursor-pointer justify-center items-center flex w-16 rounded-full flex-shrink-0 mr-3 relative bg-onboarding-background-300">
<div className="h-6 w-6 flex justify-center items-center bottom-1 border border-onboarding-border-100 -right-1 bg-onboarding-background-100 rounded-full absolute">
<Camera className="h-4 w-4 stroke-onboarding-background-400" />
</div>
<User2 className="h-10 w-10 stroke-custom-primary-20 fill-custom-primary-40" />
<User2 className="h-10 w-10 stroke-onboarding-background-300 fill-onboarding-background-400" />
</div>
) : (
<div className="relative h-16 w-16 overflow-hidden mr-3">
@ -124,7 +124,7 @@ export const UserDetails: React.FC<Props> = observer((props) => {
)}
</button>
<div className="my-2 bg-custom-background-100 w-full mr-10 rounded-md flex text-sm">
<div className="my-2 bg-onboarding-background-200 w-full mr-10 rounded-md flex text-sm">
<Controller
control={control}
name="first_name"
@ -146,7 +146,7 @@ export const UserDetails: React.FC<Props> = observer((props) => {
ref={ref}
hasError={Boolean(errors.first_name)}
placeholder="Enter your full name..."
className="w-full focus:border-custom-primary-100"
className="w-full focus:border-custom-primary-100 border-onboarding-border-100"
/>
)}
/>
@ -157,17 +157,19 @@ export const UserDetails: React.FC<Props> = observer((props) => {
control={control}
name="first_name"
render={({ field: { value } }) => (
<p className="font-medium text-xl sm:text-2xl p-0">And how will you use Plane, {value} ?</p>
<p className="font-medium text-onboarding-text-200 text-xl sm:text-2xl p-0">
And how will you use Plane, {value} ?
</p>
)}
/>
<p className="font-medium text-sm my-3">Choose just one</p>
<p className="font-medium text-onboarding-text-300 text-sm my-3">Choose just one</p>
<div className="flex flex-wrap break-all overflow-auto">
{useCases.map((useCase, index) => (
<div
className={`border mb-3 hover:cursor-pointer hover:bg-custom-primary-10 flex-shrink-0 ${
selectedUsecase === index ? "border-custom-primary-100" : "border-custom-primary-40"
className={`border mb-3 hover:cursor-pointer hover:bg-onboarding-background-300/30 flex-shrink-0 ${
selectedUsecase === index ? "border-custom-primary-100" : "border-onboarding-border-100"
} mr-3 rounded-sm p-3 text-sm font-medium`}
onClick={() => setSelectedUsecase(index)}
>

View File

@ -1,67 +1,168 @@
import { useState } from "react";
// ui
import { Button } from "@plane/ui";
import { Button, Input } from "@plane/ui";
// types
import { IUser, IWorkspace, TOnboardingSteps } from "types";
// constants
import { CreateWorkspaceForm } from "components/workspace";
import { RESTRICTED_URLS } from "constants/workspace";
import { Control, Controller, FieldErrors, UseFormHandleSubmit, UseFormSetValue } from "react-hook-form";
import { WorkspaceService } from "services/workspace.service";
import useToast from "hooks/use-toast";
import { useMobxStore } from "lib/mobx/store-provider";
type Props = {
finishOnboarding: () => Promise<void>;
stepChange: (steps: Partial<TOnboardingSteps>) => Promise<void>;
updateLastWorkspace: () => Promise<void>;
user: IUser | undefined;
workspaces: IWorkspace[] | undefined;
control: Control<IWorkspace, any>;
handleSubmit: UseFormHandleSubmit<IWorkspace, undefined>;
errors: FieldErrors<IWorkspace>;
setValue: UseFormSetValue<IWorkspace>;
isSubmitting: boolean;
};
export const Workspace: React.FC<Props> = (props) => {
const { finishOnboarding, stepChange, updateLastWorkspace, user, workspaces } = props;
// services
const workspaceService = new WorkspaceService();
const [defaultValues, setDefaultValues] = useState({
name: "",
slug: "",
organization_size: "",
export const Workspace: React.FC<Props> = (props) => {
const { stepChange, user, control, handleSubmit, setValue, errors, isSubmitting } = props;
const [slugError, setSlugError] = useState(false);
const [invalidSlug, setInvalidSlug] = useState(false);
const {
workspace: workspaceStore,
user: { updateCurrentUser },
} = useMobxStore();
const { setToastAlert } = useToast();
const handleCreateWorkspace = async (formData: IWorkspace) => {
if (isSubmitting) return;
const slug = formData.slug.split("/");
formData.slug = slug[slug.length - 1];
await workspaceService
.workspaceSlugCheck(formData.slug)
.then(async (res) => {
if (res.status === true && !RESTRICTED_URLS.includes(formData.slug)) {
setSlugError(false);
await workspaceStore
.createWorkspace(formData)
.then(async (res) => {
setToastAlert({
type: "success",
title: "Success!",
message: "Workspace created successfully.",
});
await workspaceStore.fetchWorkspaces();
await completeStep();
})
.catch(() =>
setToastAlert({
type: "error",
title: "Error!",
message: "Workspace could not be created. Please try again.",
})
);
} else setSlugError(true);
})
.catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Some error occurred while creating workspace. Please try again.",
});
});
};
const completeStep = async () => {
if (!user) return;
if (!user || !workspaceStore.workspaces) return;
const payload: Partial<TOnboardingSteps> = {
workspace_create: true,
workspace_join: true,
};
await stepChange(payload);
await updateLastWorkspace();
};
const secondaryButtonAction = async () => {
if (workspaces && workspaces.length > 0) {
await stepChange({ workspace_create: true, workspace_invite: true, workspace_join: true });
await finishOnboarding();
} else await stepChange({ profile_complete: false, workspace_join: false });
await updateCurrentUser({
last_workspace_id: workspaceStore.workspaces[0]?.id,
});
};
return (
<div className="w-full space-y-7 sm:space-y-10">
<h4 className="text-xl sm:text-2xl font-semibold">Create your workspace</h4>
<div className="sm:w-3/4 md:w-2/5">
<CreateWorkspaceForm
onSubmit={completeStep}
defaultValues={defaultValues}
setDefaultValues={setDefaultValues}
primaryButtonText={{
loading: "Creating...",
default: "Continue",
<form className="mt-5 md:w-2/3" onSubmit={handleSubmit(handleCreateWorkspace)}>
<div className="mb-5">
<p className="text-base text-custom-text-400 mb-1">Name it.</p>
<Controller
control={control}
name="name"
rules={{
required: "Workspace name is required",
validate: (value) =>
/^[\w\s-]*$/.test(value) || `Name can only contain (" "), ( - ), ( _ ) & alphanumeric characters.`,
maxLength: {
value: 80,
message: "Workspace name should not exceed 80 characters",
},
}}
secondaryButton={
workspaces ? (
<Button variant="neutral-primary" onClick={secondaryButtonAction}>
{workspaces.length > 0 ? "Skip & continue" : "Back"}
</Button>
) : undefined
render={({ field: { value, ref, onChange } }) => (
<div className="flex items-center relative rounded-md bg-onboarding-background-200">
<Input
id="name"
name="name"
type="text"
value={value}
onChange={(event) => {
onChange(event.target.value);
setValue("name", event.target.value);
if (window && window.location.host) {
const host = window.location.host;
const slug = event.currentTarget.value.split("/");
setValue("slug", `${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`);
}
}}
placeholder="Enter workspace name..."
ref={ref}
hasError={Boolean(errors.name)}
className="w-full h-[46px] text-base placeholder:text-custom-text-400/50 placeholder:text-base border-onboarding-border-100"
/>
</div>
)}
/>
{errors.name && <span className="text-sm text-red-500">{errors.name.message}</span>}
<p className="text-base text-custom-text-400 mt-4 mb-1">You can edit the slug.</p>
<Controller
control={control}
name="slug"
render={({ field: { value, onChange, ref } }) => (
<div className="flex items-center relative rounded-md bg-onboarding-background-200">
<Input
id="slug"
name="slug"
type="text"
prefix="asdasdasdas"
value={value.toLocaleLowerCase().trim().replace(/ /g, "-")}
onChange={(e) => {
const host = window.location.host;
const slug = e.currentTarget.value.split("/");
/^[a-zA-Z0-9_-]+$/.test(slug[slug.length - 1]) ? setInvalidSlug(false) : setInvalidSlug(true);
setValue("slug", `${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`);
}}
ref={ref}
hasError={Boolean(errors.slug)}
className="w-full h-[46px] border-onboarding-border-100"
/>
</div>
)}
/>
{slugError && <span className="-mt-3 text-sm text-red-500">Workspace URL is already taken!</span>}
{invalidSlug && (
<span className="text-sm text-red-500">{`URL can only contain ( - ), ( _ ) & alphanumeric characters.`}</span>
)}
</div>
<Button variant="primary" type="submit" size="md">
{isSubmitting ? "Creating..." : "Make it live"}
</Button>
</form>
);
};

View File

@ -19,11 +19,12 @@ import {
import { Loader, Spinner } from "@plane/ui";
// images
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
import signInIssues from "public/onboarding/sign-in.svg";
import signInIssues from "public/onboarding/onboarding-issues.svg";
// types
import { IUser, IUserSettings } from "types";
// icons
import { Lightbulb } from "lucide-react";
import { useTheme } from "next-themes";
const authService = new AuthService();
@ -39,7 +40,9 @@ export const SignInView = observer(() => {
const [isLoading, setLoading] = useState(false);
// toast
const { setToastAlert } = useToast();
// computed
const { resolvedTheme } = useTheme();
// computed.
const enableEmailPassword =
envConfig &&
(envConfig?.email_password_login ||
@ -69,7 +72,7 @@ export const SignInView = observer(() => {
const workspaceSlug =
userSettings?.workspace?.last_workspace_slug || userSettings?.workspace?.fallback_workspace_slug;
if (workspaceSlug) router.push(`/${workspaceSlug}`);
else if (userSettings.workspace.invites > 0) router.push("/invitations");
// else if (userSettings.workspace.invites > 0) router.push("/invitations");
else router.push("/create-workspace");
})
.catch(() => {
@ -183,7 +186,13 @@ export const SignInView = observer(() => {
<Spinner />
</div>
) : (
<div className="bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/80 h-full overflow-y-auto">
<div
className={`${
resolvedTheme === "dark"
? "bg-[#18191B]"
: "bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/80"
} h-full overflow-y-auto`}
>
<div className="sm:py-5 pl-8 pb-4 sm:pl-16 lg:pl-28 ">
<div className="flex text-3xl items-center mt-16 font-semibold">
<div className="h-[30px] w-[30px] mr-2">
@ -194,20 +203,30 @@ export const SignInView = observer(() => {
</div>
<div className="md:w-2/3 sm:w-4/5 rounded-md mx-auto shadow-sm border border-custom-border-200">
<div className=" bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/30 p-4">
<div className="bg-gradient-to-br px-7 sm:px-0 from-white/40 to-white/80 h-full pt-32 pb-20 rounded-md">
<div
className={`${resolvedTheme === "dark" ? "" : "from-custom-primary-10/10 to-custom-primary-20/30"} p-4`}
>
<div
className={`px-7 sm:px-0 ${
resolvedTheme === "dark"
? "bg-gradient-to-br from-[#2f3035cc] to-[#212225cc]"
: "bg-gradient-to-br from-white/40 to-white/80"
} h-full pt-32 pb-20 rounded-md`}
>
{!envConfig ? (
<div className="pt-10 w-ful">
<Loader className="space-y-4 w-full pb-4">
<div className="pt-10 mx-auto flex justify-center">
<div>
<Loader className="space-y-4 w-full pb-4 mx-auto">
<Loader.Item height="46px" width="360px" />
<Loader.Item height="46px" width="360px" />
</Loader>
<Loader className="space-y-4 w-full pt-4">
<Loader className="space-y-4 w-full pt-4 mx-auto">
<Loader.Item height="46px" width="360px" />
<Loader.Item height="46px" width="360px" />
</Loader>
</div>
</div>
) : (
<>
<>
@ -219,10 +238,12 @@ export const SignInView = observer(() => {
</div>
</div>
)}
<div className="flex sm:w-[360px] items-center mt-4 mx-auto">
<hr className="border-custom-border-200 w-full" />
<p className="text-center text-sm text-custom-text-400 mx-3 flex-shrink-0">Or continue with</p>
<hr className="border-custom-border-200 w-full" />
<div className="flex sm:w-96 items-center mt-4 mx-auto">
<hr className={`border-onboarding-border-100 w-full`} />
<p className="text-center text-sm text-onboarding-text-400 mx-3 flex-shrink-0">
Or continue with
</p>
<hr className={`border-onboarding-border-100 w-full`} />
</div>
<div className="flex flex-col items-center justify-center gap-4 pt-7 sm:w-96 mx-auto overflow-hidden">
{envConfig?.google_client_id && (
@ -233,17 +254,21 @@ export const SignInView = observer(() => {
)}
</div>
</>
<div className="flex py-2 bg-custom-primary-10 mx-auto rounded-sm border border-custom-primary-20 sm:w-96 mt-16">
<div className={`flex py-2 bg-onboarding-background-100 mx-auto rounded-sm sm:w-96 mt-16`}>
<Lightbulb className="h-7 w-7 mr-2 mx-3" />
<p className=" text-sm text-left">
<p className={`text-sm text-left text-onboarding-text-200`}>
Try the latest features, like Tiptap editor, to write compelling responses.{" "}
<span className="font-medium underline hover:cursor-pointer" onClick={() => {}}>
See new features
</span>
</p>
</div>
<div className="flex justify-center sm:w-96 sm:h-64 object-cover mt-6 mx-auto rounded-md ">
<Image src={signInIssues} alt="Plane Logo" className="sm:w-96 sm:h-64" />
<div className="flex justify-center sm:w-96 sm:h-64 object-cover mt-8 mx-auto rounded-md ">
<Image
src={signInIssues}
alt="Plane Logo"
className={`flex object-cover rounded-md bg-onboarding-background-100`}
/>
</div>
</>
)}

View File

@ -15,17 +15,16 @@ import { UserAuthWrapper } from "layouts/auth-layout";
// components
import { InviteMembers, JoinWorkspaces, UserDetails, Workspace } from "components/onboarding";
// ui
import { Avatar, CustomMenu, Spinner } from "@plane/ui";
import { Avatar, Spinner } from "@plane/ui";
// images
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
import BlackHorizontalLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg";
import WhiteHorizontalLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg";
// types
import { IUser, TOnboardingSteps } from "types";
import { NextPageWithLayout } from "types/app";
import { ChevronDown } from "lucide-react";
import { Menu, Popover, Transition } from "@headlessui/react";
import DeleteAccountModal from "components/account/delete-account-modal";
import { useRouter } from "next/router";
// services
const workspaceService = new WorkspaceService();
@ -33,17 +32,17 @@ const workspaceService = new WorkspaceService();
const OnboardingPage: NextPageWithLayout = observer(() => {
const [step, setStep] = useState<number | null>(null);
const [showDeleteModal, setShowDeleteModal] = useState(false);
const [tryDiffAccount, setTryDiffAccount] = useState(false);
const {
user: { currentUser, updateCurrentUser, updateUserOnBoard },
workspace: workspaceStore,
} = useMobxStore();
const router = useRouter();
const user = currentUser ?? undefined;
const workspaces = workspaceStore.workspaces;
const { setTheme } = useTheme();
const { setTheme, resolvedTheme } = useTheme();
const {} = useUserAuth("onboarding");
@ -51,16 +50,6 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
workspaceService.userWorkspaceInvitations()
);
// update last active workspace details
const updateLastWorkspace = async () => {
console.log("Workspaces", workspaces);
if (!workspaces) return;
await updateCurrentUser({
last_workspace_id: workspaces[0]?.id,
});
};
// handle step change
const stepChange = async (steps: Partial<TOnboardingSteps>) => {
if (!user) return;
@ -76,9 +65,11 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
};
// complete onboarding
const finishOnboarding = async () => {
if (!user) return;
if (!user || !workspaces) return;
await updateUserOnBoard();
router.replace(`/${workspaces[0].slug}`);
};
useEffect(() => {
@ -111,15 +102,19 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
return (
<>
<DeleteAccountModal
heading={tryDiffAccount ? "Try Different Email" : "Delete Account"}
isOpen={showDeleteModal || tryDiffAccount}
isOpen={showDeleteModal}
onClose={() => {
setShowDeleteModal(false);
setTryDiffAccount(false);
}}
/>
{user && step !== null ? (
<div className="bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/80 h-full overflow-y-auto">
<div
className={` ${
resolvedTheme === "dark"
? "bg-[#18191B]"
: "bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/80"
} h-full overflow-y-auto`}
>
<div className="sm:py-14 py-10 px-4 sm:px-7 md:px-14 lg:pl-28 lg:pr-24 flex items-center">
<div className="w-full flex items-center justify-between font-semibold ">
<div className="text-3xl flex items-center gap-x-1">
@ -138,7 +133,11 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
/>
)}
<div>
{step != 1 && <p className="text-sm text-custom-text-200 font-medium">{currentUser?.first_name}</p>}
{step != 1 && (
<p className="text-sm text-custom-text-200 font-medium">
{currentUser?.first_name} {currentUser?.last_name}
</p>
)}
<Menu>
<Menu.Button className={"flex items-center gap-x-2"}>
@ -153,10 +152,10 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
leaveFrom="transform scale-100 opacity-100"
leaveTo="transform scale-95 opacity-0"
>
<Menu.Items className={"absolute bg-slate-600 translate-x-full"}>
<Menu.Items className={"absolute translate-x-full"}>
<Menu.Item>
<div
className="absolute pr-28 hover:cursor-pointer bg-custom-background-100 mr-auto mt-2 rounded-md text-custom-text-300 text-base font-normal p-3 shadow-sm border border-custom-border-200"
className="absolute pr-28 hover:cursor-pointer bg-onboarding-background-200 mr-auto mt-2 rounded-md text-custom-text-300 text-base font-normal p-3 shadow-sm border border-custom-border-200"
onClick={() => {
setShowDeleteModal(true);
}}
@ -172,16 +171,23 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
</div>
</div>
<div className="w-full lg:w-4/5 xl:w-3/4 sm:w-4/5 rounded-md mx-auto shadow-sm border border-custom-border-200">
<div className=" bg-gradient-to-r from-custom-primary-10/80 to-custom-primary-20/30 p-4">
<div className="bg-gradient-to-br from-white/40 to-white/80 h-full rounded-md">
<div
className={`${resolvedTheme === "dark" ? "" : "from-custom-primary-10/10 to-custom-primary-20/30"} p-4`}
>
<div
className={`${
resolvedTheme === "dark"
? "bg-gradient-to-r from-[#2f3035cc] to-[#212225cc]"
: "bg-gradient-to-br from-white/40 to-white/80"
} h-full rounded-md`}
>
{step === 1 ? (
<JoinWorkspaces
setTryDiffAccount={() => {
setTryDiffAccount(true);
setShowDeleteModal(true);
}}
finishOnboarding={finishOnboarding}
stepChange={stepChange}
updateLastWorkspace={updateLastWorkspace}
/>
) : step === 2 ? (
<UserDetails user={user} />

BIN
web/public/users/user-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
web/public/users/user-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -125,6 +125,21 @@
--color-border-200: 229, 229, 229; /* subtle border- 2 */
--color-border-300: 212, 212, 212; /* strong border- 1 */
--color-border-400: 185, 185, 185; /* strong border- 2 */
/* onboarding colors */
--color-onboarding-text-100: 23, 23, 23;
--color-onboarding-text-200: 58, 58, 58;
--color-onboarding-text-300: 82, 82, 82;
--color-onboarding-text-400: 163, 163, 163;
--color-onboarding-background-100: 236, 241, 255;
--color-onboarding-background-200: 255, 255, 255;
--color-onboarding-background-300: 236, 241, 255;
--color-onboarding-background-400: 177, 206, 250;
--color-onboarding-border-100: 229, 229, 229;
--color-onboarding-border-200: 217, 228, 255;
}
[data-theme="light-contrast"] {
@ -172,6 +187,23 @@
--color-border-200: 38, 38, 38; /* subtle border- 2 */
--color-border-300: 46, 46, 46; /* strong border- 1 */
--color-border-400: 58, 58, 58; /* strong border- 2 */
/* onboarding colors */
--color-onboarding-text-100: 237, 238, 240;
--color-onboarding-text-200: 176, 180, 187;
--color-onboarding-text-300: 118, 123, 132;
--color-onboarding-text-400: 105, 110, 119;
--color-onboarding-background-100: 54, 58, 64;
--color-onboarding-background-200: 40, 42, 45;
--color-onboarding-background-300: 40, 42, 45;
--color-onboarding-background-400: 67, 72, 79;
--color-onboarding-border-100: 54, 58, 64;
--color-onboarding-border-200: 54, 58, 64;
}
[data-theme="dark-contrast"] {