Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Add shared onboarding components (OnboardingCard, OnboardingLayout, browser views) (#24946)

sean-brydon52e27bab5365
diff --git a/apps/web/modules/onboarding/components/OnboardingCard.tsx b/apps/web/modules/onboarding/components/OnboardingCard.tsx
new file mode 100644
index 00000000000..72ca7500db1
--- /dev/null
+++ b/apps/web/modules/onboarding/components/OnboardingCard.tsx
@@ -0,0 +1,41 @@
+import type { ReactNode } from "react";
+
+import { SkeletonText } from "@calcom/ui/components/skeleton";
+
+type OnboardingCardProps = {
+ title: string;
+ subtitle: string;
+ children: ReactNode;
+ footer: ReactNode;
+ isLoading?: boolean;
+};
+
+export const OnboardingCard = ({ title, subtitle, children, footer, isLoading }: OnboardingCardProps) => {
+ return (
+ <div className="relative flex h-full min-h-0 w-full flex-col">
+ {/* Card Header */}
+ <div className="flex w-full gap-1.5 px-5 py-4">
+ <div className="flex w-full flex-col gap-1">
+ <h1 className="font-cal text-xl font-semibold leading-6">{title}</h1>
+ <p className="text-subtle text-sm font-medium leading-tight">{subtitle}</p>
+ </div>
+ </div>
+
+ {/* Content */}
+ <div className="flex min-h-0 w-full flex-1 flex-col gap-4">
+ {isLoading ? (
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <SkeletonText className="h-40 w-full" />
+ <SkeletonText className="h-40 w-full" />
+ </div>
+ ) : (
+ children
+ )}
+ </div>
+
+ {/* Footer */}
+ <div className="flex w-full items-center justify-start px-5 py-4">{footer}</div>
+ </div>
+ );
+};
+
diff --git a/apps/web/modules/onboarding/components/OnboardingLayout.tsx b/apps/web/modules/onboarding/components/OnboardingLayout.tsx
new file mode 100644
index 00000000000..1a538362f0c
--- /dev/null
+++ b/apps/web/modules/onboarding/components/OnboardingLayout.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import { signOut } from "next-auth/react";
+import { Children, type ReactNode } from "react";
+
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { Button } from "@calcom/ui/components/button";
+import { Logo } from "@calcom/ui/components/logo";
+
+type OnboardingLayoutProps = {
+ userEmail: string;
+ currentStep: 1 | 2 | 3;
+ children: ReactNode;
+};
+
+export const OnboardingLayout = ({ userEmail, currentStep, children }: OnboardingLayoutProps) => {
+ const { t } = useLocale();
+
+ const handleSignOut = () => {
+ signOut({ callbackUrl: "/auth/logout" });
+ };
+
+ // Extract children as array
+ const childrenArray = Children.toArray(children);
+ const column1 = childrenArray[0];
+ const column2 = childrenArray[1];
+
+ return (
+ <div className="bg-muted flex min-h-screen w-full flex-col items-center justify-between overflow-clip rounded-[12px] px-6 py-10">
+ {/* Logo and container - centered */}
+ <div className="flex w-full flex-1 flex-col items-center justify-center gap-8">
+ <Logo className="h-5 w-auto shrink-0" />
+ <div className="border-subtle bg-default grid w-full max-w-[1130px] grid-cols-1 gap-6 overflow-hidden rounded-2xl border px-12 py-10 xl:h-[690px] xl:grid-cols-[40%_1fr] xl:pl-10 xl:pr-0">
+ {/* Column 1 - Always visible, 40% on xl+ */}
+ <div className="flex min-h-0 flex-col">{column1}</div>
+ {/* Column 2 - Hidden on mobile, visible on xl+, 60% on xl+ */}
+ {column2 && (
+ <div className="hidden h-full max-h-full min-h-0 flex-col overflow-hidden xl:flex">{column2}</div>
+ )}
+ </div>
+ </div>
+
+ {/* Footer with progress dots and sign out */}
+ <div className="flex w-full flex-col items-center justify-center gap-4 px-10 py-8">
+ <div className="flex items-center gap-2">
+ {[1, 2, 3].map((step) => (
+ <div key={step} className="relative flex h-2 w-2 shrink-0 items-center justify-center">
+ <div
+ className={`absolute inset-0 rounded-full ${
+ step <= currentStep ? "bg-emphasis" : "bg-muted"
+ }`}
+ />
+ {step <= currentStep && <div className="bg-emphasis absolute h-1 w-1 rounded-full" />}
+ </div>
+ ))}
+ </div>
+ <Button onClick={handleSignOut} color="minimal" className="text-subtle h-7">
+ {t("sign_out")}
+ </Button>
+ </div>
+ </div>
+ );
+};
+
diff --git a/apps/web/modules/onboarding/components/onboarding-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-browser-view.tsx
new file mode 100644
index 00000000000..37362668712
--- /dev/null
+++ b/apps/web/modules/onboarding/components/onboarding-browser-view.tsx
@@ -0,0 +1,134 @@
+"use client";
+
+import { WEBAPP_URL } from "@calcom/lib/constants";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { Avatar } from "@calcom/ui/components/avatar";
+import { Button } from "@calcom/ui/components/button";
+import { Icon, type IconName } from "@calcom/ui/components/icon";
+
+type OnboardingBrowserViewProps = {
+ avatar?: string | null;
+ name?: string;
+ bio?: string;
+ username?: string | null;
+ teamSlug?: string;
+};
+
+export const OnboardingBrowserView = ({
+ avatar,
+ name,
+ bio,
+ username,
+ teamSlug,
+}: OnboardingBrowserViewProps) => {
+ const { t } = useLocale();
+ const webappUrl = WEBAPP_URL.replace(/^https?:\/\//, "");
+ const displayUrl =
+ teamSlug !== undefined ? `${webappUrl}/team/${teamSlug || ""}` : `${webappUrl}/${username || ""}`;
+
+ const events: Array<{
+ title: string;
+ description: string;
+ duration: number;
+ icon: IconName;
+ }> = [
+ {
+ title: t("onboarding_browser_view_demo"),
+ description: t("onboarding_browser_view_demo_description"),
+ duration: 15,
+ icon: "bell",
+ },
+ {
+ title: t("onboarding_browser_view_quick_meeting"),
+ description: t("onboarding_browser_view_quick_meeting_description"),
+ duration: 15,
+ icon: "bell",
+ },
+ {
+ title: t("onboarding_browser_view_longer_meeting"),
+ description: t("onboarding_browser_view_longer_meeting_description"),
+ duration: 30,
+ icon: "clock",
+ },
+ {
+ title: t("in_person_meeting"),
+ description: t("onboarding_browser_view_in_person_description"),
+ duration: 120,
+ icon: "map-pin",
+ },
+ {
+ title: t("onboarding_browser_view_ask_question"),
+ description: t("onboarding_browser_view_ask_question_description"),
+ duration: 15,
+ icon: "message-circle",
+ },
+ ];
+ return (
+ <div className="bg-default border-subtle hidden h-full w-full flex-col rounded-l-2xl border xl:flex">
+ {/* Browser header */}
+ <div className="border-subtle flex min-w-0 shrink-0 items-center gap-3 rounded-t-2xl border-b bg-white p-3">
+ {/* Navigation buttons */}
+ <div className="flex shrink-0 items-center gap-4 opacity-50">
+ <Icon name="arrow-left" className="text-subtle h-4 w-4" />
+ <Icon name="arrow-right" className="text-subtle h-4 w-4" />
+ <Icon name="rotate-cw" className="text-subtle h-4 w-4" />
+ </div>
+ <div className="bg-muted flex w-full items-center gap-2 rounded-[32px] px-3 py-2">
+ <Icon name="lock" className="text-subtle h-4 w-4" />
+ <p className="text-default text-sm font-medium leading-tight">{displayUrl}</p>
+ </div>
+ <Icon name="ellipsis-vertical" className="text-subtle h-4 w-4" />
+ </div>
+ {/* Content */}
+ <div className="bg-muted h-full pl-11 pt-11">
+ <div className="bg-default border-muted flex h-full w-full flex-col overflow-hidden rounded-xl border">
+ {/* Profile Header */}
+ <div className="border-subtle flex flex-col gap-4 border-b p-4">
+ <div className="flex flex-col items-start gap-4">
+ <Avatar
+ size="lg"
+ imageSrc={avatar || undefined}
+ alt={name || ""}
+ className="border-2 border-white"
+ />
+ <div className="flex flex-col gap-2">
+ <h2 className="text-emphasis text-xl font-semibold leading-tight">
+ {name || t("your_name")}
+ </h2>
+ <p className="text-default text-sm leading-normal">
+ {bio || t("onboarding_browser_view_default_bio")}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ {/* Events List */}
+ <div className="flex flex-col overflow-y-auto">
+ {events.map((event, index) => (
+ <div key={event.title} className="opacity-30">
+ {index > 0 && <div className="border-subtle h-px border-t" />}
+ <div className="flex items-center justify-between gap-3 px-5 py-4">
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <div className="flex items-center gap-1">
+ <h3 className="text-default text-sm font-semibold leading-none">{event.title}</h3>
+ <div className="bg-emphasis flex h-4 items-center justify-center gap-1 rounded-md px-1">
+ <Icon name={event.icon} className="text-emphasis h-3 w-3" />
+ <span className="text-emphasis text-xs font-medium leading-none">
+ {event.duration} {t("minute_timeUnit")}
+ </span>
+ </div>
+ </div>
+ <p className="text-subtle text-sm font-medium leading-tight">{event.description}</p>
+ </div>
+ <Button color="secondary" size="sm" EndIcon="arrow-right">
+ {t("book_now")}
+ </Button>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx
new file mode 100644
index 00000000000..e9ce7747bcf
--- /dev/null
+++ b/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import { trpc } from "@calcom/trpc/react";
+import { Avatar } from "@calcom/ui/components/avatar";
+
+import { useOnboardingStore } from "../store/onboarding-store";
+
+type OnboardingInviteBrowserViewProps = {
+ teamName?: string;
+};
+
+export const OnboardingInviteBrowserView = ({ teamName }: OnboardingInviteBrowserViewProps) => {
+ const { data: user } = trpc.viewer.me.get.useQuery();
+ const { teamBrand } = useOnboardingStore();
+
+ // Use default values if not provided
+ const rawInviterName = user?.name || user?.username || "Alex";
+ const displayInviterName = rawInviterName.charAt(0).toUpperCase() + rawInviterName.slice(1);
+ const displayTeamName = teamName || "Deel";
+ const teamAvatar = teamBrand.logo || null;
+
+ return (
+ <div className="bg-default border-subtle hidden h-full w-full flex-col rounded-l-2xl border xl:flex">
+ {/* Browser header */}
+ <div className="border-subtle flex min-w-0 shrink-0 items-center gap-3 rounded-t-2xl border-b bg-white p-3">
+ {/* Navigation buttons */}
+ <div className="flex shrink-0 items-center gap-4 opacity-50">
+ <div className="h-3 w-3 rounded-full bg-gray-300" />
+ <div className="h-3 w-3 rounded-full bg-gray-300" />
+ <div className="h-3 w-3 rounded-full bg-gray-300" />
+ </div>
+ <div className="bg-muted flex w-full items-center gap-2 rounded-[32px] px-3 py-2">
+ <div className="h-3 w-3 rounded-full bg-gray-400" />
+ <p className="text-subtle text-xs font-medium leading-tight">mail.example.com</p>
+ </div>
+ </div>
+
+ {/* Content */}
+ <div className="bg-muted h-full pl-8 pt-8">
+ <div className="bg-default border-subtle flex h-full w-full flex-col overflow-hidden rounded-tl-2xl border-l border-t">
+ {/* Email Header */}
+ <div className="border-subtle bg-muted flex flex-col gap-4 border-b p-8">
+ <div className="flex flex-col items-start gap-4">
+ <Avatar
+ size="lg"
+ imageSrc={teamAvatar || undefined}
+ alt={displayTeamName}
+ className="border-default h-12 w-12 border-2"
+ />
+ <div className="flex w-full flex-col items-start gap-1">
+ <h2 className="text-emphasis font-cal w-full text-left text-xl font-semibold leading-tight">
+ {displayInviterName} invited you to join {displayTeamName}
+ </h2>
+ <p className="text-subtle text-left text-sm font-normal leading-tight">
+ We're emailing you all the details
+ </p>
+ </div>
+ </div>
+ </div>
+
+ {/* Email Body */}
+ <div className="bg-default flex-1 rounded-bl-2xl" />
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/apps/web/modules/onboarding/components/plan-icon.tsx b/apps/web/modules/onboarding/components/plan-icon.tsx
index bd047409794..52e9cf8b99c 100644
--- a/apps/web/modules/onboarding/components/plan-icon.tsx
+++ b/apps/web/modules/onboarding/components/plan-icon.tsx
@@ -1,24 +1,68 @@
-import classNames from "@calcom/ui/classNames";
+import { motion } from "framer-motion";
+
import { Icon, type IconName } from "@calcom/ui/components/icon";
-export function PlanIcon({ icon, variant = "single" }: { icon: IconName; variant?: "single" | "double" }) {
- const renderIconContainer = (index: number) => {
- // For double variant: 55px icon width + 24px gap = 79px between centers, so ±39.5px from center
- const leftPosition = variant === "double" ? `calc(50% + ${index === 0 ? -39.5 : 39.5}px)` : "50%";
+// Ring sizes - just the diameters, all centered on the icon
+const RING_SIZES = [166, 233, 345, 465];
+
+// Positions for small user icons on rings (for team variant)
+// Format: [ringIndex, angleInDegrees]
+// Angles: 0 = top, 90 = right, 180 = bottom, 270 = left
+const TEAM_ICON_POSITIONS = [
+ { ringIndex: 2, angle: 30 }, // Top-right of third ring
+ { ringIndex: 2, angle: 150 }, // Bottom-left of third ring
+ { ringIndex: 2, angle: 210 }, // Bottom-left of third ring
+ { ringIndex: 2, angle: 330 }, // Top-left of third ring
+ { ringIndex: 3, angle: 0 }, // Top of largest ring
+ { ringIndex: 3, angle: 180 }, // Bottom of largest ring
+];
+export function PlanIcon({
+ icon,
+ variant = "single",
+ animationDirection = "down",
+}: {
+ icon: IconName;
+ variant?: "single" | "organization" | "team";
+ animationDirection?: "up" | "down";
+}) {
+ const renderIconContainer = (index: number) => {
return (
- <div
- key={index}
- className="bg-default absolute top-[10px] flex h-[55px] w-[55px] -translate-x-1/2 items-center justify-center overflow-clip rounded-full"
+ <motion.div
+ key={`main-icon-${variant}-${icon}`}
+ initial={{
+ opacity: 0,
+ y: (animationDirection === "down" ? -20 : 20) - 40, // -40 is half of 80px for centering
+ }}
+ animate={{
+ opacity: 1,
+ y: -40, // Centered position (half of 80px)
+ }}
+ exit={{
+ opacity: 0,
+ y: (animationDirection === "down" ? 20 : -20) - 40,
+ }}
+ transition={{
+ duration: 0.5,
+ ease: "easeInOut",
+ }}
+ className="bg-default absolute flex h-[80px] w-[80px] items-center justify-center overflow-clip rounded-full"
style={{
- left: leftPosition,
+ x: "-50%",
+ left: "50%",
+ top: "50%",
background: "linear-gradient(to bottom, var(--cal-bg, #ffffff), var(--cal-bg-muted, #f7f7f7))",
boxShadow:
"0px 2.818px 5.635px 0px var(--cal-border-subtle), 0px 0px 0px 0.704px var(--cal-border), 0px 0.704px 3.522px -2.818px rgba(0, 0, 0, 0.3)",
}}>
{/* Icon */}
- <div className="size-8 flex items-center justify-center">
- <Icon name={icon} size={24} strokeWidth={1.75} className="text-emphasis opacity-80" />
+ <div className="size-12 flex items-center justify-center">
+ <Icon
+ name={variant === "organization" ? "users" : icon}
+ size={32}
+ strokeWidth={1.75}
+ className="text-emphasis opacity-80"
+ />
</div>
{/* Inner highlight/shine effect */}
@@ -29,79 +73,88 @@ export function PlanIcon({ icon, variant = "single" }: { icon: IconName; variant
opacity: 0.15,
}}
/>
- </div>
+ </motion.div>
);
};
- return (
- <div className="relative h-[76px] w-[160px] shrink-0 overflow-visible">
- {/* Outer ring - SVG with linear gradient */}
- <svg
- className="pointer-events-none absolute left-[calc(50%+0.627px)] top-[-40px] -translate-x-1/2"
- width="156"
- height="156"
- viewBox="0 0 156 156"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- style={{
- maskImage:
- "linear-gradient(180deg, transparent 0%, black 2%, black 50%, black 75%, transparent 100%)",
- WebkitMaskImage:
- "linear-gradient(180deg, transparent 0%, black 2%, black 50%, black 75%, transparent 100%)",
- }}>
- <circle opacity="0.3" cx="78" cy="78" r="77.5" stroke="url(#paint0_linear_outer)" strokeWidth="0.5" />
- <defs>
- <linearGradient
- id="paint0_linear_outer"
- x1="78"
- y1="0"
- x2="78"
- y2="156"
- gradientUnits="userSpaceOnUse">
- <stop stopColor="var(--cal-border-default, #D3D3D3)" />
- <stop offset="1" stopColor="var(--cal-border-emphasis, #B2B2B2)" />
- </linearGradient>
- </defs>
- </svg>
+ const renderSmallUserIcon = (ringIndex: number, angle: number, index: number) => {
+ const ringSize = RING_SIZES[ringIndex];
+ const radius = ringSize / 2;
+ const angleRad = (angle * Math.PI) / 180;
+
+ // Calculate position on the ring
+ const x = Math.cos(angleRad) * radius;
+ const y = Math.sin(angleRad) * radius;
+ const iconHalfSize = 20.25; // Half of 40.5px
- {/* Middle ring - SVG with linear gradient */}
- <svg
- className="pointer-events-none absolute left-[calc(50%+0.628px)] top-[-20.01px] -translate-x-1/2"
- width="111"
- height="111"
- viewBox="0 0 111 111"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
+ return (
+ <motion.div
+ key={`small-icon-${variant}-${ringIndex}-${angle}`}
+ initial={{
+ opacity: 0,
+ y: y - iconHalfSize + (animationDirection === "down" ? -20 : 20),
+ }}
+ animate={{
+ opacity: 1,
+ y: y - iconHalfSize,
+ }}
+ exit={{
+ opacity: 0,
+ y: y - iconHalfSize + (animationDirection === "down" ? 20 : -20),
+ }}
+ transition={{
+ duration: 0.5,
+ ease: "easeInOut",
+ delay: index * 0.05, // Stagger animation for small icons
+ }}
+ className="bg-default absolute flex h-[40.5px] w-[40.5px] items-center justify-center overflow-clip rounded-full shadow-[0px_2.075px_4.15px_0px_rgba(34,42,53,0.05),0px_0px_0px_0.519px_rgba(34,42,53,0.08),0px_0.519px_2.594px_-2.075px_rgba(19,19,22,0.7)]"
style={{
- maskImage:
- "linear-gradient(180deg, transparent 0%, black 2%, black 50%, black 75%, transparent 100%)",
- WebkitMaskImage:
- "linear-gradient(180deg, transparent 0%, black 2%, black 50%, black 75%, transparent 100%)",
+ x: x - iconHalfSize,
+ left: "50%",
+ top: "50%",
+ background: "linear-gradient(to bottom, var(--cal-bg, #ffffff), var(--cal-bg-muted, #f7f7f7))",
}}>
- <circle
- opacity="0.4"
- cx="55.461"
- cy="55.455"
- r="55.211"
- stroke="url(#paint0_linear_middle)"
- strokeWidth="0.5"
+ <div className="flex items-center justify-center opacity-70">
+ <Icon name="user" size={24} strokeWidth={1.75} className="text-emphasis" />
+ </div>
+ <div
+ className="pointer-events-none absolute inset-0 rounded-full"
+ style={{
+ boxShadow: "0px 0.519px 0.311px 0px inset var(--cal-bg-inverted)",
+ opacity: 0.15,
+ }}
/>
- <defs>
- <linearGradient
- id="paint0_linear_middle"
- x1="55.461"
- y1="-0.006"
- x2="55.461"
- y2="110.916"
- gradientUnits="userSpaceOnUse">
- <stop stopColor="var(--cal-border-default, #D3D3D3)" />
- <stop offset="1" stopColor="var(--cal-border-emphasis, #B2B2B2)" />
- </linearGradient>
- </defs>
- </svg>
+ </motion.div>
+ );
+ };
+
+ return (
+ <div className="relative mx-auto h-[465px] w-[465px] shrink-0 overflow-visible">
+ {/* Generate concentric rings centered on icon */}
+ {RING_SIZES.map((size, index) => {
+ const opacity = [0.6, 0.5, 0.4, 0.35][index] || 0.3;
+ return (
+ <div
+ key={index}
+ className="pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full"
+ style={{
+ width: `${size}px`,
+ height: `${size}px`,
+ border: "0.5px solid",
+ borderColor: "var(--cal-border-default, #D3D3D3)",
+ opacity: opacity,
+ }}
+ />
+ );
+ })}
+
+ {/* Small user icons on rings (for team variant) */}
+ {(variant === "team" || variant === "organization") &&
+ TEAM_ICON_POSITIONS.map(({ ringIndex, angle }, index) =>
+ renderSmallUserIcon(ringIndex, angle, index)
+ )}
- {/* Main icon container(s) with gradient background */}
- {variant === "single" ? renderIconContainer(0) : [renderIconContainer(0), renderIconContainer(1)]}
+ {renderIconContainer(0)}
</div>
);
}
diff --git a/apps/web/modules/onboarding/getting-started/onboarding-view.tsx b/apps/web/modules/onboarding/getting-started/onboarding-view.tsx
index 4a908efa8e2..0fd6c51ebf8 100644
--- a/apps/web/modules/onboarding/getting-started/onboarding-view.tsx
+++ b/apps/web/modules/onboarding/getting-started/onboarding-view.tsx
@@ -10,9 +10,9 @@ import { Button } from "@calcom/ui/components/button";
import { type IconName } from "@calcom/ui/components/icon";
import { RadioAreaGroup } from "@calcom/ui/components/radio";
+import { OnboardingLayout } from "../components/OnboardingLayout";
import { OnboardingContinuationPrompt } from "../components/onboarding-continuation-prompt";
import { PlanIcon } from "../components/plan-icon";
-import { OnboardingLayout } from "../personal/_components/OnboardingLayout";
import { useOnboardingStore, type PlanType } from "../store/onboarding-store";
type OnboardingViewProps = {
@@ -64,7 +64,7 @@ export const OnboardingView = ({ userName, userEmail }: OnboardingViewProps) =>
badge: t("onboarding_plan_organization_badge"),
description: t("onboarding_plan_organization_description"),
icon: planIconByType.organization,
- variant: "double" as const,
+ variant: "organization" as const,
},
];