fix: move organization members list (#17531)
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
1 parent
afd730e1c8
commit
877e4199e7
17 files changed
+112
-53
No files matched your search
@@ -17,11 +17,7 @@ const PoweredByCal = ({ logoOnly }: { logoOnly?: boolean }) => {
|
||||
{!logoOnly && <>{t("powered_by")} </>}
|
||||
{APP_NAME === "Cal.com" || !hasValidLicense ? (
|
||||
<>
|
||||
<img
|
||||
className="-mt-px inline h-[10px] w-auto dark:invert"
|
||||
src="/api/logo"
|
||||
alt="Cal.com Logo"
|
||||
/>
|
||||
<img className="-mt-px inline h-[10px] w-auto dark:invert" src="/api/logo" alt="Cal.com Logo" />
|
||||
</>
|
||||
) : (
|
||||
<span className="text-emphasis font-semibold opacity-50 hover:opacity-100">{APP_NAME}</span>
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ import { UserListTable } from "@calcom/features/users/components/UserTable/UserL
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Meta } from "@calcom/ui";
|
||||
|
||||
const MembersView = () => {
|
||||
const { t } = useLocale();
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
Button,
|
||||
Form,
|
||||
Label,
|
||||
Meta,
|
||||
Select,
|
||||
showToast,
|
||||
SkeletonButton,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Meta } from "@calcom/ui";
|
||||
|
||||
import { OtherTeamsListing } from "./../components/OtherTeamsListing";
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
ImageUploader,
|
||||
Label,
|
||||
LinkIconButton,
|
||||
Meta,
|
||||
showToast,
|
||||
SkeletonContainer,
|
||||
SkeletonText,
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
ImageUploader,
|
||||
Label,
|
||||
LinkIconButton,
|
||||
Meta,
|
||||
showToast,
|
||||
SkeletonAvatar,
|
||||
SkeletonButton,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useSession } from "next-auth/react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { AppSkeletonLoader as SkeletonLoader, Meta } from "@calcom/ui";
|
||||
import { AppSkeletonLoader as SkeletonLoader } from "@calcom/ui";
|
||||
|
||||
import SSOConfiguration from "../components/SSOConfiguration";
|
||||
|
||||
|
||||
@@ -78,10 +78,6 @@ const tabs: VerticalTabItemProps[] = [
|
||||
name: "general",
|
||||
href: "/settings/organizations/general",
|
||||
},
|
||||
{
|
||||
name: "members",
|
||||
href: "/settings/organizations/members",
|
||||
},
|
||||
{
|
||||
name: "privacy",
|
||||
href: "/settings/organizations/privacy",
|
||||
|
||||
@@ -77,10 +77,6 @@ const tabs: VerticalTabItemProps[] = [
|
||||
name: "general",
|
||||
href: "/settings/organizations/general",
|
||||
},
|
||||
{
|
||||
name: "members",
|
||||
href: "/settings/organizations/members",
|
||||
},
|
||||
{
|
||||
name: "privacy",
|
||||
href: "/settings/organizations/privacy",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
|
||||
import UnconfirmedBookingBadge from "@calcom/features/bookings/UnconfirmedBookingBadge";
|
||||
import {
|
||||
useOrgBranding,
|
||||
type OrganizationBranding,
|
||||
} from "@calcom/features/ee/organizations/context/provider";
|
||||
import { KBarTrigger } from "@calcom/features/kbar/Kbar";
|
||||
import { classNames } from "@calcom/lib";
|
||||
|
||||
@@ -11,7 +16,7 @@ import { NavigationItem, MobileNavigationItem, MobileNavigationMoreItem } from "
|
||||
|
||||
export const MORE_SEPARATOR_NAME = "more";
|
||||
|
||||
const navigation: NavigationItemType[] = [
|
||||
const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemType[] => [
|
||||
{
|
||||
name: "event_types_page_title",
|
||||
href: "/event-types",
|
||||
@@ -29,6 +34,15 @@ const navigation: NavigationItemType[] = [
|
||||
href: "/availability",
|
||||
icon: "clock",
|
||||
},
|
||||
...(orgBranding
|
||||
? [
|
||||
{
|
||||
name: "members",
|
||||
href: `/settings/organizations/${orgBranding.slug}/members`,
|
||||
icon: "building",
|
||||
} satisfies NavigationItemType,
|
||||
]
|
||||
: []),
|
||||
{
|
||||
name: "teams",
|
||||
href: "/teams",
|
||||
@@ -102,7 +116,7 @@ const navigation: NavigationItemType[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const platformNavigation: NavigationItemType[] = [
|
||||
const platformNavigationItems: NavigationItemType[] = [
|
||||
{
|
||||
name: "Dashboard",
|
||||
href: "/settings/platform/",
|
||||
@@ -144,33 +158,36 @@ const platformNavigation: NavigationItemType[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const getDesktopNavigationItems = (isPlatformNavigation = false) => {
|
||||
const navigationType = !isPlatformNavigation ? navigation : platformNavigation;
|
||||
const moreSeparatorIndex = navigationType.findIndex((item) => item.name === MORE_SEPARATOR_NAME);
|
||||
const useNavigationItems = (isPlatformNavigation = false) => {
|
||||
const orgBranding = useOrgBranding();
|
||||
return useMemo(() => {
|
||||
const navigationType = !isPlatformNavigation ? getNavigationItems(orgBranding) : platformNavigationItems;
|
||||
const moreSeparatorIndex = navigationType.findIndex((item) => item.name === MORE_SEPARATOR_NAME);
|
||||
|
||||
const { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems } = (
|
||||
!isPlatformNavigation ? navigation : platformNavigation
|
||||
).reduce<Record<string, NavigationItemType[]>>(
|
||||
(items, item, index) => {
|
||||
// We filter out the "more" separator in` desktop navigation
|
||||
if (item.name !== MORE_SEPARATOR_NAME) items.desktopNavigationItems.push(item);
|
||||
// Items for mobile bottom navigation
|
||||
if (index < moreSeparatorIndex + 1 && !item.onlyDesktop) {
|
||||
items.mobileNavigationBottomItems.push(item);
|
||||
} // Items for the "more" menu in mobile navigation
|
||||
else {
|
||||
items.mobileNavigationMoreItems.push(item);
|
||||
}
|
||||
return items;
|
||||
},
|
||||
{ desktopNavigationItems: [], mobileNavigationBottomItems: [], mobileNavigationMoreItems: [] }
|
||||
);
|
||||
const { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems } = (
|
||||
!isPlatformNavigation ? getNavigationItems(orgBranding) : platformNavigationItems
|
||||
).reduce<Record<string, NavigationItemType[]>>(
|
||||
(items, item, index) => {
|
||||
// We filter out the "more" separator in` desktop navigation
|
||||
if (item.name !== MORE_SEPARATOR_NAME) items.desktopNavigationItems.push(item);
|
||||
// Items for mobile bottom navigation
|
||||
if (index < moreSeparatorIndex + 1 && !item.onlyDesktop) {
|
||||
items.mobileNavigationBottomItems.push(item);
|
||||
} // Items for the "more" menu in mobile navigation
|
||||
else {
|
||||
items.mobileNavigationMoreItems.push(item);
|
||||
}
|
||||
return items;
|
||||
},
|
||||
{ desktopNavigationItems: [], mobileNavigationBottomItems: [], mobileNavigationMoreItems: [] }
|
||||
);
|
||||
|
||||
return { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems };
|
||||
return { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems };
|
||||
}, [isPlatformNavigation, orgBranding]);
|
||||
};
|
||||
|
||||
export const Navigation = ({ isPlatformNavigation = false }: { isPlatformNavigation?: boolean }) => {
|
||||
const { desktopNavigationItems } = getDesktopNavigationItems(isPlatformNavigation);
|
||||
const { desktopNavigationItems } = useNavigationItems(isPlatformNavigation);
|
||||
|
||||
return (
|
||||
<nav className="mt-2 flex-1 md:px-2 lg:mt-4 lg:px-0">
|
||||
@@ -196,7 +213,7 @@ export function MobileNavigationContainer({
|
||||
|
||||
const MobileNavigation = ({ isPlatformNavigation = false }: { isPlatformNavigation?: boolean }) => {
|
||||
const isEmbed = useIsEmbed();
|
||||
const { mobileNavigationBottomItems } = getDesktopNavigationItems(isPlatformNavigation);
|
||||
const { mobileNavigationBottomItems } = useNavigationItems(isPlatformNavigation);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -216,7 +233,7 @@ const MobileNavigation = ({ isPlatformNavigation = false }: { isPlatformNavigati
|
||||
};
|
||||
|
||||
export const MobileNavigationMoreItems = () => {
|
||||
const { mobileNavigationMoreItems } = getDesktopNavigationItems();
|
||||
const { mobileNavigationMoreItems } = useNavigationItems();
|
||||
|
||||
return (
|
||||
<ul className="border-subtle mt-2 rounded-md border">
|
||||
|
||||
Reference in new issue
Block a user