Files
cal.diy/packages/features/ee/teams/components/v2/AddNewTeamMembers.tsx
T
+15 0c78dbea27 Create New Team (#4450)
* Add link to new teams

* Create new team

* Invite team members

* Bug fix

* Tidy up settings calendars (#4430)

* feat: 4232 - new theme toggle design. (#4371)

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>

* fix: Select dropdown styling (#4358)

* fix: select dropdown styling

* change check icon

* Revert select component, update v2 select

* Updates the background color to match figma design

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: sean-brydon <[email protected]>

* Fix input height 36px (#4425)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix crash due to some props being undefined (#4427)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Improve event type item description visibility (#4404)

* Make event type description more visible

* Delete unneeded import

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Updating language in settings needs a reload to be translated (#4431)

Co-authored-by: gitstart <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Thiago Nascimbeni <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: remove i18n from title and description (#4354)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <[email protected]>

* Fix styles and remove temporarily elements (#4448)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix deletion of route (#4466)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat: make toggle button default (#4437)

* feat: make switch default

* fix: refetch invalidated query

* React-query caching the previous isDefault state.

* fix: switch label color

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Refactor skeleton loader files to v2 folders (#4447)

* create v2 skeleton loaders

* add depreciation notice to old skeleton loader files

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Adds rescheduling dropdown to past unconfirmed bookings (#3726)

Co-authored-by: Omar López <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: add a consistent key to the day ranges list (#4401)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* remove "Weve changed billing for teams" banner in teams (#4432)

Co-authored-by: gitstart <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: remove name prop from NumberWidget (#4346)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix bug

* Fix bug

* Squashed commit of the following:

commit c3cb839027
Author: Bailey Pumfleet <[email protected]>
Date:   Wed Sep 14 17:13:13 2022 +0100

    Remove outline from user dropdown trigger (#4470)

commit 91c39a0306
Author: Sascha Schworm <[email protected]>
Date:   Wed Sep 14 18:09:00 2022 +0200

    feat: Exchange with NTLM support (#4127)

    * add exchange package

    * fix conflicts

    * add setup page for v2

    * refactor setup page for v1

    * return exchange error messages to user if applicable

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Joe Au-Yeung <[email protected]>

commit f1c15f4e8a
Author: alannnc <[email protected]>
Date:   Wed Sep 14 10:57:20 2022 -0500

    4382 onboarding fix the disabled state of the username in step 1 (#4451)

    * Convert username availability premium to v2

    * Update Username Availability to v2 design

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 3f29df16ad
Author: Alex van Andel <[email protected]>
Date:   Wed Sep 14 16:40:56 2022 +0100

    KBar included @calcom/ui/v2/core -> Shell -> KBar -> Shell -> ... (#4469)

commit 3a06947c8a
Author: Syed Ali Shahbaz <[email protected]>
Date:   Wed Sep 14 19:14:42 2022 +0530

    fixes active state of select options (#4456)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit f486b0242f
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 17:28:59 2022 +0530

    fix: remove name prop from NumberWidget (#4346)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 9bc2676822
Author: GitStart <[email protected]>
Date:   Wed Sep 14 12:41:47 2022 +0100

    remove "Weve changed billing for teams" banner in teams (#4432)

    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: Grace Nshokano <[email protected]>
    Co-authored-by: Nitesh Singh <[email protected]>
    Co-authored-by: Matheus Muniz <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 5c72aa3497
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 17:00:25 2022 +0530

    fix: add a consistent key to the day ranges list (#4401)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 09da911bf9
Author: Dallen Pyrah <[email protected]>
Date:   Wed Sep 14 05:02:26 2022 -0600

    Adds rescheduling dropdown to past unconfirmed bookings (#3726)

    Co-authored-by: Omar López <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 2fbaec41c9
Author: Carina Wollendorfer <[email protected]>
Date:   Wed Sep 14 06:35:40 2022 -0400

    Refactor skeleton loader files to v2 folders (#4447)

    * create v2 skeleton loaders

    * add depreciation notice to old skeleton loader files

    Co-authored-by: CarinaWolli <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 3bada22900
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 15:54:41 2022 +0530

    feat: make toggle button default (#4437)

    * feat: make switch default

    * fix: refetch invalidated query

    * React-query caching the previous isDefault state.

    * fix: switch label color

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 45059554b6
Author: Hariom Balhara <[email protected]>
Date:   Wed Sep 14 15:40:52 2022 +0530

    Fix deletion of route (#4466)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 8b69359ccb
Author: alannnc <[email protected]>
Date:   Wed Sep 14 04:55:49 2022 -0500

    Fix styles and remove temporarily elements (#4448)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit b457125915
Author: Udit Takkar <[email protected]>
Date:   Wed Sep 14 15:12:48 2022 +0530

    fix: remove i18n from title and description (#4354)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
    Co-authored-by: Hariom Balhara <[email protected]>

commit 01e0fed3c5
Author: GitStart <[email protected]>
Date:   Wed Sep 14 10:28:23 2022 +0100

    Updating language in settings needs a reload to be translated (#4431)

    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: Nitesh Singh <[email protected]>
    Co-authored-by: Thiago Nascimbeni <[email protected]>
    Co-authored-by: Grace Nshokano <[email protected]>
    Co-authored-by: Matheus Muniz <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit c09107cec8
Author: Noah <[email protected]>
Date:   Wed Sep 14 11:08:50 2022 +0200

    Improve event type item description visibility (#4404)

    * Make event type description more visible

    * Delete unneeded import

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 2f9905e548
Author: Hariom Balhara <[email protected]>
Date:   Wed Sep 14 14:16:42 2022 +0530

    Fix crash due to some props being undefined (#4427)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit ab4d910564
Author: sean-brydon <[email protected]>
Date:   Wed Sep 14 09:18:40 2022 +0100

    Fix input height 36px (#4425)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 34bca4984f
Author: John Afolabi <[email protected]>
Date:   Wed Sep 14 08:27:00 2022 +0100

    fix: Select dropdown styling (#4358)

    * fix: select dropdown styling

    * change check icon

    * Revert select component, update v2 select

    * Updates the background color to match figma design

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Syed Ali Shahbaz <[email protected]>
    Co-authored-by: sean-brydon <[email protected]>

commit 0907d154c7
Author: Jeroen Reumkens <[email protected]>
Date:   Wed Sep 14 09:15:13 2022 +0200

    feat: 4232 - new theme toggle design. (#4371)

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Joe Au-Yeung <[email protected]>

commit 6f807930f6
Author: sean-brydon <[email protected]>
Date:   Tue Sep 13 21:13:24 2022 +0100

    Tidy up settings calendars (#4430)

* Fix types

* Cleanup

Co-authored-by: sean-brydon <[email protected]>
Co-authored-by: Jeroen Reumkens <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: John Afolabi <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Noah <[email protected]>
Co-authored-by: GitStart <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Thiago Nascimbeni <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: alannnc <[email protected]>
Co-authored-by: Nafees Nazik <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Dallen Pyrah <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
2022-09-15 09:47:59 +00:00

126 lines
4.4 KiB
TypeScript

import { Suspense, useState } from "react";
import MemberInvitationModal from "@calcom/features/ee/teams/components/MemberInvitationModal";
import { classNames } from "@calcom/lib";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui";
import { Button, Avatar, Badge } from "@calcom/ui/v2";
import { SkeletonContainer, SkeletonText } from "@calcom/ui/v2";
const AddNewTeamMemberSkeleton = () => {
return (
<SkeletonContainer className="rounded-md border">
<div className="flex w-full justify-between p-4">
<div>
<p className="text-sm font-medium text-gray-900">
<SkeletonText className="h-4 w-56" />
</p>
<div className="mt-2.5 w-max">
<SkeletonText className="h-5 w-28" />
</div>
</div>
</div>
</SkeletonContainer>
);
};
const AddNewTeamMembers = (props: { teamId: number }) => {
const { t } = useLocale();
const utils = trpc.useContext();
const { data: team, isLoading } = trpc.useQuery(["viewer.teams.get", { teamId: props.teamId }]);
const removeMemberMutation = trpc.useMutation("viewer.teams.removeMember", {
onSuccess() {
utils.invalidateQueries(["viewer.teams.get", { teamId: props.teamId }]);
utils.invalidateQueries(["viewer.teams.list"]);
},
});
const [memberInviteModal, setMemberInviteModal] = useState(false);
if (isLoading) return <AddNewTeamMemberSkeleton />;
return (
<Suspense fallback={<AddNewTeamMemberSkeleton />}>
<>
<>
<ul className="rounded-md border">
{team?.members.map((member, index) => (
<li
key={member.id}
className={classNames(
"flex items-center justify-between p-6 text-sm",
index !== 0 && "border-t"
)}>
<div className="flex space-x-2">
<Avatar
gravatarFallbackMd5="teamMember"
size="mdLg"
imageSrc={member?.avatar}
alt="owner-avatar"
/>
<div>
<div className="flex space-x-1">
<p>{member?.name || t("team_member")}</p>
{/* Assume that the first member of the team is the creator */}
{index === 0 && <Badge variant="green">{t("you")}</Badge>}
{!member.accepted && <Badge variant="orange">{t("pending")}</Badge>}
{member.role === "MEMBER" && <Badge variant="gray">{t("member")}</Badge>}
{member.role === "ADMIN" && <Badge variant="default">{t("admin")}</Badge>}
</div>
{member.username ? (
<p className="text-gray-600">{`${WEBAPP_URL}/${member?.username}`}</p>
) : (
<p className="text-gray-600">{t("not_on_cal")}</p>
)}
</div>
</div>
{member.role !== "OWNER" && (
<Button
StartIcon={Icon.FiTrash2}
size="icon"
color="secondary"
className="h-[36px] w-[36px]"
onClick={() => removeMemberMutation.mutate({ teamId: props.teamId, memberId: member.id })}
/>
)}
</li>
))}
</ul>
<Button
type="submit"
color="secondary"
StartIcon={Icon.FiPlus}
onClick={() => setMemberInviteModal(true)}
className="mt-6 w-full justify-center">
{t("add_team_member")}
</Button>
</>
{team && (
<MemberInvitationModal
isOpen={memberInviteModal}
onExit={() => setMemberInviteModal(false)}
team={team}
currentMember={team?.membership.role}
/>
)}
<hr className="my-6 border-neutral-200" />
<Button
EndIcon={Icon.FiArrowRight}
className="mt-6 w-full justify-center"
href={`${WEBAPP_URL}/settings/teams/${props.teamId}/profile`}>
{t("finish")}
</Button>
</>
</Suspense>
);
};
export default AddNewTeamMembers;