calcom/lib/types/event-type.ts
Alex van Andel 8664d217c9
Feature/availability page revamp (#1032)
* Refactored Schedule component

* Merge branch 'main' into feature/availability-page-revamp

* wip

* Turned value into number, many other TS tweaks

* NodeJS 16x works 100% on my local, but out of scope for this already massive PR

* Fixed TS errors in viewer.tsx and schedule/index.ts

* Reverted next.config.js

* Fixed minor remnant from moving types to @lib/types

* schema comment

* some changes to form handling

* add comments

* Turned ConfigType into number; which seems to be the value preferred by tRPC

* Fixed localized time display during onboarding

* Update components/ui/form/Schedule.tsx

Co-authored-by: Alex Johansson <alexander@n1s.se>

* Added showToast to indicate save success

* Converted number to Date, and also always establish time based on current date

* prevent height flickering of availability

by removing mb-2 of input field

* availabilty: re-added mb-2 but added min-height

* Quite a few bugs discovered, but this seems functional

Co-authored-by: KATT <alexander@n1s.se>
Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2021-11-10 11:16:32 +00:00

62 lines
1.5 KiB
TypeScript

import { SchedulingType, EventType, Availability } from "@prisma/client";
export type OpeningHours = Pick<Availability, "days" | "startTime" | "endTime">;
export type DateOverride = Pick<Availability, "date" | "startTime" | "endTime">;
export type AdvancedOptions = {
eventName?: string;
periodType?: string;
periodDays?: number;
periodStartDate?: Date | string;
periodEndDate?: Date | string;
periodCountCalendarDays?: boolean;
requiresConfirmation?: boolean;
disableGuests?: boolean;
minimumBookingNotice?: number;
price?: number;
currency?: string;
schedulingType?: SchedulingType;
users?: {
value: number;
label: string;
avatar: string;
}[];
availability?: { openingHours: OpeningHours[]; dateOverrides: DateOverride[] };
customInputs?: EventTypeCustomInput[];
timeZone: string;
hidden: boolean;
};
export type EventTypeCustomInput = {
id: number;
label: string;
placeholder: string;
required: boolean;
type: string;
};
export type CreateEventType = {
title: string;
slug: string;
description: string;
length: number;
teamId?: number;
schedulingType?: SchedulingType;
};
export type CreateEventTypeResponse = {
eventType: EventType;
};
export type EventTypeInput = AdvancedOptions & {
id: number;
title: string;
slug: string;
description: string;
length: number;
hidden: boolean;
locations: unknown;
customInputs: EventTypeCustomInput[];
timeZone: string;
availability?: { openingHours: OpeningHours[]; dateOverrides: DateOverride[] };
};