Skip to content

Commit 8afe87f

Browse files
refactor: Move trpc-dependent components from features to web [1] (calcom#25859)
* refactor: migrate UnconfirmedBookingBadge from features to apps/web Move UnconfirmedBookingBadge.tsx from packages/features/bookings/ to apps/web/modules/bookings/components/ as part of the architectural refactor to remove trpc client imports from the features layer. Also removes unused preserveBookingsQueryParams function from Navigation.tsx. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: move shell navigation and badges to apps/web Move shell navigation components and trpc-using badges from packages/features to apps/web/modules to fix circular dependency: - Move navigation folder to apps/web/modules/shell/navigation/ - Move TeamInviteBadge.tsx to apps/web/modules/shell/ - Create Shell wrapper in apps/web that provides MobileNavigationContainer - Update all Shell imports in apps/web to use the new wrapper - Remove MobileNavigationContainer default from features Shell.tsx - Fix pre-existing lint warnings in touched files This establishes the pattern for migrating React components that use trpc hooks from the features layer to the web app layer, ensuring proper dependency direction: apps/web imports from packages/features, never the reverse. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: move SideBar.tsx to apps/web to fix build error SideBar.tsx was importing Navigation from the moved navigation folder, causing a build error. Moving SideBar.tsx to apps/web and updating the features Shell to not have a default SidebarContainer fixes this. The web Shell wrapper now provides both the default SidebarContainer and MobileNavigationContainer, maintaining the injection pattern. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * revert * revert * revert * wip * wip * wip * wip * wip * wip * not used anywhere * wip * wip * wip * wip * fix * fix * wip * wip * wip * wip * wip * fix * fix * fix * fix * migrate * migrate admin-adpi * wip * feat: migrate organization settings components from packages/features to apps/web/modules - Migrate profile.tsx, appearance.tsx, general.tsx, privacy.tsx, guest-notifications.tsx, delegationCredential.tsx, other-team-members-view.tsx, other-team-profile-view.tsx - Migrate attributes directory (AttributesForm.tsx, DeleteAttributeModal.tsx, ListSkeleton.tsx, attributes-create-view.tsx, attributes-edit-view.tsx, attributes-list-view.tsx) - Migrate admin directory (AdminOrgEditPage.tsx, AdminOrgPage.tsx, WorkspacePlatformPage.tsx) - Update all page imports to use new paths from ~/settings/organizations/ - Update relative imports in migrated files to use @calcom/features paths - Fix lint warnings in migrated files Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update test import path after migration Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: remove unnecessary test-setup import (already in vitest config) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * wip * refactor: delete original files after migration to apps/web/modules Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * fix * fix * fix * wip * refactor more * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * mv * update import paths * wip * wip * fix * fix * fix * fix * fix * fix * fix * mv * mv * mv * fix * wip * wip * fix * fix * fix * fix: make test mocks resilient to vi.resetAllMocks() Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: fix AttributeForm test failures Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * fix * refactor: move ee files to apps/web/modules/ee/ folder - Move teams, workflows, and organizations folders to apps/web/modules/ee/ - Add LICENSE file to apps/web/modules/ee/ - Update all import paths from ~/teams/ to ~/ee/teams/ - Update all import paths from ~/settings/organizations/ to ~/ee/organizations/ - Remove duplicate MemberInvitationModal copy.tsx file Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: move useHasPaidPlan and dependent files to apps/web/modules - Move useHasPaidPlan.ts from packages/features/billing/hooks to apps/web/modules/billing/hooks - Move intercom files from packages/features/ee/support to apps/web/modules/ee/support - Move ContactMenuItem.tsx and dependencies (freshchat, helpscout, zendesk) to apps/web/modules/ee/support - Move ViewRecordingsDialog.tsx and RecordingListSkeleton to apps/web/modules/ee/video - Move CalVideoSettings.tsx to apps/web/modules/eventtypes/components/locations - Move CreateOrEditOutOfOfficeModal.tsx to apps/web/modules/settings/outOfOffice - Refactor UpgradeTeamsBadge to accept props and create wrapper in apps/web/modules/billing - Update all callers to use new file locations - Add eslint-disable comments for pre-existing lint warnings This fixes the tRPC server build failure caused by circular dependency where the server build was traversing into packages/features and pulling in React hooks that depend on @calcom/trpc/react types. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: correct UpgradeTeamsBadge import path to use package export Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * fix * fix * fix * fix * fix * fix * fix: pass plan state through SelectProps to UpgradeTeamsBadge - Add upgradeTeamsBadgeProps field to ExtendedOption type in Select component - Update OptionComponent to spread upgradeTeamsBadgeProps to UpgradeTeamsBadge - Update getOptions.ts to accept PlanState object and include upgradeTeamsBadgeProps - Update WorkflowStepContainer.tsx to pass planState to getWorkflowTriggerOptions/getWorkflowTemplateOptions - Update WorkflowDetailsPage.tsx to pass upgradeTeamsBadgeProps in transformed action options - Update AddActionDialog.tsx interface and mapping to include upgradeTeamsBadgeProps - Add eslint-disable comments for pre-existing React Hook dependency warnings This fixes the UpgradeTeamsBadge refactoring issue where the badge was always showing 'upgrade' text instead of the correct text based on plan state (trial_mode, inactive_team_plan, etc.) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update import paths to use /ee/ folder for workflows and organizations Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update workflow component imports to use /ee/ folder Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: add missing types.ts for LocationInput.tsx Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: extract BookingRedirectForm type to shared location Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * wip * wip * fix: update BookingRedirectForm import to use local types file Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * wip * fix * fix --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 7847177 commit 8afe87f

374 files changed

Lines changed: 1218 additions & 1422 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/web/app/(use-page-wrapper)/(main-nav)/ShellMainAppDir.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ShellMainAppDirBackButton } from "app/(use-page-wrapper)/(main-nav)/ShellMainAppDirBackButton";
22
import classNames from "classnames";
33

