Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: EventTypeWebWrapper base pr #16550

Merged
merged 18 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b5a4906
chore: EventTypeWebWrapper base pr
ThyMinimalDev Sep 9, 2024
02eae06
fixup! chore: EventTypeWebWrapper base pr
ThyMinimalDev Sep 9, 2024
fdf5140
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 9, 2024
3b568f7
fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wra…
ThyMinimalDev Sep 9, 2024
7c2d76a
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 13, 2024
4334754
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 16, 2024
44a5c66
wip
ThyMinimalDev Sep 13, 2024
caf62ab
fix: error
SomayChauhan Sep 16, 2024
d22b114
Event type atom wrapper handles app dir
ThyMinimalDev Sep 17, 2024
76334eb
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 17, 2024
681159e
fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wra…
ThyMinimalDev Sep 17, 2024
c05b94e
fixup! fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-…
ThyMinimalDev Sep 17, 2024
1877a25
remove console log
ThyMinimalDev Sep 17, 2024
e2260c5
review comments
ThyMinimalDev Sep 17, 2024
5dbaf21
fixup! review comments
ThyMinimalDev Sep 17, 2024
866cfba
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 17, 2024
296c4d7
Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base
ThyMinimalDev Sep 18, 2024
ab23397
fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wra…
ThyMinimalDev Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/web/app/future/event-types/[type]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers";

import { EventType } from "@calcom/atoms/monorepo";

import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/event-types/[type]/getServerSideProps";
import type { PageProps as EventTypePageProps } from "@lib/event-types/[type]/getServerSideProps";

import EventTypePageWrapper from "~/event-types/views/event-types-single-view";

export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const legacyCtx = buildLegacyCtx(headers(), cookies(), params, searchParams);
const { eventType } = await getData(legacyCtx);
Expand All @@ -21,5 +21,5 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
};

const getData = withAppDirSsr(getServerSideProps);
const Page = (props: EventTypePageProps) => <EventTypePageWrapper {...props} isAppDir={true} />;
const Page = ({ type, ...rest }: EventTypePageProps) => <EventType {...rest} id={type} isAppDir={true} />;
export default WithLayout({ getLayout: null, getData, Page })<"P">;
33 changes: 3 additions & 30 deletions apps/web/modules/event-types/views/event-types-single-view.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,11 @@
"use client";

import { EventType } from "@calcom/features/eventtypes/components/EventType";
import { EventTypeAppDir } from "@calcom/features/eventtypes/components/EventTypeAppDir";
import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types";

/* eslint-disable @typescript-eslint/no-empty-function */
// eslint-disable-next-line @calcom/eslint/deprecated-imports-next-router
import { trpc } from "@calcom/trpc/react";
import { EventType } from "@calcom/atoms/monorepo";

import type { PageProps } from "@lib/event-types/[type]/getServerSideProps";

const EventTypePageWrapper = (props: PageProps & { isAppDir?: boolean }) => {
const { data } = trpc.viewer.eventTypes.get.useQuery({ id: props.type });

if (!data) return null;

const eventType = data.eventType;

const { data: workflows } = trpc.viewer.workflows.getAllActiveWorkflows.useQuery({
eventType: {
id: props.type,
teamId: eventType.teamId,
userId: eventType.userId,
parent: eventType.parent,
metadata: eventType.metadata,
},
});

const propsData = {
...(data as EventTypeSetupProps),
allActiveWorkflows: workflows,
};

return props.isAppDir ? <EventTypeAppDir {...propsData} /> : <EventType {...propsData} />;
const EventTypePageWrapper = ({ type, ...rest }: PageProps) => {
ThyMinimalDev marked this conversation as resolved.
Show resolved Hide resolved
return <EventType {...rest} id={type} isAppDir={false} />;
};

export default EventTypePageWrapper;
Loading
Loading