Fix/styles getting started v2 (#4224)

* Fixes spacings style

* Fix spacings

* Update test

* Fix router push when image upload is success, also typo

* Fix styles for mobile

* Sumodule sync

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: zomars <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-09-06 19:34:33 -06:00
1 parent 58b3067b2b
commit f3bedabf92
13 files changed
+99 -72

No files matched your search

@@ -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">
<Switch
id={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>
@@ -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">
<span
title={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) => (
<CalendarSwitch
key={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>
@@ -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>
);
@@ -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>
@@ -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}>
@@ -81,7 +81,7 @@ const SetupAvailability = (props: ISetupAvailabilityProps) => {
<Button
data-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>
@@ -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);
})
);
}
} catch (error) {
console.error(error);
}
await utils.refetchQueries(["viewer.me"]);
router.push("/");
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);
}
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>
@@ -53,7 +53,7 @@ const UserSettings = (props: IUserSettingsProps) => {
return (
<form onSubmit={onSubmit}>
<div className="space-y-4">
<div className="space-y-6">
{/* Username textfield */}
<UsernameAvailability
currentUsername={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>
+1 -1
View File
@@ -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");
},
});
+12 -11
View File
@@ -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>
+5 -5
View File
@@ -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 step
const 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();
+12 -7
View File
@@ -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."
}
@@ -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">