Enables strict mode in nextjs apps (#2354)

- We need this so zod works correctly

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Omar LópezandPeer Richelsen authored and GitHub committed 2022-04-04 20:26:14 +00:00
1 parent 4ff21deb89
commit a7f5250b4a
25 files changed
+178 -68

No files matched your search

+3 -1
View File
@@ -127,6 +127,8 @@ function DatePicker({
eventLength,
minimumBookingNotice,
workingHours,
}: Omit<DatePickerProps, "weekStart" | "onDatePicked" | "date"> & {
browsingDate: Dayjs;
}
) => {
const date = browsingDate.startOf("day").date(day);
@@ -189,7 +191,7 @@ function DatePicker({
batch: 1,
name: "DatePicker",
length: daysInMonth,
callback: (i: number, isLast) => {
callback: (i: number) => {
let day = i + 1;
days[daysInitialOffset + i] = {
disabled: isDisabledMemoized(day, {
@@ -136,6 +136,7 @@ const BookingPage = ({ eventType, booking, profile }: BookingPageProps) => {
const locationLabels = {
[LocationType.InPerson]: t("in_person_meeting"),
[LocationType.Phone]: t("phone_call"),
[LocationType.Link]: t("link_meeting"),
[LocationType.GoogleMeet]: "Google Meet",
[LocationType.Zoom]: "Zoom Video",
[LocationType.Jitsi]: "Jitsi Meet",
+3 -1
View File
@@ -74,7 +74,7 @@ const constructImage = (name: string, description: string, username: string): st
);
};
export const HeadSeo: React.FC<HeadSeoProps & { children?: never }> = (props) => {
export const HeadSeo = (props: HeadSeoProps): JSX.Element => {
const defaultUrl = getBrowserInfo()?.url;
const image = getSeoImage("default");
@@ -113,3 +113,5 @@ export const HeadSeo: React.FC<HeadSeoProps & { children?: never }> = (props) =>
return <NextSeo {...seoProps} />;
};
export default HeadSeo;
+5 -4
View File
@@ -1,12 +1,13 @@
import { HashtagIcon, InformationCircleIcon, LinkIcon, PhotographIcon } from "@heroicons/react/solid";
import React, { useRef, useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { objectKeys } from "@calcom/lib/objectKeys";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { TextField } from "@calcom/ui/form/fields";
import { useLocale } from "@lib/hooks/useLocale";
import { TeamWithMembers } from "@lib/queries/teams";
import { trpc } from "@lib/trpc";
@@ -54,9 +55,9 @@ export default function TeamSettings(props: Props) {
hideBranding: hideBrandingRef.current?.checked,
};
// remove unchanged variables
for (const key in variables) {
if (variables[key] === team?.[key]) delete variables[key];
}
objectKeys(variables).forEach((key) => {
if (variables[key as keyof typeof variables] === team?.[key]) delete variables[key];
});
mutation.mutate({ id: team.id, ...variables });
}
+2 -2
View File
@@ -11,7 +11,7 @@ export type AvatarProps = {
};
// defaultAvatarSrc from profile.tsx can't be used as it imports crypto
function defaultAvatarSrc({ md5 }) {
function defaultAvatarSrc(md5: string) {
return `https://www.gravatar.com/avatar/${md5}?s=160&d=identicon&r=PG`;
}
@@ -26,7 +26,7 @@ export function AvatarSSR(props: AvatarProps) {
if (user.avatar) {
imgSrc = user.avatar;
} else if (user.emailMd5) {
imgSrc = defaultAvatarSrc({ md5: user.emailMd5 });
imgSrc = defaultAvatarSrc(user.emailMd5);
}
return imgSrc ? <img alt={alt} className={className} src={imgSrc}></img> : null;
}
@@ -1,13 +1,13 @@
import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import Button from "@calcom/ui/Button";
import { DialogFooter } from "@calcom/ui/Dialog";
import Switch from "@calcom/ui/Switch";
import { FieldsetLegend, Form, InputGroupBox, TextArea, TextField } from "@calcom/ui/form/fields";
import { useLocale } from "@lib/hooks/useLocale";
import { trpc } from "@lib/trpc";
import { WEBHOOK_TRIGGER_EVENTS } from "@lib/webhooks/constants";
import customTemplate, { hasTemplateIntegration } from "@lib/webhooks/integrationTemplate";
@@ -22,13 +22,6 @@ export default function WebhookDialogForm(props: {
}) {
const { t } = useLocale();
const utils = trpc.useContext();
const handleSubscriberUrlChange = (e) => {
form.setValue("subscriberUrl", e.target.value);
if (hasTemplateIntegration({ url: e.target.value })) {
setUseCustomPayloadTemplate(true);
form.setValue("payloadTemplate", customTemplate({ url: e.target.value }));
}
};
const {
defaultValues = {
id: "",
@@ -88,7 +81,13 @@ export default function WebhookDialogForm(props: {
{...form.register("subscriberUrl")}
required
type="url"
onChange={handleSubscriberUrlChange}
onChange={(e) => {
form.setValue("subscriberUrl", e.target.value);
if (hasTemplateIntegration({ url: e.target.value })) {
setUseCustomPayloadTemplate(true);
form.setValue("payloadTemplate", customTemplate({ url: e.target.value }));
}
}}
/>
<fieldset className="space-y-2">