Scheduling infrastructure for absolutely everyone.
Fix/styles getting started v2 (#4224)
alannncf3bedabf92f1
diff --git a/apps/web/components/getting-started/components/CalendarSwitch.tsx b/apps/web/components/getting-started/components/CalendarSwitch.tsxindex 04aa303e017..f7424229ef9 100644--- a/apps/web/components/getting-started/components/CalendarSwitch.tsx+++ b/apps/web/components/getting-started/components/CalendarSwitch.tsx@@ -4,15 +4,18 @@ import showToast from "@calcom/lib/notification";import { trpc } from "@calcom/trpc/react";import { Switch } from "@calcom/ui/v2";+import classNames from "@lib/classNames";+interface ICalendarSwitchProps {title: string;externalId: string;type: string;isChecked: boolean;name: string;+ isLastItemInList?: boolean;}const CalendarSwitch = (props: ICalendarSwitchProps) => {- const { title, externalId, type, isChecked, name } = props;+ const { title, externalId, type, isChecked, name, isLastItemInList = false } = props;const utils = trpc.useContext();const mutation = useMutation<unknown,@@ -21,7 +24,7 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => {isOn: boolean;}>(- async ({ isOn }) => {+ async ({ isOn }: { isOn: boolean }) => {const body = {integration: type,externalId: externalId,@@ -63,8 +66,8 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => {});return (- <div className="flex flex-row items-center">- <div className="flex px-2 py-1">+ <div className={classNames("flex flex-row items-center", !isLastItemInList ? "mb-4" : "")}>+ <div className="flex pl-2"><Switchid={externalId}defaultChecked={isChecked}@@ -73,7 +76,7 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => {}}/></div>- <label className="text-sm" htmlFor={externalId}>+ <label className="ml-3 text-sm font-medium leading-5" htmlFor={externalId}>{name}</label></div>diff --git a/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx b/apps/web/components/getting-started/components/ConnectedCalendarItem.tsxindex 059844e992f..68ce96ca7fc 100644--- a/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx+++ b/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx@@ -1,6 +1,7 @@import { DotsHorizontalIcon } from "@heroicons/react/solid";import { useLocale } from "@calcom/lib/hooks/useLocale";+import { Button } from "@calcom/ui/v2";import { CalendarSwitch } from "./CalendarSwitch";@@ -27,31 +28,34 @@ const ConnectedCalendarItem = (prop: IConnectedCalendarItem) => {return (<><div className="flex flex-row items-center p-4">- <img src={logo} alt={name} className="h-8 w-8" />+ <img src={logo} alt={name} className="m-1 h-8 w-8" /><div className="mx-4">- <p className="text-sm font-bold">{name}</p>+ <p className="font-sans text-sm font-bold leading-5">+ {name}{" "}+ <span className="mx-1 rounded-[4px] bg-green-100 py-[2px] px-[6px] font-sans text-xs font-medium text-green-600">+ {t("default")}+ </span>+ </p><div className="fle-row flex"><spantitle={externalId}- className="max-w-44 overflow-hidden text-ellipsis whitespace-nowrap text-sm text-gray-500">+ className="max-w-44 mt-1 overflow-hidden text-ellipsis whitespace-nowrap font-sans text-sm text-gray-500">{externalId}{" "}</span>- <span className="mx-1 rounded-md bg-green-100 py-[2px] px-[6px] text-xs text-green-600">- {t("default")}- </span></div></div>- <button+ <Button+ color="minimal"type="button"- className="ml-auto flex h-9 w-9 rounded-md border border-gray-200 text-sm font-bold">- <DotsHorizontalIcon className="m-auto h-4 w-4" />- </button>+ className="ml-auto flex rounded-md border border-gray-200 py-[10x] px-4 font-sans text-sm">+ {t("edit")}+ </Button></div><div className="h-[1px] w-full border-b border-gray-200" /><div>- <ul className="space-y-1 p-3">- {calendars?.map((calendar) => (+ <ul className="p-4">+ {calendars?.map((calendar, i) => (<CalendarSwitchkey={calendar.externalId}externalId={calendar.externalId}@@ -59,6 +63,7 @@ const ConnectedCalendarItem = (prop: IConnectedCalendarItem) => {name={calendar.name || "Nameless Calendar"}type={integrationType}isChecked={calendar.isSelected}+ isLastItemInList={i === calendars.length - 1}/>))}</ul>diff --git a/apps/web/components/getting-started/components/StepCard.tsx b/apps/web/components/getting-started/components/StepCard.tsxindex 42fe2efc33c..de5904cf172 100644--- a/apps/web/components/getting-started/components/StepCard.tsx+++ b/apps/web/components/getting-started/components/StepCard.tsx@@ -1,6 +1,6 @@const StepCard: React.FC<{ children: React.ReactNode }> = (props) => {return (- <div className="mt-11 rounded-md border border-gray-200 bg-white p-0 dark:bg-black sm:p-8">+ <div className="mt-10 rounded-md border border-gray-200 bg-white p-4 dark:bg-black sm:p-8">{props.children}</div>);diff --git a/apps/web/components/getting-started/components/Steps.tsx b/apps/web/components/getting-started/components/Steps.tsxindex 084bc541526..fa1691b1232 100644--- a/apps/web/components/getting-started/components/Steps.tsx+++ b/apps/web/components/getting-started/components/Steps.tsx@@ -11,7 +11,7 @@ const Steps = (props: ISteps) => {const { maxSteps, currentStep, navigateToStep } = props;const { t } = useLocale();return (- <div className="space-y-2 pt-4">+ <div className="mt-6 space-y-2"><p className="text-xs font-medium text-gray-500 dark:text-white">{t("current_step_of_total", { currentStep: currentStep + 1, maxSteps })}</p>@@ -22,12 +22,12 @@ const Steps = (props: ISteps) => {key={`step-${index}`}onClick={() => navigateToStep(index)}className={classNames(- "h-1 w-1/4 bg-black dark:bg-white",+ "h-1 w-1/4 rounded-[1px] bg-black dark:bg-white",index < currentStep ? "cursor-pointer" : "")}/>) : (- <div key={`step-${index}`} className="h-1 w-1/4 bg-black bg-opacity-25" />+ <div key={`step-${index}`} className="h-1 w-1/4 rounded-[1px] bg-black bg-opacity-25" />);})}</div>diff --git a/apps/web/components/getting-started/steps-views/ConnectCalendars.tsx b/apps/web/components/getting-started/steps-views/ConnectCalendars.tsxindex 61646249591..b9d56ce5487 100644--- a/apps/web/components/getting-started/steps-views/ConnectCalendars.tsx+++ b/apps/web/components/getting-started/steps-views/ConnectCalendars.tsx@@ -58,7 +58,7 @@ const ConnectedCalendars = (props: IConnectCalendarsProps) => {{/* Connect calendars list */}{firstCalendar === undefined && queryIntegrations.data && queryIntegrations.data.items.length > 0 && (- <List className="divide-y divide-gray-200 rounded-md border border-gray-200 bg-white p-0 dark:bg-black">+ <List className="mx-1 divide-y divide-gray-200 rounded-md border border-gray-200 bg-white p-0 dark:bg-black sm:mx-0">{queryIntegrations.data &&queryIntegrations.data.items.map((item) => (<li key={item.title}>diff --git a/apps/web/components/getting-started/steps-views/SetupAvailability.tsx b/apps/web/components/getting-started/steps-views/SetupAvailability.tsxindex dede287c49c..4d22a3e74df 100644--- a/apps/web/components/getting-started/steps-views/SetupAvailability.tsx+++ b/apps/web/components/getting-started/steps-views/SetupAvailability.tsx@@ -81,7 +81,7 @@ const SetupAvailability = (props: ISetupAvailabilityProps) => {<Buttondata-testid="save-availability"type="submit"- className="my-6 w-full justify-center p-2 text-sm"+ className="mt-2 w-full justify-center p-2 text-sm sm:mt-8"disabled={availabilityForm.formState.isSubmitting}>{t("next_step_text")} <ArrowRightIcon className="ml-2 h-4 w-4 self-center" /></Button>diff --git a/apps/web/components/getting-started/steps-views/UserProfile.tsx b/apps/web/components/getting-started/steps-views/UserProfile.tsxindex adcf5fb62a3..e7725e9da2f 100644--- a/apps/web/components/getting-started/steps-views/UserProfile.tsx+++ b/apps/web/components/getting-started/steps-views/UserProfile.tsx@@ -6,7 +6,7 @@ import { useForm } from "react-hook-form";import { useLocale } from "@calcom/lib/hooks/useLocale";import { User } from "@calcom/prisma/client";import { trpc } from "@calcom/trpc/react";-import { Button, Input } from "@calcom/ui/v2";+import { Button, showToast, TextArea } from "@calcom/ui/v2";import { AvatarSSR } from "@components/ui/AvatarSSR";import ImageUploader from "@components/v2/settings/ImageUploader";@@ -35,26 +35,39 @@ const UserProfile = (props: IUserProfile) => {const utils = trpc.useContext();const router = useRouter();const createEventType = trpc.useMutation("viewer.eventTypes.create");- const onSuccess = async () => {- try {- if (eventTypes?.length === 0) {- await Promise.all(- DEFAULT_EVENT_TYPES.map(async (event) => {- return createEventType.mutate(event);- })- );++ const onSuccess = async (+ _data: string | undefined,+ context: Partial<{ bio: string; completedOnboarding: boolean; avatar: string }>+ ) => {+ if (context.avatar) {+ showToast(t("your_user_profile_updated_successfully"), "success");+ await utils.refetchQueries(["viewer.me"]);+ } else {+ try {+ if (eventTypes?.length === 0) {+ await Promise.all(+ DEFAULT_EVENT_TYPES.map(async (event) => {+ return createEventType.mutate(event);+ })+ );+ }+ } catch (error) {+ console.error(error);}- } catch (error) {- console.error(error);- }- await utils.refetchQueries(["viewer.me"]);- router.push("/");+ await utils.refetchQueries(["viewer.me"]);+ router.push("/");+ }+ };+ const onError = () => {+ showToast(t("problem_saving_user_profile"), "error");};const mutation = trpc.useMutation("viewer.updateProfile", {- onSuccess: onSuccess,+ onSuccess,+ onError,});- const onSubmit = handleSubmit((data) => {+ const onSubmit = handleSubmit((data: { bio: string }) => {const { bio } = data;mutation.mutate({@@ -91,7 +104,7 @@ const UserProfile = (props: IUserProfile) => {];return (- <form onSubmit={onSubmit} className="p-4 sm:p-0">+ <form onSubmit={onSubmit}><p className="font-cal text-sm">{t("profile_picture")}</p><div className="mt-4 flex flex-row items-center justify-start rtl:justify-end">{user && <AvatarSSR user={user} alt="Profile picture" className="h-16 w-16" />}@@ -129,13 +142,13 @@ const UserProfile = (props: IUserProfile) => {<label htmlFor="bio" className="mb-2 block text-sm font-medium text-gray-700">{t("about")}</label>- <Input+ <TextArea{...register("bio", { required: true })}ref={bioRef}type="text"name="bio"id="bio"- className="mt-1 block w-full rounded-sm border border-gray-300 px-3 py-2 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"+ className="mt-1 block h-[60px] w-full rounded-sm border border-gray-300 px-3 py-2 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"defaultValue={user?.bio || undefined}onChange={(event) => {setValue("bio", event.target.value);@@ -146,7 +159,7 @@ const UserProfile = (props: IUserProfile) => {{t("required")}</p>)}- <p className="mt-2 text-sm font-normal text-gray-600 dark:text-white">+ <p className="mt-2 font-sans text-sm font-normal text-gray-600 dark:text-white">{t("few_sentences_about_yourself")}</p></fieldset>diff --git a/apps/web/components/getting-started/steps-views/UserSettings.tsx b/apps/web/components/getting-started/steps-views/UserSettings.tsxindex 1f6ec0f62dd..ecdec06eb8d 100644--- a/apps/web/components/getting-started/steps-views/UserSettings.tsx+++ b/apps/web/components/getting-started/steps-views/UserSettings.tsx@@ -53,7 +53,7 @@ const UserSettings = (props: IUserSettingsProps) => {return (<form onSubmit={onSubmit}>- <div className="space-y-4">+ <div className="space-y-6">{/* Username textfield */}<UsernameAvailabilitycurrentUsername={currentUsername}@@ -97,8 +97,8 @@ const UserSettings = (props: IUserSettingsProps) => {className="mt-2 w-full rounded-md text-sm"/>- <p className="mt-3 flex flex-row text-xs leading-tight text-gray-500 dark:text-white">- {t("current_time")} {dayjs().tz(selectedTimeZone).format("LT").toString()}+ <p className="mt-3 flex flex-row font-sans text-xs leading-tight text-gray-500 dark:text-white">+ {t("current_time")} {dayjs().tz(selectedTimeZone).format("LT").toString().toLowerCase()}</p></div></div>diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsxindex d00cffb574e..c7468969713 100644--- a/apps/web/pages/event-types/[type].tsx+++ b/apps/web/pages/event-types/[type].tsx@@ -276,7 +276,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {if (message) {showToast(message, "error");}- showToast("Some error occured", "error");+ showToast("Some error occurred", "error");},});diff --git a/apps/web/pages/getting-started/[[...step]].tsx b/apps/web/pages/getting-started/[[...step]].tsxindex f6aeff986b1..08bd211b0de 100644--- a/apps/web/pages/getting-started/[[...step]].tsx+++ b/apps/web/pages/getting-started/[[...step]].tsx@@ -6,6 +6,7 @@ import { z } from "zod";import { getSession } from "@calcom/lib/auth";import { useLocale } from "@calcom/lib/hooks/useLocale";import { User } from "@calcom/prisma/client";+import { Button } from "@calcom/ui/v2";import prisma from "@lib/prisma";@@ -46,14 +47,13 @@ const OnboardingPage = (props: IOnboardingPageProps) => {const headers = [{- title: `${t("welcome_to_calcom")}!`,- subtitle: [`${t("we_just_need_basic_info")}`],- skipText: `${t("skip")}`,+ title: `${t("welcome_to_cal_header")}`,+ subtitle: [`${t("we_just_need_basic_info")}`, `${t("edit_form_later_subtitle")}`],},{title: `${t("connect_your_calendar")}`,subtitle: [`${t("connect_your_calendar_instructions")}`],- skipText: `${t("do_this_later")}`,+ skipText: `${t("connect_calendar_later")}`,},{title: `${t("set_availability")}`,@@ -61,7 +61,7 @@ const OnboardingPage = (props: IOnboardingPageProps) => {`${t("set_availability_getting_started_subtitle_1")}`,`${t("set_availability_getting_started_subtitle_2")}`,],- skipText: `${t("do_this_later")}`,+ skipText: `${t("set_my_availability_later")}`,},{title: `${t("nearly_there")}`,@@ -94,14 +94,14 @@ const OnboardingPage = (props: IOnboardingPageProps) => {<div className="mx-auto px-4 py-24"><div className="relative"><div className="sm:mx-auto sm:w-full sm:max-w-[600px]">- <div className="mx-auto sm:max-w-lg">+ <div className="mx-auto sm:max-w-[520px]"><header>- <p className="font-cal mb-2 text-[28px] leading-7 tracking-wider">+ <p className="font-cal mb-3 text-[28px] font-medium leading-7">{headers[currentStepIndex]?.title || "Undefined title"}</p>{headers[currentStepIndex]?.subtitle.map((subtitle, index) => (- <p className="text-sm font-normal text-gray-500" key={index}>+ <p className="font-sans text-sm font-normal text-gray-500" key={index}>{subtitle}</p>))}@@ -121,15 +121,16 @@ const OnboardingPage = (props: IOnboardingPageProps) => {</StepCard>{headers[currentStepIndex]?.skipText && (<div className="flex w-full flex-row justify-center">- <a+ <Button+ color="minimalSecondary"data-testid="skip-step"onClick={(event) => {event.preventDefault();goToIndex(currentStepIndex + 1);}}- className="mt-24 cursor-pointer px-4 py-2 text-sm">+ className="mt-24 cursor-pointer px-4 py-2 font-sans text-sm font-medium">{headers[currentStepIndex]?.skipText}- </a>+ </Button></div>)}</div>diff --git a/apps/web/playwright/onboarding.e2e.ts b/apps/web/playwright/onboarding.e2e.tsindex e136a08a4f2..29e5021c3e4 100644--- a/apps/web/playwright/onboarding.e2e.ts+++ b/apps/web/playwright/onboarding.e2e.ts@@ -13,7 +13,7 @@ test.describe("Onboarding", () => {await page.goto("/getting-started");// First step- await page.waitForSelector("text=Welcome to Cal.com");+const usernameInput = await page.locator("input[name=username]");await usernameInput.fill("new user onboarding");@@ -45,7 +45,7 @@ test.describe("Onboarding", () => {const isDisabled = await nextButtonCalendar.isDisabled();await expect(isDisabled).toBe(true);- const skipStepButton = await page.locator("a[data-testid=skip-step]");+ const skipStepButton = await page.locator("button[data-testid=skip-step]");await skipStepButton.click();await expect(page).toHaveURL(/.*setup-availability/);// @TODO: make sure calendar UL list has at least 1 item@@ -62,7 +62,7 @@ test.describe("Onboarding", () => {const isDisabled = await nextButtonAvailability.isDisabled();await expect(isDisabled).toBe(false);- const skipStepButton = await page.locator("a[data-testid=skip-step]");+ const skipStepButton = await page.locator("button[data-testid=skip-step]");await skipStepButton.click();await expect(page).toHaveURL(/.*user-profile/);});@@ -75,7 +75,7 @@ test.describe("Onboarding", () => {// Fourth stepconst finishButton = await page.locator("button[type=submit]");- const bioInput = await page.locator("input[name=bio]");+ const bioInput = await page.locator("textarea[name=bio]");await bioInput.fill("Something about me");const isDisabled = await finishButton.isDisabled();await expect(isDisabled).toBe(false);@@ -118,7 +118,7 @@ test.describe("Onboarding", () => {await page.goto("/getting-started/user-profile");// Fourth step- await page.waitForSelector("text=Nearly there!");+const finishButton = await page.locator("button[type=submit]");await finishButton.click();diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 3e20fbaaff6..52bc0f30ca7 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1153,12 +1153,12 @@"email_subject": "Email subject","add_dynamic_variables": "Add dynamic text variables","event_name_info": "The event type name",- "event_date_info":"The event date",- "event_time_info":"The event start time",- "location_info":"The event location",- "organizer_name_info":"Your name",- "additional_notes_info":"The Additional notes of booking",- "attendee_name_info":"The person booking's name",+ "event_date_info": "The event date",+ "event_time_info": "The event start time",+ "location_info": "The event location",+ "organizer_name_info": "Your name",+ "additional_notes_info": "The Additional notes of booking",+ "attendee_name_info": "The person booking's name","to": "To","attendee_required_enter_number": "This will require the attendee to enter a phone number when booking","workflow_turned_on_successfully": "{{workflowName}} workflow turned {{offOn}} successfully",@@ -1173,5 +1173,10 @@"workflow_example_3": "Send custom email when event is cancelled to host","workflow_example_4": "Send email reminder 24 hours before event starts to attendee","workflow_example_5": "Send SMS reminder 1 hour before event starts to attendee",- "workflow_example_6": "Send custom SMS when event is rescheduled to attendee"+ "workflow_example_6": "Send custom SMS when event is rescheduled to attendee",+ "welcome_to_cal_header": "Welcome to Cal.com!",+ "edit_form_later_subtitle": "You’ll be able to edit this later.",+ "connect_calendar_later": "I'll connect my calendar later",+ "set_my_availability_later": "I'll set my availability later",+ "problem_saving_user_profile": "There was a problem saving your data. Please try again or reach out to customer support."}diff --git a/packages/features/schedules/components/Schedule.tsx b/packages/features/schedules/components/Schedule.tsxindex 739aac76241..f273ca24b6e 100644--- a/packages/features/schedules/components/Schedule.tsx+++ b/packages/features/schedules/components/Schedule.tsx@@ -91,7 +91,7 @@ const DayRanges = ({return (<>{fields.map((field: { id: string }, index: number) => (- <div key={field.id} className="mb-2 flex rtl:space-x-reverse">+ <div key={field.id} className="mt-2 mb-2 flex rtl:space-x-reverse sm:mt-0"><TimeRangeField name={`${name}.${index}`} />{index === 0 && (<div className="hidden sm:inline">