forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: EventTypeWebWrapper base pr (calcom#16550)
* chore: EventTypeWebWrapper base pr * fixup! chore: EventTypeWebWrapper base pr * fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base * wip * fix: error * Event type atom wrapper handles app dir * fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base * fixup! fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base * remove console log * review comments * fixup! review comments * fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base --------- Co-authored-by: Somay Chauhan <[email protected]>
- Loading branch information
1 parent
3a5325f
commit 2b43d9a
Showing
9 changed files
with
831 additions
and
1,466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 3 additions & 30 deletions
33
apps/web/modules/event-types/views/event-types-single-view.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { | ||
return <EventType {...rest} id={type} isAppDir={false} />; | ||
}; | ||
|
||
export default EventTypePageWrapper; |
Oops, something went wrong.