## What does this PR do? - Redesigns and streamlines the onboarding flow for personal, team, and organization accounts - Consolidates shared components and improves code organization - Adds browser preview for better user experience during onboarding - Simplifies the personal onboarding flow by removing the video integration step - Enhances team onboarding with CSV upload functionality ## Visual Demo (For contributors especially) #### Image Demo: - The PR adds a new browser preview component that shows users how their profile/team will look during onboarding - Redesigned UI with a more consistent layout across all onboarding steps - Improved mobile responsiveness with better component organization ## Mandatory Tasks (DO NOT REMOVE) - [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. If N/A, write N/A here and check the checkbox. - [x] I confirm automated tests are in place that prove my fix is effective or that my feature works. ## How should this be tested? 1. Test the complete onboarding flow for personal accounts: - Start at `/onboarding/getting-started` - Proceed through personal details and calendar setup - Verify the flow completes successfully 2. Test the team onboarding flow: - Start at `/onboarding/getting-started` and select team - Complete team details - Test the invite options including CSV upload - Verify team creation works correctly 3. Test the organization onboarding flow: - Start at `/onboarding/getting-started` and select organization - Complete organization details and branding - Test member invitations - Verify organization creation works correctly 4. Verify browser preview functionality: - Check that the preview updates in real-time as you enter information - Confirm it displays correctly on different screen sizes ## 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
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { parseAsBoolean, useQueryState } from "nuqs";
|
|
import { useEffect, useState } from "react";
|
|
|
|
const STORAGE_KEY = "showWelcomeToCalcomModal";
|
|
|
|
export function useWelcomeToCalcomModal() {
|
|
const [welcomeToCalcomModal, setWelcomeToCalcomModal] = useQueryState(
|
|
"welcomeToCalcomModal",
|
|
parseAsBoolean.withDefault(false)
|
|
);
|
|
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Check query param first
|
|
if (welcomeToCalcomModal) {
|
|
setIsOpen(true);
|
|
return;
|
|
}
|
|
|
|
// Check sessionStorage as fallback (for cases where we redirect through personal onboarding)
|
|
if (typeof window !== "undefined" && sessionStorage.getItem(STORAGE_KEY) === "true") {
|
|
setIsOpen(true);
|
|
}
|
|
}, [welcomeToCalcomModal]);
|
|
|
|
const closeModal = () => {
|
|
setIsOpen(false);
|
|
// Remove the query param from URL
|
|
setWelcomeToCalcomModal(null);
|
|
// Also clear sessionStorage
|
|
if (typeof window !== "undefined") {
|
|
sessionStorage.removeItem(STORAGE_KEY);
|
|
}
|
|
};
|
|
|
|
return {
|
|
isOpen,
|
|
closeModal,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Helper function to set the flag that triggers the welcome modal.
|
|
* Use this before redirecting to ensure the modal shows after navigation.
|
|
*/
|
|
export function setShowWelcomeToCalcomModalFlag() {
|
|
if (typeof window !== "undefined") {
|
|
sessionStorage.setItem(STORAGE_KEY, "true");
|
|
}
|
|
}
|