fix: add team member dialog ui updated (#5675)

* fix: add team member dialog ui updated
fixed team url

Signed-off-by: Udit Takkar <[email protected]>

* fix: type errors and role value bug

Signed-off-by: Udit Takkar <[email protected]>

* chore: remove logs

Signed-off-by: Udit Takkar <[email protected]>

* chore: change option to admin

Signed-off-by: Udit Takkar <[email protected]>

Signed-off-by: Udit Takkar <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
Udit Takkarandsean-brydon authored and GitHub committed 2022-11-25 12:59:25 +00:00
1 parent 93a14b190e
commit eda1d5f393
6 files changed
+42 -32

No files matched your search

@@ -77,7 +77,7 @@ const AddNewTeamMembersForm = ({ defaultValues, teamId }: { defaultValues: FormV
inviteMemberMutation.mutate({
teamId,
language: i18n.language,
role: values.role.value,
role: values.role,
usernameOrEmail: values.emailOrUsername,
sendEmailInvitation: values.sendInviteEmail,
});
@@ -1,7 +1,6 @@
import { useRouter } from "next/router";
import { Controller, useForm } from "react-hook-form";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import slugify from "@calcom/lib/slugify";
import { trpc } from "@calcom/trpc/react";
@@ -78,7 +77,10 @@ export const CreateANewTeamForm = () => {
className="mt-2"
name="slug"
label={t("team_url")}
addOnLeading={`${WEBAPP_URL}/team/`}
addOnLeading={`${process.env.NEXT_PUBLIC_WEBSITE_URL?.replace("https://", "")?.replace(
"http://",
""
)}/`}
value={value}
onChange={(e) => {
newTeamFormMethods.setValue("slug", slugify(e?.target.value), {
@@ -12,8 +12,9 @@ import {
DialogContent,
DialogFooter,
Form,
Select,
TextField,
Label,
ToggleGroup,
} from "@calcom/ui";
import { PendingMember } from "../lib/types";
@@ -32,7 +33,7 @@ type MembershipRoleOption = {
export interface NewMemberForm {
emailOrUsername: string;
role: MembershipRoleOption;
role: MembershipRole;
sendInviteEmail: boolean;
}
@@ -69,7 +70,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
title={t("invite_new_member")}
description={
IS_TEAM_BILLING_ENABLED ? (
<span className=" text-sm leading-tight text-gray-500">
<span className="text-sm leading-tight text-gray-500">
<Trans i18nKey="invite_new_member_description">
Note: This will <span className="font-medium text-gray-900">cost an extra seat ($15/m)</span>{" "}
on your subscription.
@@ -80,7 +81,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
)
}>
<Form form={newMemberFormMethods} handleSubmit={(values) => props.onSubmit(values)}>
<div className="space-y-4">
<div className="mt-6 space-y-6">
<Controller
name="emailOrUsername"
control={newMemberFormMethods.control}
@@ -105,21 +106,21 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
<Controller
name="role"
control={newMemberFormMethods.control}
defaultValue={options[0]}
defaultValue={options[0].value}
render={({ field: { onChange } }) => (
<div>
<label
className="mb-1 block text-sm font-medium tracking-wide text-gray-700"
htmlFor="role">
<Label className="font-medium text-gray-900" htmlFor="role">
{t("role")}
</label>
<Select
defaultValue={options[0]}
options={options.filter((option) => option.value !== "OWNER")}
</Label>
<ToggleGroup
isFullWidth={true}
id="role"
name="role"
className="mt-1 block w-full rounded-sm border-gray-300 text-sm"
onChange={onChange}
onValueChange={onChange}
defaultValue={options[0].value}
options={[
{ value: "ADMIN", label: t("admin") },
{ value: "MEMBER", label: t("member") },
]}
/>
</div>
)}
@@ -127,21 +128,21 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
<Controller
name="sendInviteEmail"
control={newMemberFormMethods.control}
defaultValue={false}
defaultValue={true}
render={() => (
<div className="relative flex items-start">
<CheckboxField
description={t("send_invite_email")}
onChange={(e) => newMemberFormMethods.setValue("sendInviteEmail", e.target.checked)}
/>
</div>
<CheckboxField
className="mr-0"
defaultChecked={true}
description={t("send_invite_email")}
onChange={(e) => newMemberFormMethods.setValue("sendInviteEmail", e.target.checked)}
/>
)}
/>
</div>
<DialogFooter>
<Button
type="button"
color="secondary"
color="minimal"
onClick={() => {
props.onExit();
newMemberFormMethods.reset();
@@ -153,7 +154,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
color="primary"
className="ltr:ml-2 rtl:mr-2"
data-testid="invite-new-member-button">
{t("invite")}
{t("invite_new_member")}
</Button>
</DialogFooter>
</Form>
@@ -108,7 +108,7 @@ const MembersView = () => {
inviteMemberMutation.mutate({
teamId,
language: i18n.language,
role: values.role.value,
role: values.role,
usernameOrEmail: values.emailOrUsername,
sendEmailInvitation: values.sendInviteEmail,
});