4-
import type { LayoutProps } from "@calcom/features/shell/Shell";
4+
import type { LayoutProps } from "~/shell/Shell";
55

66
// Copied from `ShellMain` but with a different `ShellMainAppDirBackButton` import
77
// for client/server component separation

apps/web/app/(use-page-wrapper)/(main-nav)/ShellMainAppDirBackButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import { useRouter } from "next/navigation";
44

5-
import type { LayoutProps } from "@calcom/features/shell/Shell";
65
import { Button } from "@calcom/ui/components/button";
76

7+
import type { LayoutProps } from "~/shell/Shell";
8+
89
export const ShellMainAppDirBackButton = ({ backPath }: { backPath: LayoutProps["backPath"] }) => {
910
const router = useRouter();
1011
return (

apps/web/app/(use-page-wrapper)/(main-nav)/availability/page.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { redirect } from "next/navigation";
88
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
99
import { getOrganizationRepository } from "@calcom/features/ee/organizations/di/OrganizationRepository.container";
1010
import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
11-
import { AvailabilitySliderTable } from "@calcom/features/timezone-buddy/components/AvailabilitySliderTable";
1211
import { getScheduleListItemData } from "@calcom/lib/schedules/transformers/getScheduleListItemData";
1312
import { MembershipRole } from "@calcom/prisma/enums";
1413
import { availabilityRouter } from "@calcom/trpc/server/routers/viewer/availability/_router";
14+
import { AvailabilitySliderTable } from "@calcom/web/modules/timezone-buddy/components/AvailabilitySliderTable";
1515

1616
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
1717

@@ -64,8 +64,8 @@ const Page = async ({ searchParams: _searchParams }: PageProps) => {
6464
const organizationRepository = getOrganizationRepository();
6565
const isOrgPrivate = organizationId
6666
? await organizationRepository.checkIfPrivate({
67-
orgId: organizationId,
68-
})
67+
orgId: organizationId,
68+
})
6969
: false;
7070

7171
const permissionService = new PermissionCheckService();
@@ -80,9 +80,7 @@ const Page = async ({ searchParams: _searchParams }: PageProps) => {
8080
<ShellMainAppDir
8181
heading={t("availability")}
8282
subtitle={t("configure_availability")}
83-
CTA={
84-
<AvailabilityCTA canViewTeamAvailability={canViewTeamAvailability} />
85-
}>
83+
CTA={<AvailabilityCTA canViewTeamAvailability={canViewTeamAvailability} />}>
8684
{searchParams?.type === "team" && canViewTeamAvailability ? (
8785
<AvailabilitySliderTable isOrg={!!organizationId} />
8886
) : (

apps/web/app/(use-page-wrapper)/(main-nav)/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { cookies, headers } from "next/headers";
33
import React from "react";
44

55
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
6-
import Shell from "@calcom/features/shell/Shell";
76

87
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
98

9+
import Shell from "~/shell/Shell";
10+
1011
const Layout = async ({ children }: { children: React.ReactNode }) => {
1112
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
1213
if (session?.user?.id) SentrySetUser({ id: session.user.id });

apps/web/app/(use-page-wrapper)/(main-nav)/teams/server-page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import type { SearchParams } from "app/_types";
22
import type { Session } from "next-auth";
33
import { unstable_cache } from "next/cache";
44

5-
import { TeamsListing } from "@calcom/features/ee/teams/components/TeamsListing";
65
import { TeamRepository } from "@calcom/features/ee/teams/repositories/TeamRepository";
76
import { TeamService } from "@calcom/features/ee/teams/services/teamService";
87
import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
98
import { ErrorWithCode } from "@calcom/lib/errors";
109
import prisma from "@calcom/prisma";
1110
import { MembershipRole } from "@calcom/prisma/enums";
1211

12+
import { TeamsListing } from "~/ee/teams/components/TeamsListing";
13+
1314
import { TeamsCTA } from "./CTA";
1415

1516
const getCachedTeams = unstable_cache(

apps/web/app/(use-page-wrapper)/(main-nav)/teams/skeleton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import { ShellMainAppDir } from "app/(use-page-wrapper)/(main-nav)/ShellMainAppDir";
44
import { TeamsCTA } from "app/(use-page-wrapper)/(main-nav)/teams/CTA";
55

6-
import SkeletonLoaderTeamList from "@calcom/features/ee/teams/components/SkeletonloaderTeamList";
76
import { useLocale } from "@calcom/lib/hooks/useLocale";
87

8+
import SkeletonLoaderTeamList from "~/ee/teams/components/SkeletonloaderTeamList";
9+
910
export const TeamsListSkeleton = () => {
1011
const { t } = useLocale();
1112
return (

apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
"use client";
22

33
import { useAutoAnimate } from "@formkit/auto-animate/react";
4+
import posthog from "posthog-js";
45
import { useEffect, useState } from "react";
56
import { useFormContext } from "react-hook-form";
6-
import posthog from "posthog-js";
77

88
import { isFallbackRoute } from "@calcom/app-store/routing-forms/lib/isFallbackRoute";
99
import type { RoutingFormWithResponseCount } from "@calcom/app-store/routing-forms/types/types";
10-
import { useHasPaidPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
1110
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
12-
import SkeletonLoaderTeamList from "@calcom/features/ee/teams/components/SkeletonloaderTeamList";
13-
import { CreateButtonWithTeamsList } from "@calcom/features/ee/teams/components/createButton/CreateButtonWithTeamsList";
1411
import { FilterResults } from "@calcom/features/filters/components/FilterResults";
1512
import { TeamsFilter } from "@calcom/features/filters/components/TeamsFilter";
1613
import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsFiltersFromQuery";
17-
import { ShellMain } from "@calcom/features/shell/Shell";
18-
import { UpgradeTip } from "@calcom/features/tips";
1914
import { WEBAPP_URL } from "@calcom/lib/constants";
2015
import { useLocale } from "@calcom/lib/hooks/useLocale";
2116
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
@@ -39,6 +34,12 @@ import {
3934
FormActionsProvider,
4035
} from "@calcom/web/components/apps/routing-forms/FormActions";
4136

37+
import { useHasPaidPlan } from "~/billing/hooks/useHasPaidPlan";
38+
import SkeletonLoaderTeamList from "~/ee/teams/components/SkeletonloaderTeamList";
39+
import { CreateButtonWithTeamsList } from "~/ee/teams/components/createButton/CreateButtonWithTeamsList";
40+
import { ShellMain } from "~/shell/Shell";
41+
import { UpgradeTip } from "~/shell/UpgradeTip";
42+
4243
function NewFormButton({ setNewFormDialogState }: { setNewFormDialogState: SetNewFormDialogState }) {
4344
const { t } = useLocale();
4445
return (

apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { redirect } from "next/navigation";
33
import type { ReactNode } from "react";
44

55
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
6-
import Shell from "@calcom/features/shell/Shell";
76

87
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
98

9+
import Shell from "~/shell/Shell";
10+
1011
import FormProvider from "../[...pages]/FormProvider";
1112

1213
export default async function Layout({ children }: { children: ReactNode }) {

apps/web/app/(use-page-wrapper)/availability/[schedule]/skeleton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"use client";
22

3-
import Shell from "@calcom/features/shell/Shell";
43
import { SkeletonText, SkeletonContainer, SkeletonButton } from "@calcom/ui/components/skeleton";
54

5+
import Shell from "~/shell/Shell";
6+
67
export function AvailabilityScheduleSkeleton() {
78
return (
89
<Shell withoutMain={true}>
@@ -106,7 +107,7 @@ export function AvailabilityScheduleSkeleton() {
106107
</div>
107108

108109
{/* Sidebar - only visible on desktop */}
109-
<div className="min-w-40 col-span-3 hidden stack-y-2 md:block lg:col-span-1 xl:w-[25%]">
110+
<div className="min-w-40 stack-y-2 col-span-3 hidden md:block lg:col-span-1 xl:w-[25%]">
110111
<div className="xl:max-w-80 w-full pr-4 sm:ml-0 sm:mr-36 sm:p-0">
111112
<div>
112113
<SkeletonText className="mb-1 h-4 w-24 text-sm" /> {/* Timezone */}

apps/web/app/(use-page-wrapper)/event-types/[type]/error.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"use client";
22

3-
import Shell from "@calcom/features/shell/Shell";
43
import { useLocale } from "@calcom/lib/hooks/useLocale";
54
import { Alert } from "@calcom/ui/components/alert";
65

6+
import Shell from "~/shell/Shell";
7+
78
export default function Error() {
89
const { t } = useLocale();
910
return (

0 commit comments

Comments
 (0)