feat: Upgrade to Next 15 (#18834)

* wip

* update layoutHOC

* wip

* remove app router related code no longer used

* remove more

* await cookies, headers, params, serachparams

* update yarn.lock

* await cookies, headers, params, serachparams more

* update yarn lock again

* downgrade next-auth to 4.22.1

* update yarn lock

* fix

* update yarn lock

* fix type checks

* update yarn lock

* await headers and cookies

* restore pages folder

* restore yarn.lock

* update yarn.lock

* await headers and cookies

* remove

* await params in API routes

* updates

* restore next.config.js

* remove i18n from next.config.js

* Fixed tests

* Fixed types

* Removed duplicate favicon.ico

* Fixing more types

* ImageResponse moved to next/og

* Fixed prisma import issues

* dynamic import for @ewsjs/xhr

* remove deasync dep

* dynamic import for @tryvital/vital-node

* fix type checks

* add back turbopack command

* Type fix

* Removed unneeded file

* fix turbopack relative path errors

* add comments

* remove unneeded code

* Fixed build errors

* await apis

* use Promise<Params> type in defaultResponderForAppDir util

* refactor scim api route

* fix type checks

* separate app-routing.config into client-config and server-config

* wip

* refactor routing forms components

* revert unneeded changes for easier review

* fix

* fix

* use CustomTrans

* fix type

* fix unit tests

* fix type error

* fix build error

* fix build error

* fix build error

* fix warnings

* fix warnings

* upgrade @tremor/react and tailwindcss

* numCols -> numItems

* fix forgot-password e2e test

* fix 1 more e2e test

* fix login e2e test

* fix e2e tests

* fix e2e tests

* clean up

* remove error

* use tremor/react 2.11.0

* fix

* rename CustomTrans to ServerTrans

* address comment

* fix test

* fix ServerTrans

* fix

* fix type

* fix ServerTrans usages 1

* fix translations

* fix type checks

* fix type checks

* link styling

* fix

---------

Co-authored-by: Keith Williams <[email protected]>
Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-03-20 21:30:51 -03:00
1 parent 695a4d7a59
commit 8ad442f2be
263 files changed
+2002 -1663

No files matched your search

@@ -1,11 +1,19 @@
/* eslint-disable playwright/missing-playwright-await */
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { render, screen } from "@testing-library/react";
import { vi, describe, expect } from "vitest";
import type { AppFrontendPayload } from "@calcom/types/App";
import { AppCard } from "./AppCard";
vi.mock("next/navigation", () => ({
useRouter: vi.fn().mockReturnValue({
push: vi.fn(),
}),
usePathname: vi.fn(),
}));
describe("Tests for AppCard component", () => {
const mockApp: AppFrontendPayload = {
logo: "/path/to/logo.png",
@@ -34,7 +42,7 @@ describe("Tests for AppCard component", () => {
};
describe("Tests for app description", () => {
test("Should render the app name correctly and display app logo with correct alt text", () => {
it("Should render the app name correctly and display app logo with correct alt text", () => {
renderAppCard();
const appLogo = screen.getByAltText("Test App Logo");
const appName = screen.getByText("Test App");
@@ -43,14 +51,14 @@ describe("Tests for AppCard component", () => {
expect(appName).toBeInTheDocument();
});
test("Should render details button with correct href", () => {
it("Should render details button with correct href", () => {
renderAppCard();
const detailsButton = screen.getByText("details");
expect(detailsButton).toBeInTheDocument();
expect(detailsButton.closest("a")).toHaveAttribute("href", "/apps/test-app");
});
test("Should highlight the app name based on searchText", () => {
it("Should highlight the app name based on searchText", () => {
renderAppCard({}, { searchText: "test" });
const highlightedText = screen.getByTestId("highlighted-text");
expect(highlightedText).toBeInTheDocument();
@@ -58,13 +66,13 @@ describe("Tests for AppCard component", () => {
});
describe("Tests for app categories", () => {
test("Should show 'Template' badge if app is a template", () => {
it("Should show 'Template' badge if app is a template", () => {
renderAppCard({ isTemplate: true });
const templateBadge = screen.getByText("Template");
expect(templateBadge).toBeInTheDocument();
});
test("Should show 'default' badge if app is default or global", () => {
it("Should show 'default' badge if app is default or global", () => {
renderAppCard({ isDefault: true });
const defaultBadge = screen.getByText("default");
expect(defaultBadge).toBeInTheDocument();
@@ -1,7 +1,6 @@
import type { User } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import { sendPasswordResetEmail } from "@calcom/emails";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
@@ -40,6 +39,8 @@ const passwordResetRequest = async (user: Pick<User, "email" | "name" | "locale"
const t = await getTranslation(user.locale ?? "en", "common");
await guardAgainstTooManyPasswordResets(email);
const resetLink = await createPasswordReset(email);
const { sendPasswordResetEmail } = await import("@calcom/emails");
// send email in user language
await sendPasswordResetEmail({
language: t,
@@ -1,5 +1,4 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import Link from "next/link";
import { useMemo, useState } from "react";
import type { FieldError } from "react-hook-form";
@@ -9,10 +8,11 @@ import type { BookerEvent } from "@calcom/features/bookings/types";
import { WEBSITE_PRIVACY_POLICY_URL, WEBSITE_TERMS_URL } from "@calcom/lib/constants";
import { getPaymentAppData } from "@calcom/lib/getPaymentAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Form } from "@calcom/ui/components/form";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Form } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { useBookerStore } from "../../store";
import type { UseBookingFormReturnType } from "../hooks/useBookingForm";
@@ -141,12 +141,19 @@ export const BookEventForm = ({
severity="info"
title={t("unavailable_timeslot_title")}
message={
<Trans i18nKey="timeslot_unavailable_book_a_new_time">
The selected time slot is no longer available.{" "}
<button type="button" className="underline" onClick={onCancel}>
Please select a new time
</button>
</Trans>
<ServerTrans
t={t}
i18nKey="timeslot_unavailable_book_a_new_time"
components={[
<button
key="please-select-a-new-time-button"
type="button"
className="underline"
onClick={onCancel}>
Please select a new time
</button>,
]}
/>
}
/>
</div>
@@ -154,7 +161,8 @@ export const BookEventForm = ({
{!isPlatform && (
<div className="text-subtle my-3 w-full text-xs">
<Trans
<ServerTrans
t={t}
i18nKey="signing_up_terms"
components={[
<Link
@@ -3,8 +3,7 @@ import { render, fireEvent, screen } from "@testing-library/react";
import * as React from "react";
import type { UseFormReturn } from "react-hook-form";
import { FormProvider, useForm } from "react-hook-form";
import { expect } from "vitest";
import { vi } from "vitest";
import { expect, vi } from "vitest";
import PhoneInput from "@calcom/features/components/phone-input/PhoneInput";
@@ -1,11 +1,11 @@
import { Trans } from "next-i18next";
import { useRouter } from "next/navigation";
import type { IOutOfOfficeData } from "@calcom/lib/getUserAvailability";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import ServerTrans from "@calcom/web/components/ServerTrans";
interface IOutOfOfficeInSlotsProps {
date: string;
@@ -42,10 +42,10 @@ export const OutOfOfficeInSlots = (props: IOutOfOfficeInSlotsProps) => {
{fromUser?.displayName && toUser?.displayName && (
<p className="text-center text-sm">
<Trans
<ServerTrans
t={t}
i18nKey="ooo_slots_returning"
values={{ displayName: toUser.displayName }}
default="<1>{{ displayName }}</1> can take their meetings while they are away."
components={[<strong key="username">username</strong>]}
/>
</p>
@@ -1,3 +1,5 @@
"use client";
import { useMutation } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import { useRef, useState, useEffect } from "react";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { useEffect, useRef } from "react";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
@@ -1,6 +1,6 @@
import type { App } from "@prisma/client";
import type { Prisma } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { EventTypeAppsList } from "@calcom/app-store/utils";
import type { PaymentAppData } from "@calcom/lib/getPaymentAppData";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
import prisma from "@calcom/prisma";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
import prisma from "@calcom/prisma";
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import { get } from "lodash";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { Dispatch, SetStateAction } from "react";
import { useState } from "react";
import type { UseFormReturn } from "react-hook-form";
@@ -30,32 +30,6 @@ vi.mock("@calcom/trpc/server/routers/viewer/organizations/createTeams.handler",
createTeamsHandler: vi.fn(),
}));
vi.mock("next-i18next", () => ({
serverSideTranslations: vi.fn().mockImplementation(async () => {
return {
_nextI18Next: {
initialI18nStore: {
en: {
common: {},
},
},
userConfig: {
i18n: {
defaultLocale: "en",
locales: ["en"],
},
},
},
};
}),
i18n: {
language: "en",
languages: ["en"],
defaultLocale: "en",
getFixedT: () => (key: string) => key,
},
}));
vi.mock("@calcom/lib/domainManager/organization", () => ({
createDomain: vi.fn(),
}));
@@ -1,6 +1,5 @@
"use client";
import { Trans } from "next-i18next";
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -9,6 +8,7 @@ import { Badge } from "@calcom/ui/components/badge";
import { Dialog, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
import { DropdownActions, Table } from "@calcom/ui/components/table";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { subdomainSuffix } from "../../../../organizations/lib/orgDomains";
@@ -251,20 +251,12 @@ const DeleteOrgDialog = ({
cancelBtnText={t("cancel")}
variety="danger"
onConfirm={onConfirm}>
<Trans
i18nKey="admin_delete_organization_description"
components={{ li: <li />, ul: <ul className="ml-4 mt-5 list-disc space-y-2" /> }}>
<ul>
<li>
Teams that are member of this organization will also be deleted along with their event-types
</li>
<li>
Users that were part of the organization will not be deleted and their event-types will also
remain intact.
</li>
<li>Usernames would be changed to allow them to exist outside the organization</li>
</ul>
</Trans>
<ul className="ml-4 mt-5 list-disc space-y-2">
<li>{t("admin_delete_organization_description_1")}</li>
<li>{t("admin_delete_organization_description_2")}</li>
<li>{t("admin_delete_organization_description_3")}</li>
<li>{t("admin_delete_organization_description_4")}</li>
</ul>
</ConfirmationDialogContent>
</Dialog>
);
@@ -1,3 +1,5 @@
"use client";
import type { EventType, Payment } from "@prisma/client";
import { Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
import type { StripeElementLocale, StripeElements, StripePaymentElementOptions } from "@stripe/stripe-js";
@@ -10,8 +10,9 @@ import { uuid } from "short-uuid";
import { deriveOrgNameFromEmail } from "@calcom/ee/organizations/components/CreateANewOrganizationForm";
import { deriveSlugFromEmail } from "@calcom/ee/organizations/components/CreateANewOrganizationForm";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
import slugify from "@calcom/lib/slugify";
import { telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { telemetryEventTypes } from "@calcom/lib/telemetry";
import { UserPermissionRole } from "@calcom/prisma/enums";
import { CreationSource } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
@@ -1,3 +1,5 @@
"use client";
import { keepPreviousData } from "@tanstack/react-query";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
@@ -9,7 +11,8 @@ import { MemberInvitationModalWithoutMembers } from "@calcom/features/ee/teams/c
import { APP_NAME } from "@calcom/lib/constants";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
import { telemetryEventTypes } from "@calcom/lib/telemetry";
import { MembershipRole } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
@@ -1,5 +1,4 @@
import { useSession } from "next-auth/react";
import { Trans } from "next-i18next";
import type { FormEvent } from "react";
import { useMemo, useRef, useState } from "react";
import { Controller, useForm } from "react-hook-form";
@@ -13,10 +12,10 @@ import { CreationSource } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc";
import { trpc } from "@calcom/trpc";
import { isEmail } from "@calcom/trpc/server/routers/viewer/teams/util";
import { TextAreaField } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent, DialogFooter } from "@calcom/ui/components/dialog";
import { TextAreaField } from "@calcom/ui/components/form";
import { Form } from "@calcom/ui/components/form";
import { Label } from "@calcom/ui/components/form";
import { TextField } from "@calcom/ui/components/form";
@@ -24,6 +23,7 @@ import { Select } from "@calcom/ui/components/form";
import { ToggleGroup } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
import type { PendingMember } from "../lib/types";
import { GoogleWorkspaceInviteButton } from "./GoogleWorkspaceInviteButton";
@@ -205,10 +205,15 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
description={
IS_TEAM_BILLING_ENABLED_CLIENT && !currentOrg ? (
<span className="text-subtle text-sm leading-tight">
<Trans i18nKey="invite_new_member_description">
Note: This will <span className="text-emphasis font-medium">cost an extra seat ($15/m)</span>{" "}
on your subscription.
</Trans>
<ServerTrans
t={t}
i18nKey="invite_new_member_description"
components={[
<span key="invite_new_member_description" className="text-emphasis font-medium">
cost an extra seat ($15/m)
</span>,
]}
/>
</span>
) : null
}>
@@ -5,6 +5,20 @@ import { vi } from "vitest";
import type { CreateBtnProps } from "./CreateButton";
import { CreateButtonWithTeamsList } from "./CreateButtonWithTeamsList";
const mockRouter = {
push: vi.fn((path: string) => {
return;
}),
};
vi.mock("next/navigation", async (importOriginal) => {
const actual = await importOriginal<typeof import("next/navigation")>();
return {
...actual,
useRouter: vi.fn(() => mockRouter),
};
});
const runtimeMock = async (data: Array<any>) => {
const updatedTrpc = {
viewer: {
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { WorkflowActions } from "@calcom/prisma/enums";
import { WorkflowTemplates, WorkflowTriggerEvents } from "@calcom/prisma/enums";
@@ -89,9 +89,9 @@ export async function getAllRemindersToDelete(): Promise<RemindersToDeleteType[]
},
};
const select: Prisma.WorkflowReminderSelect = {
const select = Prisma.validator<Prisma.WorkflowReminderSelect>()({
referenceId: true,
};
});
const remindersToDelete = await getWorkflowReminders(whereFilter, select);
@@ -109,10 +109,10 @@ export async function getAllRemindersToCancel(): Promise<RemindersToCancelType[]
},
};
const select: Prisma.WorkflowReminderSelect = {
const select = Prisma.validator<Prisma.WorkflowReminderSelect>()({
referenceId: true,
id: true,
};
});
const remindersToCancel = await getWorkflowReminders(whereFilter, select);
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { DYNAMIC_TEXT_VARIABLES, FORMATTED_DYNAMIC_TEXT_VARIABLES } from "./constants";
@@ -1,6 +1,5 @@
"use client";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState, useEffect, useRef, useMemo } from "react";
@@ -24,6 +23,7 @@ import {
SheetTitle,
} from "@calcom/ui/components/sheet";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
type TeamMemberItemProps = {
member: Omit<TeamMember, "defaultScheduleId"> & { weight?: number };
@@ -302,15 +302,19 @@ export const EditWeightsForAllTeamMembers = ({
<SheetHeader>
<SheetTitle>{t("edit_team_member_weights")}</SheetTitle>
<div className="text-subtle text-sm">
<Trans i18nKey="weights_description">
Weights determine how meetings are distributed among hosts.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="weights_description"
components={[
<Link
key="weights_description"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>,
]}
/>
</div>
</SheetHeader>
@@ -1,5 +1,3 @@
import { Trans } from "next-i18next";
import Link from "next/link";
import type { Dispatch, SetStateAction } from "react";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -19,6 +17,7 @@ import classNames from "@calcom/ui/classNames";
import { Dialog, DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog";
import type { CheckedSelectOption } from "./CheckedTeamSelect";
import WeightDescription from "./WeightDescription";
interface IDialog {
isOpenDialog: boolean;
@@ -99,18 +98,6 @@ export const PriorityDialog = (
);
};
export const weightDescription = (
<Trans i18nKey="weights_description">
Weights determine how meetings are distributed among hosts.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>
</Trans>
);
export function sortHosts(
hostA: { priority: number | null; weight: number | null },
hostB: { priority: number | null; weight: number | null },
@@ -167,7 +154,7 @@ export const WeightDialog = (props: IDialog & { customClassNames?: WeightDialogC
return (
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
<DialogContent title={t("set_weight")} description={weightDescription}>
<DialogContent title={t("set_weight")} description={<WeightDescription t={t} />}>
<div className={classNames("mb-4 mt-2", customClassNames?.container)}>
<Label className={customClassNames?.label}>
{t("weight_for_user", { userName: option.label })}
@@ -1,6 +1,5 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import { ErrorMessage } from "@hookform/error-message";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useEffect, useState } from "react";
import { Controller, useFieldArray } from "react-hook-form";
@@ -23,11 +22,12 @@ import type {
import LocationSelect from "@calcom/features/form/components/LocationSelect";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Input } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import { Input } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type TEventTypeLocation = Pick<EventTypeSetupProps["eventType"], "locations">;
export type TLocationOptions = Pick<EventTypeSetupProps, "locationOptions">["locationOptions"];
@@ -443,14 +443,18 @@ const Locations: React.FC<LocationsProps> = ({
<Icon name="check" className="h-3 w-3" />
</div>
<p className="text-default text-sm">
<Trans i18nKey="event_type_requires_google_calendar">
The “Add to calendar” for this event type needs to be a Google Calendar for Meet to work.
Connect it
<Link className="cursor-pointer text-blue-500 underline" href="/apps/google-calendar">
here
</Link>
.
</Trans>
<ServerTrans
t={t}
i18nKey="event_type_requires_google_calendar"
components={[
<Link
key="event_type_requires_google_calendar"
className="cursor-pointer text-blue-500 underline"
href="/apps/google-calendar">
here
</Link>,
]}
/>
</p>
</div>
)}
@@ -480,13 +484,18 @@ const Locations: React.FC<LocationsProps> = ({
</ul>
{props.showAppStoreLink && !isPlatorm && (
<p className="text-default mt-2 text-sm">
<Trans i18nKey="cant_find_the_right_conferencing_app_visit_our_app_store">
Can&apos;t find the right conferencing app? Visit our
<Link className="cursor-pointer text-blue-500 underline" href="/apps/categories/conferencing">
App Store
</Link>
.
</Trans>
<ServerTrans
t={t}
i18nKey="cant_find_the_right_conferencing_app_visit_our_app_store"
components={[
<Link
key="cant_find_the_right_conferencing_app_visit_our_app_store"
className="cursor-pointer text-blue-500 underline"
href="/apps/categories/conferencing">
App Store
</Link>,
]}
/>
</p>
)}
</div>
@@ -0,0 +1,22 @@
import type { TFunction } from "i18next";
import Link from "next/link";
import ServerTrans from "@calcom/web/components/ServerTrans";
export default function WeightDescription({ t }: { t: TFunction }) {
return (
<ServerTrans
t={t}
i18nKey="weights_description"
components={[
<Link
key="weights_description"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>,
]}
/>
);
}
@@ -1,8 +1,8 @@
import { Trans } from "next-i18next";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import classNames from "@calcom/ui/classNames";
import type { DialogProps } from "@calcom/ui/components/dialog";
import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
import ServerTrans from "@calcom/web/components/ServerTrans";
export function DeleteDialog({
isManagedEvent,
@@ -32,14 +32,14 @@ export function DeleteDialog({
onDelete(eventTypeId);
}}>
<p className="mt-5">
<Trans
i18nKey={`delete${isManagedEvent}_event_type_description`}
components={{ li: <li />, ul: <ul className="ml-4 list-disc" /> }}>
<ul>
<li>Members assigned to this event type will also have their event types deleted.</li>
<li>Anyone who they&apos;ve shared their link with will no longer be able to book using it.</li>
{isManagedEvent ? (
<ul className="ml-4 list-disc">
<li>{t("delete_managed_event_type_description_1")}</li>
<li>{t("delete_managed_event_type_description_2")}</li>
</ul>
</Trans>
) : (
t("delete_event_type_description")
)}
</p>
</ConfirmationDialogContent>
</Dialog>
@@ -1,8 +1,7 @@
import { Trans } from "next-i18next";
import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
import ServerTrans from "@calcom/web/components/ServerTrans";
interface ManagedEventDialogProps {
slugExistsChildrenDialogOpen: ChildrenEventType[];
@@ -31,8 +30,13 @@ export default function ManagedEventDialog(props: ManagedEventDialogProps) {
cancelBtnText={t("go_back")}
onConfirm={onConfirm}>
<p className="mt-5">
<Trans
i18nKey="managed_event_dialog_information"
<ServerTrans
t={t}
i18nKey={
slugExistsChildrenDialogOpen.length > 1
? "managed_event_dialog_information_other"
: "managed_event_dialog_information_one"
}
values={{
names: `${slugExistsChildrenDialogOpen
.map((ch) => ch.owner.name)
@@ -42,7 +46,6 @@ export default function ManagedEventDialog(props: ManagedEventDialogProps) {
} ${slugExistsChildrenDialogOpen.map((ch) => ch.owner.name).slice(-1)}`,
slug,
}}
count={slugExistsChildrenDialogOpen.length}
/>
</p>{" "}
<p className="mt-5">{t("managed_event_dialog_clarification")}</p>
@@ -1,13 +1,13 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import { useState } from "react";
import type { InputClassNames, SettingsToggleClassNames } from "@calcom/features/eventtypes/lib/types";
import { InputField } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog";
import { InputField } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type EmailNotificationToggleCustomClassNames = SettingsToggleClassNames & {
confirmationDialog?: {
@@ -53,15 +53,7 @@ export const DisableAllEmailsSetting = ({
className={customClassNames?.confirmationDialog?.container}>
<p
className={classNames("text-default text-sm", customClassNames?.confirmationDialog?.description)}>
<Trans i18nKey="disable_attendees_emails_description">
This will disable all emails to {recipient}. This includes booking confirmations, requests,
reschedules and reschedule requests, cancellation emails, and any other emails related to
booking updates.
<br />
<br />
It is your responsibility to ensure that your {recipient} are aware of any bookings and changes
to their bookings.
</Trans>
<ServerTrans t={t} i18nKey="disable_attendees_emails_description" values={{ recipient }} />
</p>
<p
className={classNames(
@@ -1,6 +1,5 @@
import * as RadioGroup from "@radix-ui/react-radio-group";
import type { UnitTypeLongPlural } from "dayjs";
import { Trans } from "next-i18next";
import type { Dispatch, SetStateAction } from "react";
import { useEffect, useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
@@ -17,6 +16,7 @@ import { CheckboxField } from "@calcom/ui/components/form";
import { Input } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import { RadioField } from "@calcom/ui/components/radio";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type RequiresConfirmationCustomClassNames = SettingsToggleClassNames & {
radioGroupContainer?: string;
@@ -163,70 +163,70 @@ export default function RequiresConfirmationController({
)}
label={
<>
<Trans
<ServerTrans
t={t}
i18nKey="when_booked_with_less_than_notice"
defaults="When booked with less than <time></time> notice"
components={{
time: (
<div className="mx-2 inline-flex items-center">
<Input
type="number"
min={1}
disabled={requiresConfirmationLockedProps.disabled}
onChange={(evt) => {
const val = Number(evt.target?.value);
components={[
<div
key="when_booked_with_less_than_notice"
className="mx-2 inline-flex items-center">
<Input
type="number"
min={1}
disabled={requiresConfirmationLockedProps.disabled}
onChange={(evt) => {
const val = Number(evt.target?.value);
setRequiresConfirmationSetup({
unit:
requiresConfirmationSetup?.unit ??
defaultRequiresConfirmationSetup.unit,
time: val,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.time",
val,
{ shouldDirty: true }
);
}}
className={classNames(
"border-default h-9! !m-0 block w-16 rounded-r-none border-r-0 text-sm [appearance:textfield] focus:z-10 focus:border-r",
customClassNames?.conditionalConfirmationRadio?.timeInput
)}
defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}
/>
<label
className={classNames(
requiresConfirmationLockedProps.disabled && "cursor-not-allowed"
)}>
<Select
inputId="notice"
options={options}
isSearchable={false}
isDisabled={requiresConfirmationLockedProps.disabled}
className={
customClassNames?.conditionalConfirmationRadio?.timeUnitSelect
}
innerClassNames={{
control: "rounded-l-none max-h-4 px-3 bg-subtle",
}}
onChange={(opt) => {
setRequiresConfirmationSetup({
unit:
requiresConfirmationSetup?.unit ??
defaultRequiresConfirmationSetup.unit,
time: val,
time:
requiresConfirmationSetup?.time ??
defaultRequiresConfirmationSetup.time,
unit: opt?.value as UnitTypeLongPlural,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.time",
val,
"metadata.requiresConfirmationThreshold.unit",
opt?.value as UnitTypeLongPlural,
{ shouldDirty: true }
);
}}
className={classNames(
"border-default h-9! !m-0 block w-16 rounded-r-none border-r-0 text-sm [appearance:textfield] focus:z-10 focus:border-r",
customClassNames?.conditionalConfirmationRadio?.timeInput
)}
defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}
defaultValue={defaultValue}
/>
<label
className={classNames(
requiresConfirmationLockedProps.disabled && "cursor-not-allowed"
)}>
<Select
inputId="notice"
options={options}
isSearchable={false}
isDisabled={requiresConfirmationLockedProps.disabled}
className={
customClassNames?.conditionalConfirmationRadio?.timeUnitSelect
}
innerClassNames={{
control: "rounded-l-none max-h-4 px-3 bg-subtle",
}}
onChange={(opt) => {
setRequiresConfirmationSetup({
time:
requiresConfirmationSetup?.time ??
defaultRequiresConfirmationSetup.time,
unit: opt?.value as UnitTypeLongPlural,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.unit",
opt?.value as UnitTypeLongPlural,
{ shouldDirty: true }
);
}}
defaultValue={defaultValue}
/>
</label>
</div>
),
}}
</label>
</div>,
]}
/>
</>
}
@@ -1,4 +1,3 @@
import { Trans } from "next-i18next";
import Link from "next/link";
import { useFormContext } from "react-hook-form";
@@ -10,9 +9,10 @@ import type { FormValues, EventTypeSetupProps } from "@calcom/features/eventtype
import useAppsData from "@calcom/lib/hooks/useAppsData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type EventType = Pick<EventTypeSetupProps, "eventType">["eventType"] &
EventTypeAppCardComponentProps["eventType"];
@@ -97,22 +97,19 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {
severity={appsDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={<div className="flex h-full items-center">{appsDisableProps.LockedIcon}</div>}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`apps_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{appsDisableProps.isLocked
? "will be able to see the active apps but will not be able to edit any app settings"
: "will be able to see the active apps and will be able to edit any app settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -162,12 +159,15 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {
{t("available_apps_lower_case")}
</h2>
<p className="text-default mb-6 text-sm font-normal">
<Trans i18nKey="available_apps_desc">
View popular apps below and explore more in our &nbsp;
<Link className="cursor-pointer underline" href="/apps">
App Store
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="available_apps_desc"
components={[
<Link key="available_apps_desc" className="cursor-pointer underline" href="/apps">
App Store
</Link>,
]}
/>
</p>
</>
) : null}
@@ -1,4 +1,4 @@
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import Link from "next/link";
import { useEffect, useRef, useState } from "react";
import type { ComponentProps, Dispatch, SetStateAction } from "react";
@@ -12,7 +12,7 @@ import AddMembersWithSwitch, {
import AssignAllTeamMembers from "@calcom/features/eventtypes/components/AssignAllTeamMembers";
import type { ChildrenEventTypeSelectCustomClassNames } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import ChildrenEventTypeSelect from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import { sortHosts, weightDescription } from "@calcom/features/eventtypes/components/HostEditDialogs";
import { sortHosts } from "@calcom/features/eventtypes/components/HostEditDialogs";
import type {
FormValues,
TeamMember,
@@ -28,8 +28,10 @@ import { Label } from "@calcom/ui/components/form";
import { Select } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import { RadioAreaGroup as RadioArea } from "@calcom/ui/components/radio";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { EditWeightsForAllTeamMembers } from "../../EditWeightsForAllTeamMembers";
import WeightDescription from "../../WeightDescription";
export type EventTeamAssignmentTabCustomClassNames = {
assignmentType?: {
@@ -114,16 +116,20 @@ const ChildrenEventTypesList = ({
);
};
const FixedHostHelper = (
<Trans i18nKey="fixed_host_helper">
Add anyone who needs to attend the event.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#fixed-hosts">
Learn more
</Link>
</Trans>
const FixedHostHelper = ({ t }: { t: TFunction }) => (
<ServerTrans
t={t}
i18nKey="fixed_host_helper"
components={[
<Link
key="fixed_host_helper"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#fixed-hosts">
Learn more
</Link>,
]}
/>
);
type FixedHostsCustomClassNames = SettingsToggleClassNames & {
@@ -172,7 +178,7 @@ const FixedHosts = ({
"text-subtle max-w-full break-words text-sm leading-tight",
customClassNames?.description
)}>
{FixedHostHelper}
<FixedHostHelper t={t} />
</p>
</div>
<div className="border-subtle rounded-b-md border border-t-0 px-6">
@@ -212,7 +218,7 @@ const FixedHosts = ({
data-testid="fixed-hosts-switch"
toggleSwitchAtTheEnd={true}
title={t("fixed_hosts")}
description={FixedHostHelper}
description={<FixedHostHelper t={t} />}
checked={isDisabled && !assignAllTeamMembers}
hideSwitch={assignAllTeamMembers}
labelClassName={classNames("text-sm", customClassNames?.label)}
@@ -334,7 +340,7 @@ const RoundRobinHosts = ({
render={({ field: { value: isRRWeightsEnabled, onChange } }) => (
<SettingsToggle
title={t("enable_weights")}
description={weightDescription}
description={<WeightDescription t={t} />}
checked={isRRWeightsEnabled}
switchContainerClassName={customClassNames?.enableWeights?.container}
labelClassName={customClassNames?.enableWeights?.label}
@@ -1,5 +1,4 @@
import type { Webhook } from "@prisma/client";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -13,11 +12,12 @@ import { subscriberUrlReserved } from "@calcom/features/webhooks/lib/subscriberU
import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { showToast } from "@calcom/ui/components/toast";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent } from "@calcom/ui/components/dialog";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "eventType">) => {
const { t } = useLocale();
@@ -122,25 +122,21 @@ export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "event
severity={webhooksDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={
<div className="flex h-full items-center">{webhooksDisableProps.LockedIcon}</div>
}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`webhooks_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{webhooksDisableProps.isLocked
? "will be able to see the active webhooks but will not be able to edit any webhook settings"
: "will be able to see the active webhooks and will be able to edit any webhook settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -181,14 +177,18 @@ export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "event
</div>
<p className="text-default text-sm font-normal">
<Trans i18nKey="edit_or_manage_webhooks">
If you wish to edit or manage your web hooks, please head over to &nbsp;
<Link
className="cursor-pointer font-semibold underline"
href="/settings/developer/webhooks">
webhooks settings
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="edit_or_manage_webhooks"
components={[
<Link
key="edit_or_manage_webhooks"
className="cursor-pointer font-semibold underline"
href="/settings/developer/webhooks">
webhooks settings
</Link>,
]}
/>
</p>
</div>
</>
@@ -2,7 +2,6 @@ import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useFormContext } from "react-hook-form";
import { Trans } from "react-i18next";
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
@@ -15,14 +14,15 @@ import { HttpError } from "@calcom/lib/http-error";
import { WorkflowActions } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/components/icon";
import { Tooltip } from "@calcom/ui/components/tooltip";
import classNames from "@calcom/ui/classNames";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Switch } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
type PartialWorkflowType = Pick<WorkflowType, "name" | "activeOn" | "isOrg" | "steps" | "id" | "readOnly">;
@@ -252,22 +252,19 @@ function EventWorkflowsTab(props: Props) {
severity={workflowsDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={<div className="flex h-full items-center">{workflowsDisableProps.LockedIcon}</div>}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`workflows_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{workflowsDisableProps.isLocked
? "will be able to see the active workflows but will not be able to edit any workflow settings"
: "will be able to see the active workflow and will be able to edit any workflow settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -1,5 +1,5 @@
import { ErrorMessage } from "@hookform/error-message";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { Controller, useFormContext } from "react-hook-form";
import type { z } from "zod";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { useQueryState } from "nuqs";
import { type ReactNode, useMemo, useRef, useState } from "react";
@@ -1,5 +1,4 @@
import * as RadioGroup from "@radix-ui/react-radio-group";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useCallback, useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
@@ -8,10 +7,11 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { BookerLayouts, defaultBookerLayoutSettings } from "@calcom/prisma/zod-utils";
import { bookerLayoutOptions, type BookerLayoutSettings } from "@calcom/prisma/zod-utils";
import type { RouterOutputs } from "@calcom/trpc/react";
import { Label } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import { Label } from "@calcom/ui/components/form";
import { CheckboxField } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
import SectionBottomActions from "./SectionBottomActions";
@@ -229,20 +229,26 @@ const BookerLayoutFields = ({
</div>
{disableFields && (
<p className="text-sm">
<Trans i18nKey="bookerlayout_override_global_settings">
You can manage this for all your event types in Settings {"-> "}
<Link target="_blank" href="/settings/my-account/appearance" className="underline">
Appearance
</Link>{" "}
or{" "}
<Button
onClick={onOverrideSettings}
color="minimal"
className="h-fit p-0 font-normal underline hover:bg-transparent focus-visible:bg-transparent">
Override
</Button>{" "}
for this event only.
</Trans>
<ServerTrans
t={t}
i18nKey="bookerlayout_override_global_settings"
components={[
<Link
key="appearance-link"
target="_blank"
href="/settings/my-account/appearance"
className="underline">
Appearance
</Link>,
<Button
key="override-button"
onClick={onOverrideSettings}
color="minimal"
className="h-fit p-0 font-normal underline hover:bg-transparent focus-visible:bg-transparent">
Override
</Button>,
]}
/>
</p>
)}
</div>
@@ -7,7 +7,6 @@ import {
getFilteredRowModel,
useReactTable,
} from "@tanstack/react-table";
import { Trans } from "next-i18next";
import { useEffect, useMemo, useRef, useState } from "react";
import { useFormState } from "react-hook-form";
@@ -25,13 +24,14 @@ import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/components/icon";
import { SkeletonText } from "@calcom/ui/components/skeleton";
import { Tooltip } from "@calcom/ui/components/tooltip";
import { Avatar } from "@calcom/ui/components/avatar";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Icon } from "@calcom/ui/components/icon";
import { SkeletonText } from "@calcom/ui/components/skeleton";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
import CreateNewOutOfOfficeEntryButton from "./CreateNewOutOfOfficeEntryButton";
import { CreateOrEditOutOfOfficeEntryModal } from "./CreateOrEditOutOfOfficeModal";
@@ -197,14 +197,13 @@ function OutOfOfficeEntriesListContent() {
</p>
<p className="px-2">
{item.toUser?.username ? (
<Trans
<ServerTrans
t={t}
i18nKey="ooo_forwarding_to"
values={{
username: item.toUser?.username,
}}
components={{
span: <span className="text-subtle font-bold" />,
}}
components={[<span key="ooo-username" className="text-subtle font-bold" />]}
/>
) : (
<>{t("ooo_not_forwarding")}</>