Merge branch 'main' into feature/twilio-sms-reminder
commit
951663c602
|
@ -1,7 +1,7 @@
|
||||||
import { UserIcon } from "@heroicons/react/outline";
|
import { UserIcon } from "@heroicons/react/outline";
|
||||||
import { InformationCircleIcon } from "@heroicons/react/solid";
|
import { InformationCircleIcon } from "@heroicons/react/solid";
|
||||||
import { MembershipRole } from "@prisma/client";
|
import { MembershipRole } from "@prisma/client";
|
||||||
import React, { useState, useEffect, SyntheticEvent } from "react";
|
import React, { useState, useEffect, SyntheticEvent, useMemo } from "react";
|
||||||
|
|
||||||
import Button from "@calcom/ui/Button";
|
import Button from "@calcom/ui/Button";
|
||||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
|
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
|
||||||
|
@ -24,19 +24,19 @@ type MembershipRoleOption = {
|
||||||
label?: string;
|
label?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const options: MembershipRoleOption[] = [{ value: "MEMBER" }, { value: "ADMIN" }];
|
const _options: MembershipRoleOption[] = [{ value: "MEMBER" }, { value: "ADMIN" }];
|
||||||
|
|
||||||
export default function MemberInvitationModal(props: MemberInvitationModalProps) {
|
export default function MemberInvitationModal(props: MemberInvitationModalProps) {
|
||||||
const [errorMessage, setErrorMessage] = useState("");
|
const [errorMessage, setErrorMessage] = useState("");
|
||||||
const { t, i18n } = useLocale();
|
const { t, i18n } = useLocale();
|
||||||
const utils = trpc.useContext();
|
const utils = trpc.useContext();
|
||||||
|
|
||||||
useEffect(() => {
|
const options = useMemo(() => {
|
||||||
options.forEach((option, i) => {
|
_options.forEach((option, i) => {
|
||||||
options[i].label = t(option.value.toLowerCase());
|
_options[i].label = t(option.value.toLowerCase());
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
return _options;
|
||||||
}, []);
|
}, [t]);
|
||||||
|
|
||||||
const inviteMemberMutation = trpc.useMutation("viewer.teams.inviteMember", {
|
const inviteMemberMutation = trpc.useMutation("viewer.teams.inviteMember", {
|
||||||
async onSuccess() {
|
async onSuccess() {
|
||||||
|
@ -99,6 +99,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
||||||
{t("role")}
|
{t("role")}
|
||||||
</label>
|
</label>
|
||||||
<Select
|
<Select
|
||||||
|
defaultValue={options[0]}
|
||||||
options={options}
|
options={options}
|
||||||
id="role"
|
id="role"
|
||||||
name="role"
|
name="role"
|
||||||
|
|
Loading…
Reference in New Issue