feat: add translations for emails and type error fixes overall (#994)

* feat: add translations for forgot password email and misc

* fix: type fixes

* feat: translate invitation email

* fix: e2e tests

* fix: lint

* feat: type fixes and i18n for emails

* Merge main

* fix: jest import on server path

* Merge

* fix: playwright tests

* fix: lint

Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
Mihai CandBailey Pumfleet authored and GitHub committed 2021-10-25 14:05:21 +01:00
1 parent 356d470e16
commit 8d6fec79d3
35 files changed
+680 -461

No files matched your search

+3 -2
View File
@@ -12,13 +12,14 @@ import TableActions, { ActionType } from "@components/ui/TableActions";
type BookingItem = inferQueryOutput<"viewer.bookings">[number];
function BookingListItem(booking: BookingItem) {
const { t } = useLocale();
const { t, i18n } = useLocale();
const utils = trpc.useContext();
const mutation = useMutation(
async (confirm: boolean) => {
const res = await fetch("/api/book/confirm", {
method: "PATCH",
body: JSON.stringify({ id: booking.id, confirmed: confirm }),
body: JSON.stringify({ id: booking.id, confirmed: confirm, language: i18n.language }),
headers: {
"Content-Type": "application/json",
},
+2 -1
View File
@@ -36,7 +36,7 @@ import { TeamBookingPageProps } from "../../../pages/team/[slug]/book";
type BookingPageProps = BookPageProps | TeamBookingPageProps;
const BookingPage = (props: BookingPageProps) => {
const { t } = useLocale();
const { t, i18n } = useLocale();
const router = useRouter();
const { rescheduleUid } = router.query;
const { isReady } = useTheme(props.profile.theme);
@@ -109,6 +109,7 @@ const BookingPage = (props: BookingPageProps) => {
guests: guestEmails,
eventTypeId: props.eventType.id,
timeZone: timeZone(),
language: i18n.language,
};
if (typeof rescheduleUid === "string") payload.rescheduleUid = rescheduleUid;
if (typeof router.query.user === "string") payload.user = router.query.user;
+15 -5
View File
@@ -1,5 +1,6 @@
import { UsersIcon } from "@heroicons/react/outline";
import { useState } from "react";
import React, { SyntheticEvent } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import { Team } from "@lib/team";
@@ -8,7 +9,7 @@ import Button from "@components/ui/Button";
export default function MemberInvitationModal(props: { team: Team | undefined | null; onExit: () => void }) {
const [errorMessage, setErrorMessage] = useState("");
const { t } = useLocale();
const { t, i18n } = useLocale();
const handleError = async (res: Response) => {
const responseData = await res.json();
@@ -21,13 +22,22 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
return responseData;
};
const inviteMember = (e) => {
const inviteMember = (e: SyntheticEvent) => {
e.preventDefault();
const target = e.target as typeof e.target & {
elements: {
role: { value: string };
inviteUser: { value: string };
sendInviteEmail: { checked: boolean };
};
};
const payload = {
role: e.target.elements["role"].value,
usernameOrEmail: e.target.elements["inviteUser"].value,
sendEmailInvitation: e.target.elements["sendInviteEmail"].checked,
language: i18n.language,
role: target.elements["role"].value,
usernameOrEmail: target.elements["inviteUser"].value,
sendEmailInvitation: target.elements["sendInviteEmail"].checked,
};
return fetch("/api/teams/" + props?.team?.id + "/invite", {