feat: organization v3 redesign onboarding (#24967)
## What does this PR do? - Redesigns the organization onboarding flow by merging the brand and details pages - Improves the organization details page with a scrollable interface and visual previews - Adds a new organization-specific browser preview component ## Visual Demo (For contributors especially) #### Image Demo: - The PR replaces the separate brand page with an integrated details page that includes logo and banner uploads - The new organization browser view shows a preview of the organization profile with the selected branding ## Mandatory Tasks (DO NOT REMOVE) - [ ] I have self-reviewed the code. - [ ] I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. - [ ] I confirm automated tests are in place that prove my fix is effective or that my feature works. ## How should this be tested? - Go through the organization onboarding flow - Test uploading logos and banners - Verify that the organization browser preview updates in real-time with the form inputs - Confirm that the form validation works correctly for organization name and slug - Check that the scrollable interface works properly with fade effects at top and bottom ## Checklist - I have read the [contributing guide](https://github.com/calcom/cal.com/blob/main/CONTRIBUTING.md) - My code follows the style guidelines of this project - I have commented my code, particularly in hard-to-understand areas - I have checked if my changes generate no new warnings <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Split organization brand from the details step and added live previews for organizations and teams. Revamped org/team invites with reusable components, a dedicated email-invite page, and a CSV upload modal. - **New Features** - Separate Brand step with logo, banner, and color; instant org preview via OnboardingOrganizationBrowserView. - Teams browser preview added; invites include email substep (/onboarding/organization/invite/email, /onboarding/teams/invite/email), CSV upload (template + parsing), and Google Workspace (behind flag). - Shared components (EmailInviteForm, InviteOptions, RoleSelector) used across org and team invites. - **Refactors** - Updated org flow: Details → Brand → Teams → Invites; OnboardingLayout now supports dynamic step counts (org=4, team=3, personal=2). - UI polish (OnboardingCard header padding) and org-specific previews now replace generic views across details/brand/invites/teams; ensured org welcome modal takes precedence over personal. <sup>Written for commit d9b55c0b5505aa0d4ca1c4298a513bcd90606915. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
1 parent
ea80e8c8d4
commit
19641ffc05
26 files changed
+1401
-640
No files matched your search
@@ -0,0 +1,123 @@
|
||||
"use client";
|
||||
|
||||
import { useFormContext } from "react-hook-form";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Label, TextField, Select } from "@calcom/ui/components/form";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
|
||||
import type { InviteRole } from "../store/onboarding-store";
|
||||
|
||||
type BaseInviteFormData = {
|
||||
email: string;
|
||||
role: InviteRole;
|
||||
};
|
||||
|
||||
type InviteFormDataWithOptionalTeam = BaseInviteFormData & {
|
||||
team?: string;
|
||||
};
|
||||
|
||||
type InviteFormDataWithRequiredTeam = BaseInviteFormData & {
|
||||
team: string;
|
||||
};
|
||||
|
||||
type InviteFormData = InviteFormDataWithOptionalTeam | InviteFormDataWithRequiredTeam;
|
||||
|
||||
type EmailInviteFormProps = {
|
||||
fields: Array<{ id: string }>;
|
||||
append: (value: InviteFormData) => void;
|
||||
remove: (index: number) => void;
|
||||
defaultRole: InviteRole;
|
||||
showTeamSelect?: boolean;
|
||||
teams?: Array<{ value: string; label: string }>;
|
||||
emailPlaceholder?: string;
|
||||
};
|
||||
|
||||
export function EmailInviteForm({
|
||||
fields,
|
||||
append,
|
||||
remove,
|
||||
defaultRole,
|
||||
showTeamSelect = false,
|
||||
teams = [],
|
||||
emailPlaceholder,
|
||||
}: EmailInviteFormProps) {
|
||||
const { t } = useLocale();
|
||||
const { register, watch, setValue } = useFormContext();
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-4">
|
||||
<div className="flex flex-col gap-2">
|
||||
{showTeamSelect ? (
|
||||
<div className="grid grid-cols-2">
|
||||
<Label className="text-emphasis mb-0 text-sm font-medium" htmlFor="invites.0.email">
|
||||
{t("email")}
|
||||
</Label>
|
||||
<Label className="text-emphasis mb-0 text-sm font-medium" htmlFor="invites.0.team">
|
||||
{t("team")}
|
||||
</Label>
|
||||
</div>
|
||||
) : (
|
||||
<Label className="text-emphasis text-sm font-medium">{t("email")}</Label>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={
|
||||
showTeamSelect ? "flex flex-col gap-2" : "scroll-bar flex max-h-72 flex-col gap-1 overflow-y-auto"
|
||||
}>
|
||||
{fields.map((field, index) => (
|
||||
<div key={field.id} className="flex items-start gap-0.5 p-0.5">
|
||||
<div className={showTeamSelect ? "grid flex-1 items-start gap-2 md:grid-cols-2" : "flex-1"}>
|
||||
<TextField
|
||||
labelSrOnly
|
||||
{...register(`invites.${index}.email`)}
|
||||
placeholder={emailPlaceholder || `[email protected]`}
|
||||
type="email"
|
||||
size="sm"
|
||||
/>
|
||||
{showTeamSelect && (
|
||||
<Select
|
||||
size="sm"
|
||||
options={teams}
|
||||
value={teams.find((t) => t.value === watch(`invites.${index}.team`))}
|
||||
onChange={(option) => {
|
||||
if (option) {
|
||||
setValue(`invites.${index}.team`, option.value);
|
||||
}
|
||||
}}
|
||||
placeholder={t("select_team")}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
color="minimal"
|
||||
variant="icon"
|
||||
size="sm"
|
||||
className="h-7 w-7"
|
||||
disabled={fields.length === 1}
|
||||
onClick={() => remove(index)}>
|
||||
<Icon name="x" className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
StartIcon="plus"
|
||||
className={showTeamSelect ? "mt-2 w-fit" : "w-fit"}
|
||||
onClick={() =>
|
||||
append(
|
||||
showTeamSelect ? { email: "", team: "", role: defaultRole } : { email: "", role: defaultRole }
|
||||
)
|
||||
}>
|
||||
{t("add")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
"use client";
|
||||
|
||||
import { useFlags } from "@calcom/features/flags/hooks";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
|
||||
const GoogleIcon = () => (
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clipPath="url(#clip0_4178_176214)">
|
||||
<path
|
||||
d="M8.31875 15.36C4.26 15.36 0.9575 12.0588 0.9575 8.00001C0.9575 3.94126 4.26 0.640015 8.31875 0.640015C10.1575 0.640015 11.9175 1.32126 13.2763 2.55876L13.5238 2.78501L11.0963 5.21251L10.8713 5.02001C10.1588 4.41001 9.2525 4.07376 8.31875 4.07376C6.15375 4.07376 4.39125 5.83501 4.39125 8.00001C4.39125 10.165 6.15375 11.9263 8.31875 11.9263C9.88 11.9263 11.1138 11.1288 11.695 9.77001H7.99875V6.45626L15.215 6.46626L15.2688 6.72001C15.645 8.50626 15.3438 11.1338 13.8188 13.0138C12.5563 14.57 10.7063 15.36 8.31875 15.36Z"
|
||||
fill="#6B7280"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_4178_176214">
|
||||
<rect width="16" height="16" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
|
||||
type InviteOptionsProps = {
|
||||
onInviteViaEmail: () => void;
|
||||
onUploadCSV?: () => void;
|
||||
onCopyInviteLink?: () => void;
|
||||
onConnectGoogleWorkspace?: () => void;
|
||||
isSubmitting?: boolean;
|
||||
};
|
||||
|
||||
export const InviteOptions = ({
|
||||
onInviteViaEmail,
|
||||
onUploadCSV,
|
||||
onCopyInviteLink,
|
||||
onConnectGoogleWorkspace,
|
||||
isSubmitting = false,
|
||||
}: InviteOptionsProps) => {
|
||||
const { t } = useLocale();
|
||||
const flags = useFlags();
|
||||
const googleWorkspaceEnabled = flags["google-workspace-directory"];
|
||||
|
||||
return (
|
||||
<div className="flex h-full w-full flex-1 flex-col gap-6 ">
|
||||
{googleWorkspaceEnabled && onConnectGoogleWorkspace && (
|
||||
<>
|
||||
<Button
|
||||
color="secondary"
|
||||
className="h-8 w-full rounded-[10px]"
|
||||
CustomStartIcon={<GoogleIcon />}
|
||||
onClick={onConnectGoogleWorkspace}
|
||||
disabled={isSubmitting}>
|
||||
{t("connect_google_workspace")}
|
||||
</Button>
|
||||
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<div className="border-subtle h-px flex-1 border-t" />
|
||||
<span className="text-subtle text-sm font-medium">{t("or")}</span>
|
||||
<div className="border-subtle h-px flex-1 border-t" />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="flex w-full flex-1 flex-col gap-4">
|
||||
<Button
|
||||
color="primary"
|
||||
className="h-8 w-full justify-center rounded-[10px]"
|
||||
onClick={onInviteViaEmail}
|
||||
disabled={isSubmitting}>
|
||||
<div className="flex items-center gap-1">
|
||||
<Icon name="mail" className="h-4 w-4" />
|
||||
<span>{t("invite_via_email")}</span>
|
||||
</div>
|
||||
</Button>
|
||||
|
||||
{onUploadCSV && (
|
||||
<Button
|
||||
color="secondary"
|
||||
className="h-8 w-full justify-center rounded-[10px]"
|
||||
onClick={onUploadCSV}
|
||||
disabled={isSubmitting}>
|
||||
<div className="flex items-center gap-1">
|
||||
<Icon name="upload" className="h-4 w-4" />
|
||||
<span>{t("upload_csv_file")}</span>
|
||||
</div>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{onCopyInviteLink && (
|
||||
<Button
|
||||
color="secondary"
|
||||
className="h-8 w-full justify-center rounded-[10px]"
|
||||
onClick={onCopyInviteLink}
|
||||
disabled>
|
||||
<div className="flex items-center gap-1">
|
||||
<Icon name="link" className="h-4 w-4" />
|
||||
<span>{t("copy_invite_link")}</span>
|
||||
</div>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -22,7 +22,7 @@ export const OnboardingCard = ({ title, subtitle, children, footer, isLoading }:
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="flex min-h-0 w-full flex-1 flex-col gap-4">
|
||||
<div className="flex h-full 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" />
|
||||
@@ -38,4 +38,3 @@ export const OnboardingCard = ({ title, subtitle, children, footer, isLoading }:
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import classNames from "classnames";
|
||||
import { signOut } from "next-auth/react";
|
||||
import { Children, type ReactNode } from "react";
|
||||
|
||||
@@ -9,11 +10,12 @@ import { Logo } from "@calcom/ui/components/logo";
|
||||
|
||||
type OnboardingLayoutProps = {
|
||||
userEmail: string;
|
||||
currentStep: 1 | 2 | 3;
|
||||
currentStep: number;
|
||||
totalSteps: number;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
export const OnboardingLayout = ({ userEmail, currentStep, children }: OnboardingLayoutProps) => {
|
||||
export const OnboardingLayout = ({ userEmail, currentStep, totalSteps, children }: OnboardingLayoutProps) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
const handleSignOut = () => {
|
||||
@@ -42,17 +44,31 @@ export const OnboardingLayout = ({ userEmail, currentStep, children }: Onboardin
|
||||
|
||||
{/* 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 className="flex items-center gap-3">
|
||||
{Array.from({ length: totalSteps }, (_, i) => i + 1).map((step) => {
|
||||
const isCurrentStep = step === currentStep;
|
||||
const isCompleted = step < currentStep;
|
||||
return (
|
||||
<div key={step} className="relative flex shrink-0 items-center justify-center">
|
||||
<div
|
||||
className={classNames("absolute rounded-full transition-all", {
|
||||
"h-2 w-2": !isCurrentStep,
|
||||
"h-3 w-3": isCurrentStep,
|
||||
"bg-emphasis": isCompleted || isCurrentStep,
|
||||
"bg-muted": !isCompleted && !isCurrentStep,
|
||||
})}
|
||||
/>
|
||||
{(isCompleted || isCurrentStep) && (
|
||||
<div
|
||||
className={classNames("bg-emphasis absolute rounded-full", {
|
||||
"h-1 w-1": !isCurrentStep,
|
||||
"h-1.5 w-1.5": isCurrentStep,
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Button onClick={handleSignOut} color="minimal" className="text-subtle h-7">
|
||||
{t("sign_out")}
|
||||
@@ -61,4 +77,3 @@ export const OnboardingLayout = ({ userEmail, currentStep, children }: Onboardin
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { ToggleGroup } from "@calcom/ui/components/form";
|
||||
import { InfoBadge } from "@calcom/ui/components/badge";
|
||||
|
||||
import type { InviteRole } from "../store/onboarding-store";
|
||||
|
||||
type RoleSelectorProps = {
|
||||
value: InviteRole;
|
||||
onValueChange: (value: InviteRole) => void;
|
||||
showInfoBadge?: boolean;
|
||||
};
|
||||
|
||||
export const RoleSelector = ({ value, onValueChange, showInfoBadge = false }: RoleSelectorProps) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="hidden items-center gap-2 md:flex">
|
||||
<span className="text-emphasis text-sm">{t("onboarding_invite_all_as")}</span>
|
||||
<ToggleGroup
|
||||
value={value}
|
||||
onValueChange={(val) => val && onValueChange(val as InviteRole)}
|
||||
options={[
|
||||
{ value: "MEMBER", label: t("members") },
|
||||
{ value: "ADMIN", label: t("onboarding_admins") },
|
||||
]}
|
||||
/>
|
||||
{showInfoBadge && <InfoBadge content={t("onboarding_modify_roles_later")} />}
|
||||
</div>
|
||||
{!showInfoBadge && (
|
||||
<span className="text-subtle text-sm">{t("onboarding_modify_roles_later")}</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import classNames from "classnames";
|
||||
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Avatar } from "@calcom/ui/components/avatar";
|
||||
@@ -95,7 +97,11 @@ export const OnboardingBrowserView = ({
|
||||
<h2 className="text-emphasis text-xl font-semibold leading-tight">
|
||||
{name || t("your_name")}
|
||||
</h2>
|
||||
<p className="text-default text-sm leading-normal">
|
||||
<p
|
||||
className={classNames("text-sm leading-normal", {
|
||||
"text-default": bio,
|
||||
"text-subtle italic": !bio,
|
||||
})}>
|
||||
{bio || t("onboarding_browser_view_default_bio")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
"use client";
|
||||
|
||||
import classNames from "classnames";
|
||||
|
||||
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 OnboardingOrganizationBrowserViewProps = {
|
||||
avatar?: string | null;
|
||||
name?: string;
|
||||
bio?: string;
|
||||
slug?: string;
|
||||
bannerUrl?: string | null;
|
||||
};
|
||||
|
||||
export const OnboardingOrganizationBrowserView = ({
|
||||
avatar,
|
||||
name,
|
||||
bio,
|
||||
slug,
|
||||
bannerUrl,
|
||||
}: OnboardingOrganizationBrowserViewProps) => {
|
||||
const { t } = useLocale();
|
||||
const webappUrl = WEBAPP_URL.replace(/^https?:\/\//, "");
|
||||
const displayUrl = `${webappUrl}/${slug || ""}`;
|
||||
|
||||
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",
|
||||
},
|
||||
];
|
||||
|
||||
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">
|
||||
{/* Organization Profile Header with Banner */}
|
||||
<div className="border-subtle flex flex-col border-b">
|
||||
<div className="relative">
|
||||
{/* Banner Image */}
|
||||
<div className="border-subtle relative h-40 w-full overflow-hidden rounded-t-xl border-b">
|
||||
{bannerUrl ? (
|
||||
<img src={bannerUrl} alt={name || ""} className="h-full w-full object-cover" />
|
||||
) : (
|
||||
<div className="bg-emphasis h-full w-full" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Organization Avatar - Overlaying the banner */}
|
||||
<div className="absolute -bottom-8 left-4">
|
||||
<Avatar
|
||||
size="lg"
|
||||
imageSrc={avatar || undefined}
|
||||
alt={name || ""}
|
||||
className="border-4 border-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Organization Info */}
|
||||
<div className="flex flex-col gap-2 px-4 pb-4 pt-12">
|
||||
<h2 className="text-emphasis text-xl font-semibold leading-tight">
|
||||
{name || t("organization_name")}
|
||||
</h2>
|
||||
<p
|
||||
className={classNames("text-sm leading-normal", {
|
||||
"text-default": bio,
|
||||
"text-subtle italic": !bio,
|
||||
})}>
|
||||
{bio || t("onboarding_browser_view_default_bio")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Events List */}
|
||||
<div className="flex flex-col overflow-y-hidden">
|
||||
{events.map((event, index) => (
|
||||
<div key={event.title} className="border opacity-30 first:border-t-0">
|
||||
<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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,136 @@
|
||||
"use client";
|
||||
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Avatar } from "@calcom/ui/components/avatar";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
|
||||
type OnboardingTeamsBrowserViewProps = {
|
||||
teams: Array<{ name: string }>;
|
||||
organizationLogo?: string | null;
|
||||
organizationName?: string;
|
||||
organizationBanner?: string | null;
|
||||
};
|
||||
|
||||
export const OnboardingTeamsBrowserView = ({
|
||||
teams,
|
||||
organizationLogo,
|
||||
organizationName,
|
||||
organizationBanner,
|
||||
}: OnboardingTeamsBrowserViewProps) => {
|
||||
const { t } = useLocale();
|
||||
const webappUrl = WEBAPP_URL.replace(/^https?:\/\//, "");
|
||||
|
||||
// Show placeholder if no teams or all teams are empty
|
||||
const hasValidTeams = teams.some((team) => team.name && team.name.trim().length > 0);
|
||||
|
||||
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">{webappUrl}/teams</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">
|
||||
{/* Teams Header with Banner */}
|
||||
<div className="border-subtle flex flex-col border-b">
|
||||
<div className="relative">
|
||||
{/* Banner Image */}
|
||||
<div className="border-subtle relative h-40 w-full overflow-hidden rounded-t-xl border-b">
|
||||
{organizationBanner ? (
|
||||
<img
|
||||
src={organizationBanner}
|
||||
alt={organizationName || ""}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="bg-emphasis h-full w-full" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Organization Logo - Overlaying the banner */}
|
||||
{organizationLogo && (
|
||||
<div className="absolute -bottom-8 left-4">
|
||||
<Avatar
|
||||
size="lg"
|
||||
imageSrc={organizationLogo}
|
||||
alt={organizationName || ""}
|
||||
className="border-4 border-white"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Teams Info */}
|
||||
<div className="flex flex-col gap-2 px-4 pb-4 pt-12">
|
||||
<h2 className="text-emphasis text-xl font-semibold leading-tight">{t("teams")}</h2>
|
||||
<p className="text-subtle text-sm leading-normal">
|
||||
{hasValidTeams
|
||||
? t("onboarding_teams_browser_view_subtitle")
|
||||
: t("onboarding_teams_browser_view_placeholder_subtitle")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Teams List */}
|
||||
<div className="flex flex-col overflow-y-auto">
|
||||
{hasValidTeams ? (
|
||||
teams
|
||||
.filter((team) => team.name && team.name.trim().length > 0)
|
||||
.map((team, index) => (
|
||||
<div key={index} className="">
|
||||
{index > 0 && <div className="border-subtle h-px border-t" />}
|
||||
<div className="flex items-center gap-3 px-5 py-4">
|
||||
<Avatar
|
||||
size="md"
|
||||
alt={team.name}
|
||||
className="border-2 border-white"
|
||||
fallback={
|
||||
<div className="bg-emphasis flex h-full w-full items-center justify-center text-white">
|
||||
<span className="text-sm font-semibold">{team.name.charAt(0).toUpperCase()}</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
||||
<h3 className="text-subtle text-sm font-semibold leading-none">{team.name}</h3>
|
||||
<p className="text-muted text-xs font-medium leading-tight">
|
||||
{t("onboarding_teams_browser_view_team_description")}
|
||||
</p>
|
||||
</div>
|
||||
<Icon name="arrow-right" className="text-subtle h-4 w-4" />
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center gap-3 px-5 py-12">
|
||||
<div className="bg-muted flex h-16 w-16 items-center justify-center rounded-full">
|
||||
<Icon name="users" className="text-subtle h-8 w-8" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-1 text-center">
|
||||
<p className="text-default text-sm font-semibold leading-tight">
|
||||
{t("onboarding_teams_browser_view_no_teams_title")}
|
||||
</p>
|
||||
<p className="text-subtle text-xs font-medium leading-tight">
|
||||
{t("onboarding_teams_browser_view_no_teams_description")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user