2022-09-12 22:04:33 +00:00
|
|
|
import classNames from "classnames";
|
2022-12-05 12:03:36 +00:00
|
|
|
import { signIn } from "next-auth/react";
|
2022-09-12 22:04:33 +00:00
|
|
|
import { useState } from "react";
|
|
|
|
|
2023-07-25 09:28:57 +00:00
|
|
|
import { useBookerUrl } from "@calcom/lib/hooks/useBookerUrl";
|
2022-09-12 22:04:33 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-05-02 11:44:05 +00:00
|
|
|
import { MembershipRole } from "@calcom/prisma/enums";
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
2023-02-21 17:12:26 +00:00
|
|
|
import type { RouterOutputs } from "@calcom/trpc/react";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2022-09-12 22:04:33 +00:00
|
|
|
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
|
|
|
|
import {
|
2022-11-23 02:55:25 +00:00
|
|
|
Avatar,
|
|
|
|
Button,
|
|
|
|
ButtonGroup,
|
|
|
|
ConfirmationDialogContent,
|
2022-09-12 22:04:33 +00:00
|
|
|
Dialog,
|
2022-12-05 12:03:36 +00:00
|
|
|
DialogClose,
|
2022-09-12 22:04:33 +00:00
|
|
|
DialogContent,
|
2022-11-28 19:14:38 +00:00
|
|
|
DialogFooter,
|
2022-09-12 22:04:33 +00:00
|
|
|
Dropdown,
|
|
|
|
DropdownItem,
|
|
|
|
DropdownMenuContent,
|
|
|
|
DropdownMenuItem,
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
showToast,
|
|
|
|
Tooltip,
|
2022-11-23 02:55:25 +00:00
|
|
|
} from "@calcom/ui";
|
2023-06-22 19:33:03 +00:00
|
|
|
import { ExternalLink, MoreHorizontal, Edit2, Lock, UserX } from "@calcom/ui/components/icon";
|
2022-09-12 22:04:33 +00:00
|
|
|
|
|
|
|
import MemberChangeRoleModal from "./MemberChangeRoleModal";
|
2023-04-19 14:15:08 +00:00
|
|
|
import TeamAvailabilityModal from "./TeamAvailabilityModal";
|
2022-09-12 22:04:33 +00:00
|
|
|
import TeamPill, { TeamRole } from "./TeamPill";
|
|
|
|
|
|
|
|
interface Props {
|
2022-11-10 23:40:01 +00:00
|
|
|
team: RouterOutputs["viewer"]["teams"]["get"];
|
|
|
|
member: RouterOutputs["viewer"]["teams"]["get"]["members"][number];
|
2022-09-12 22:04:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** TODO: Migrate the one in apps/web to tRPC package */
|
|
|
|
const useCurrentUserId = () => {
|
|
|
|
const query = useMeQuery();
|
|
|
|
const user = query.data;
|
|
|
|
return user?.id;
|
|
|
|
};
|
|
|
|
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
const checkIsOrg = (team: Props["team"]) => {
|
|
|
|
const metadata = teamMetadataSchema.safeParse(team.metadata);
|
|
|
|
if (metadata.success && metadata.data?.isOrganization) return true;
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2022-09-12 22:04:33 +00:00
|
|
|
export default function MemberListItem(props: Props) {
|
|
|
|
const { t } = useLocale();
|
|
|
|
|
|
|
|
const utils = trpc.useContext();
|
|
|
|
const [showChangeMemberRoleModal, setShowChangeMemberRoleModal] = useState(false);
|
|
|
|
const [showTeamAvailabilityModal, setShowTeamAvailabilityModal] = useState(false);
|
2022-12-05 12:03:36 +00:00
|
|
|
const [showImpersonateModal, setShowImpersonateModal] = useState(false);
|
|
|
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
2022-09-12 22:04:33 +00:00
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const removeMemberMutation = trpc.viewer.teams.removeMember.useMutation({
|
2022-09-12 22:04:33 +00:00
|
|
|
async onSuccess() {
|
2022-11-10 23:40:01 +00:00
|
|
|
await utils.viewer.teams.get.invalidate();
|
2023-04-13 02:10:23 +00:00
|
|
|
await utils.viewer.eventTypes.invalidate();
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
await utils.viewer.organizations.listMembers.invalidate();
|
2022-09-12 22:04:33 +00:00
|
|
|
showToast(t("success"), "success");
|
|
|
|
},
|
|
|
|
async onError(err) {
|
|
|
|
showToast(err.message, "error");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const ownersInTeam = () => {
|
|
|
|
const { members } = props.team;
|
|
|
|
const owners = members.filter((member) => member["role"] === MembershipRole.OWNER && member["accepted"]);
|
|
|
|
return owners.length;
|
|
|
|
};
|
|
|
|
|
|
|
|
const currentUserId = useCurrentUserId();
|
|
|
|
|
|
|
|
const name =
|
|
|
|
props.member.name ||
|
|
|
|
(() => {
|
|
|
|
const emailName = props.member.email.split("@")[0];
|
|
|
|
return emailName.charAt(0).toUpperCase() + emailName.slice(1);
|
|
|
|
})();
|
|
|
|
|
|
|
|
const removeMember = () =>
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
removeMemberMutation.mutate({
|
|
|
|
teamId: props.team?.id,
|
|
|
|
memberId: props.member.id,
|
|
|
|
isOrg: checkIsOrg(props.team),
|
|
|
|
});
|
2022-09-12 22:04:33 +00:00
|
|
|
|
|
|
|
const editMode =
|
2023-08-02 19:09:43 +00:00
|
|
|
(props.team.membership?.role === MembershipRole.OWNER &&
|
2022-09-12 22:04:33 +00:00
|
|
|
(props.member.role !== MembershipRole.OWNER ||
|
|
|
|
ownersInTeam() > 1 ||
|
|
|
|
props.member.id !== currentUserId)) ||
|
2023-08-02 19:09:43 +00:00
|
|
|
(props.team.membership?.role === MembershipRole.ADMIN && props.member.role !== MembershipRole.OWNER);
|
2022-12-05 12:03:36 +00:00
|
|
|
const impersonationMode =
|
|
|
|
editMode &&
|
|
|
|
!props.member.disableImpersonation &&
|
|
|
|
props.member.accepted &&
|
|
|
|
process.env.NEXT_PUBLIC_TEAM_IMPERSONATION === "true";
|
2022-09-12 22:04:33 +00:00
|
|
|
|
2023-07-25 09:28:57 +00:00
|
|
|
const bookerUrl = useBookerUrl();
|
|
|
|
const bookerUrlWithoutProtocol = bookerUrl.replace(/^https?:\/\//, "");
|
|
|
|
const bookingLink = !!props.member.username && `${bookerUrlWithoutProtocol}/${props.member.username}`;
|
2023-04-02 10:26:22 +00:00
|
|
|
|
2022-09-12 22:04:33 +00:00
|
|
|
return (
|
2023-04-11 12:15:10 +00:00
|
|
|
<li className="divide-subtle divide-y px-5">
|
2022-09-12 22:04:33 +00:00
|
|
|
<div className="my-4 flex justify-between">
|
2023-08-10 08:49:17 +00:00
|
|
|
<div className="flex w-full flex-col justify-between truncate sm:flex-row">
|
2022-09-12 22:04:33 +00:00
|
|
|
<div className="flex">
|
|
|
|
<Avatar
|
|
|
|
size="sm"
|
2023-07-25 09:28:57 +00:00
|
|
|
imageSrc={bookerUrl + "/" + props.member.username + "/avatar.png"}
|
2022-09-12 22:04:33 +00:00
|
|
|
alt={name || ""}
|
|
|
|
className="h-10 w-10 rounded-full"
|
|
|
|
/>
|
|
|
|
|
2023-04-09 09:13:57 +00:00
|
|
|
<div className="ms-3 inline-block">
|
2022-09-12 22:04:33 +00:00
|
|
|
<div className="mb-1 flex">
|
2023-04-05 18:14:46 +00:00
|
|
|
<span className="text-default mr-1 text-sm font-bold leading-4">{name}</span>
|
2022-09-12 22:04:33 +00:00
|
|
|
|
|
|
|
{!props.member.accepted && <TeamPill color="orange" text={t("pending")} />}
|
|
|
|
{props.member.role && <TeamRole role={props.member.role} />}
|
|
|
|
</div>
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="text-default flex items-center">
|
|
|
|
<span className=" block text-sm" data-testid="member-email" data-email={props.member.email}>
|
2023-04-02 10:26:22 +00:00
|
|
|
{props.member.email}
|
|
|
|
</span>
|
2023-04-03 12:08:17 +00:00
|
|
|
{bookingLink && (
|
|
|
|
<>
|
2023-04-09 09:13:57 +00:00
|
|
|
<span className="text-default mx-2 block">•</span>
|
2023-04-05 09:54:25 +00:00
|
|
|
<a
|
|
|
|
target="_blank"
|
2023-07-25 09:28:57 +00:00
|
|
|
href={`${bookerUrl}/${props.member.username}`}
|
2023-04-09 09:13:57 +00:00
|
|
|
className="text-default block text-sm">
|
2023-04-05 09:54:25 +00:00
|
|
|
{bookingLink}
|
|
|
|
</a>
|
2023-04-03 12:08:17 +00:00
|
|
|
</>
|
|
|
|
)}
|
2023-04-02 10:26:22 +00:00
|
|
|
</div>
|
2022-09-12 22:04:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-02 19:09:43 +00:00
|
|
|
{props.team.membership?.accepted && (
|
2022-09-12 22:04:33 +00:00
|
|
|
<div className="flex items-center justify-center">
|
2023-04-05 18:14:46 +00:00
|
|
|
<ButtonGroup combined containerProps={{ className: "border-default hidden md:flex" }}>
|
2023-02-17 10:09:49 +00:00
|
|
|
{/* TODO: bring availability back. right now its ugly and broken
|
|
|
|
<Tooltip
|
2022-09-12 22:04:33 +00:00
|
|
|
content={
|
|
|
|
props.member.accepted
|
|
|
|
? t("team_view_user_availability")
|
|
|
|
: t("team_view_user_availability_disabled")
|
|
|
|
}>
|
|
|
|
<Button
|
|
|
|
disabled={!props.member.accepted}
|
|
|
|
onClick={() => (props.member.accepted ? setShowTeamAvailabilityModal(true) : null)}
|
|
|
|
color="secondary"
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Clock}
|
2022-09-12 22:04:33 +00:00
|
|
|
/>
|
2023-02-17 10:09:49 +00:00
|
|
|
</Tooltip> */}
|
2022-09-12 22:04:33 +00:00
|
|
|
<Tooltip content={t("view_public_page")}>
|
|
|
|
<Button
|
|
|
|
target="_blank"
|
2023-07-25 09:28:57 +00:00
|
|
|
href={`${bookerUrl}/${props.member.username}`}
|
2022-09-12 22:04:33 +00:00
|
|
|
color="secondary"
|
|
|
|
className={classNames(!editMode ? "rounded-r-md" : "")}
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={ExternalLink}
|
2023-06-23 08:53:00 +00:00
|
|
|
disabled={!props.member.accepted}
|
2022-09-12 22:04:33 +00:00
|
|
|
/>
|
|
|
|
</Tooltip>
|
|
|
|
{editMode && (
|
|
|
|
<Dropdown>
|
2023-01-22 00:03:59 +00:00
|
|
|
<DropdownMenuTrigger asChild>
|
2022-09-12 22:04:33 +00:00
|
|
|
<Button
|
2023-01-22 00:03:59 +00:00
|
|
|
className="radix-state-open:rounded-r-md"
|
2022-09-12 22:04:33 +00:00
|
|
|
color="secondary"
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={MoreHorizontal}
|
2022-09-12 22:04:33 +00:00
|
|
|
/>
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent>
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
onClick={() => setShowChangeMemberRoleModal(true)}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Edit2}>
|
2023-01-15 11:40:40 +00:00
|
|
|
{t("edit")}
|
2022-09-12 22:04:33 +00:00
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
2022-12-05 12:03:36 +00:00
|
|
|
{impersonationMode && (
|
|
|
|
<>
|
|
|
|
<DropdownMenuItem>
|
2023-01-15 11:40:40 +00:00
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
2022-12-05 12:03:36 +00:00
|
|
|
onClick={() => setShowImpersonateModal(true)}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Lock}>
|
2022-12-05 12:03:36 +00:00
|
|
|
{t("impersonate")}
|
2023-01-15 11:40:40 +00:00
|
|
|
</DropdownItem>
|
2022-12-05 12:03:36 +00:00
|
|
|
</DropdownMenuItem>
|
2023-01-15 11:40:40 +00:00
|
|
|
<DropdownMenuSeparator />
|
2022-12-05 12:03:36 +00:00
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
onClick={() => setShowDeleteModal(true)}
|
|
|
|
color="destructive"
|
2023-06-22 19:33:03 +00:00
|
|
|
StartIcon={UserX}>
|
|
|
|
{t("remove")}
|
2022-12-05 12:03:36 +00:00
|
|
|
</DropdownItem>
|
2022-09-12 22:04:33 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</Dropdown>
|
|
|
|
)}
|
|
|
|
</ButtonGroup>
|
|
|
|
<div className="flex md:hidden">
|
|
|
|
<Dropdown>
|
|
|
|
<DropdownMenuTrigger asChild>
|
2023-04-12 15:26:31 +00:00
|
|
|
<Button type="button" variant="icon" color="minimal" StartIcon={MoreHorizontal} />
|
2022-09-12 22:04:33 +00:00
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent>
|
|
|
|
<DropdownMenuItem className="outline-none">
|
2023-06-23 08:53:00 +00:00
|
|
|
<DropdownItem
|
|
|
|
disabled={!props.member.accepted}
|
2023-06-26 10:37:59 +00:00
|
|
|
href={!props.member.accepted ? undefined : "/" + props.member.username}
|
2023-06-23 08:53:00 +00:00
|
|
|
target="_blank"
|
|
|
|
type="button"
|
|
|
|
StartIcon={ExternalLink}>
|
2022-09-12 22:04:33 +00:00
|
|
|
{t("view_public_page")}
|
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
{editMode && (
|
|
|
|
<>
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
onClick={() => setShowChangeMemberRoleModal(true)}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Edit2}>
|
2023-01-20 19:57:14 +00:00
|
|
|
{t("edit")}
|
2022-09-12 22:04:33 +00:00
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
<DropdownMenuItem>
|
2022-12-05 12:03:36 +00:00
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
color="destructive"
|
|
|
|
onClick={() => setShowDeleteModal(true)}
|
2023-06-22 19:33:03 +00:00
|
|
|
StartIcon={UserX}>
|
|
|
|
{t("remove")}
|
2022-12-05 12:03:36 +00:00
|
|
|
</DropdownItem>
|
2022-09-12 22:04:33 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2022-12-05 12:03:36 +00:00
|
|
|
|
|
|
|
{editMode && (
|
feat: from org team invite (#9569)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Split into function calls to make this file more explisit
* Update parents stripe sub not teamID
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Create org membership also - billing portal page
* A11ly
* Hide create team if no valid permisisons
* Get Org members router
* Handle updating subscription if orgId
* Fix double upgrade banner
* Update constants
* Feedback
* Copy change
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Fix import again
* Throw no team found before auth error
* Check if invited found user is already in differnt org
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Move to for of loop to throw errors in usenamelist
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Fix router
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Use org Stripe product when upgrading
* Removed unused code
* UI completed
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Reverts
* Add correct array logic and move to controlled component
* Fix toggle group default | Update toggle group bg
* Darkmode toggle group
* Distinct user
* Hide modal if no org members
* Extract toggle logic
* Update packages/features/ee/organizations/components/TeamInviteFromOrg.tsx
* remove yarn.lock from commit
* Fix types
* Add getMember router back
* As a query lol
* Fix types
* Fix accepted param defaulting to true as we want both
* Fix list not pulling back people who have not joined the org yet
* Fix tests to handle invite a existing org user to a team
* Fix test
* Fix an error sometimes when existing org user is invited
* Updates radix & fixes bug
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Shivam Kalra <shivamkalra98@gmail.com>
2023-07-10 09:46:51 +00:00
|
|
|
<Dialog open={showDeleteModal} onOpenChange={() => setShowDeleteModal((prev) => !prev)}>
|
2022-12-05 12:03:36 +00:00
|
|
|
<ConfirmationDialogContent
|
|
|
|
variety="danger"
|
|
|
|
title={t("remove_member")}
|
|
|
|
confirmBtnText={t("confirm_remove_member")}
|
|
|
|
onConfirm={removeMember}>
|
|
|
|
{t("remove_member_confirmation_message")}
|
|
|
|
</ConfirmationDialogContent>
|
|
|
|
</Dialog>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{showImpersonateModal && props.member.username && (
|
|
|
|
<Dialog open={showImpersonateModal} onOpenChange={() => setShowImpersonateModal(false)}>
|
|
|
|
<DialogContent type="creation" title={t("impersonate")} description={t("impersonation_user_tip")}>
|
|
|
|
<form
|
|
|
|
onSubmit={async (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
await signIn("impersonation-auth", {
|
2023-02-21 17:12:26 +00:00
|
|
|
username: props.member.username || props.member.email,
|
2022-12-05 12:03:36 +00:00
|
|
|
teamId: props.team.id,
|
|
|
|
});
|
|
|
|
setShowImpersonateModal(false);
|
|
|
|
}}>
|
2023-06-29 07:47:16 +00:00
|
|
|
<DialogFooter showDivider className="mt-8">
|
2022-12-05 12:03:36 +00:00
|
|
|
<DialogClose color="secondary">{t("cancel")}</DialogClose>
|
|
|
|
<Button color="primary" type="submit">
|
|
|
|
{t("impersonate")}
|
|
|
|
</Button>
|
|
|
|
</DialogFooter>
|
|
|
|
</form>
|
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
|
|
|
)}
|
|
|
|
|
2022-09-12 22:04:33 +00:00
|
|
|
{showChangeMemberRoleModal && (
|
|
|
|
<MemberChangeRoleModal
|
|
|
|
isOpen={showChangeMemberRoleModal}
|
|
|
|
currentMember={props.team.membership.role}
|
|
|
|
teamId={props.team?.id}
|
|
|
|
memberId={props.member.id}
|
|
|
|
initialRole={props.member.role as MembershipRole}
|
|
|
|
onExit={() => setShowChangeMemberRoleModal(false)}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{showTeamAvailabilityModal && (
|
|
|
|
<Dialog open={showTeamAvailabilityModal} onOpenChange={() => setShowTeamAvailabilityModal(false)}>
|
2022-11-28 19:14:38 +00:00
|
|
|
<DialogContent type="creation" size="md">
|
2022-09-12 22:04:33 +00:00
|
|
|
<TeamAvailabilityModal team={props.team} member={props.member} />
|
2022-11-28 19:14:38 +00:00
|
|
|
<DialogFooter>
|
2022-09-12 22:04:33 +00:00
|
|
|
<Button onClick={() => setShowTeamAvailabilityModal(false)}>{t("done")}</Button>
|
2022-11-28 19:14:38 +00:00
|
|
|
</DialogFooter>
|
2022-09-12 22:04:33 +00:00
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
|
|
|
)}
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|