feat: Assign colors to events (#15298)

* feat: Assign colors to events

* update

* final update

* update

* fix requested changes error

* Update EventAdvancedTab.tsx

* add contrast check

* update

* fix contrsterror message visibility

* fix type error

* fix

* update test

---------

Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-08-14 15:10:40 +02:00
1 parent 95e2ad3007
commit 528a4fbb97
23 files changed
+289 -120

No files matched your search

@@ -66,12 +66,11 @@ const BrandColorsForm = ({
defaultValue={brandColor || DEFAULT_LIGHT_BRAND_COLOR}
resetDefaultValue={DEFAULT_LIGHT_BRAND_COLOR}
onChange={(value) => {
try {
checkWCAGContrastColor("#ffffff", value);
if (checkWCAGContrastColor("#ffffff", value)) {
setLightModeError(false);
brandColorsFormMethods.setValue("brandColor", value, { shouldDirty: true });
} catch (err) {
setLightModeError(false);
} else {
setLightModeError(true);
}
}}
/>
@@ -95,11 +94,10 @@ const BrandColorsForm = ({
defaultValue={darkBrandColor || DEFAULT_DARK_BRAND_COLOR}
resetDefaultValue={DEFAULT_DARK_BRAND_COLOR}
onChange={(value) => {
try {
checkWCAGContrastColor("#101010", value);
if (checkWCAGContrastColor("#101010", value)) {
setDarkModeError(false);
brandColorsFormMethods.setValue("darkBrandColor", value, { shouldDirty: true });
} catch (err) {
} else {
setDarkModeError(true);
}
}}
@@ -185,6 +185,7 @@ export default async function handleChildrenEventTypes({
metadata: (managedEventTypeValues.metadata as Prisma.InputJsonValue) ?? undefined,
bookingFields: (managedEventTypeValues.bookingFields as Prisma.InputJsonValue) ?? undefined,
durationLimits: (managedEventTypeValues.durationLimits as Prisma.InputJsonValue) ?? undefined,
eventTypeColor: (managedEventTypeValues.eventTypeColor as Prisma.InputJsonValue) ?? undefined,
onlyShowFirstAvailableSlot: managedEventTypeValues.onlyShowFirstAvailableSlot ?? false,
userId,
users: {
@@ -6,6 +6,7 @@ import type { PeriodType, SchedulingType } from "@calcom/prisma/enums";
import type { BookerLayoutSettings, EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
import type { customInputSchema } from "@calcom/prisma/zod-utils";
import type { eventTypeBookingFields } from "@calcom/prisma/zod-utils";
import type { eventTypeColor } from "@calcom/prisma/zod-utils";
import type { RouterOutputs } from "@calcom/trpc/react";
import type { IntervalLimit, RecurringEvent } from "@calcom/types/Calendar";
@@ -47,6 +48,7 @@ export type FormValues = {
hidden: boolean;
hideCalendarNotes: boolean;
hashedLink: string | undefined;
eventTypeColor: z.infer<typeof eventTypeColor>;
locations: {
type: EventLocationType["type"];
address?: string;