## What does this PR do? Refactors the personal onboarding flow by creating reusable components for better code organization and maintainability. The changes include: - Creates shared components for the onboarding experience: `OnboardingLayout`, `OnboardingCard`, `InstallableAppCard`, and `SkipButton` - Implements a custom hook `useAppInstallation` to manage app installation state and callbacks - Enhances the video app connection step to automatically set the first connected video app as default - Improves the calendar connection flow with proper installation handling - Adds visual indicators for connected apps ## Visual Demo (For contributors especially) The refactored components maintain the same visual appearance while improving code structure and reusability. ## Mandatory Tasks - [x] I have self-reviewed the code - [x] I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - [x] 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 personal onboarding flow - Test connecting calendar apps in step 3 - Test connecting video apps in step 4 - Verify that the first connected video app is automatically set as default - Check that connected apps show the "connected" indicator - Verify that skipping steps works correctly ## 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
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
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="bg-muted border-muted relative rounded-xl border p-1">
|
|
<div className="rounded-inherit flex w-full flex-col items-start overflow-clip">
|
|
{/* 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 w-full flex-col gap-4 px-5 py-5">
|
|
{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-end gap-1 px-5 py-4">{footer}</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|