Scheduling infrastructure for absolutely everyone.
fix: /members improvements (#17911)
Eunjae Leea5ba2682f60a
diff --git a/apps/web/modules/members/members-view.tsx b/apps/web/modules/members/members-view.tsxindex 8f89e88b165..b03c97375fe 100644--- a/apps/web/modules/members/members-view.tsx+++ b/apps/web/modules/members/members-view.tsx@@ -13,8 +13,6 @@ const MembersPage: React.FC = () => {title={t("organization_members")}description={t("organization_description")}withoutSeo- heading={t("organization_members")}- hideHeadingOnMobilesubtitle={t("organization_description")}><HeadSeo title={t("organization_members")} description={t("organization_description")} />diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 08b4923889b..1c2067e65d7 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -2825,6 +2825,7 @@"disable_org_url_description": "Redirects {{orgSlug}}.cal.com to {{destination}}","single_select": "Single Select","multi_select": "Multi Select",+ "group_meeting": "Group Meeting","ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"}diff --git a/packages/features/data-table/components/DataTableSelectionBar.tsx b/packages/features/data-table/components/DataTableSelectionBar.tsxindex eab89a52aa6..32d6da61476 100644--- a/packages/features/data-table/components/DataTableSelectionBar.tsx+++ b/packages/features/data-table/components/DataTableSelectionBar.tsx@@ -4,6 +4,7 @@ import type { Table } from "@tanstack/react-table";import { forwardRef } from "react";import { classNames } from "@calcom/lib";+import { Button, Icon } from "@calcom/ui";import type { IconName } from "@calcom/ui";export type ActionItem<TData> =@@ -20,19 +21,41 @@ export type ActionItem<TData> =needsXSelected?: number;};+type ResponsiveButtonProps = {+ className?: string;+ icon: IconName;+ onClick?: () => void;+ children: string;+};++const ResponsiveButton = forwardRef<HTMLButtonElement, ResponsiveButtonProps>(+ ({ className, icon, onClick, children }, ref) => {+ return (+ <Button ref={ref} onClick={onClick} title={children}>+ <Icon name={icon} size={18} className="sm:hidden" />+ <Icon name={icon} size={16} className="mr-2 hidden shrink-0 sm:inline" />+ <span className="sr-only shrink-0 md:not-sr-only">{children}</span>+ </Button>+ );+ }+);++ResponsiveButton.displayName = "ResponsiveButton";+const Root = forwardRef<HTMLDivElement,React.HTMLAttributes<HTMLDivElement> & { showSelectionCount?: boolean }>(({ children, ...props }, ref) => {+ const { className, style, ...rest } = props;return (<divref={ref}className={classNames(- "bg-brand-default text-brand fixed bottom-4 left-1/2 flex w-fit -translate-x-1/2 transform items-center space-x-3 rounded-lg px-4 py-2",- props.className+ "bg-brand-default text-brand fixed bottom-0 left-0 z-40 flex w-full items-center space-x-1 overflow-x-auto px-2 py-2 sm:space-x-2 md:bottom-4 md:left-1/2 md:z-auto md:w-fit md:-translate-x-1/2 md:transform md:space-x-3 md:overflow-x-hidden md:rounded-lg md:px-4",+ className)}- style={{ ...props.style }}- {...props}>+ style={{ ...style }}+ {...rest}>{children}</div>);@@ -42,4 +65,5 @@ Root.displayName = "Root";export const DataTableSelectionBar = {Root,+ Button: ResponsiveButton,};diff --git a/packages/features/ee/teams/components/DeleteBulkTeamMembers.tsx b/packages/features/ee/teams/components/DeleteBulkTeamMembers.tsxindex f131747375c..6938a0e14f1 100644--- a/packages/features/ee/teams/components/DeleteBulkTeamMembers.tsx+++ b/packages/features/ee/teams/components/DeleteBulkTeamMembers.tsx@@ -1,6 +1,7 @@+import { DataTableSelectionBar } from "@calcom/features/data-table";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc/react";-import { Button, ConfirmationDialogContent, Dialog, DialogTrigger, showToast } from "@calcom/ui";+import { ConfirmationDialogContent, Dialog, DialogTrigger, showToast } from "@calcom/ui";import type { User } from "./MemberList";@@ -30,7 +31,7 @@ export default function DeleteBulkTeamMembers({ users, onRemove, isOrg, teamId }return (<Dialog><DialogTrigger asChild>- <Button StartIcon="ban">{t("Delete")}</Button>+ <DataTableSelectionBar.Button icon="ban">{t("Delete")}</DataTableSelectionBar.Button></DialogTrigger><ConfirmationDialogContentvariety="danger"diff --git a/packages/features/ee/teams/components/EventTypesList.tsx b/packages/features/ee/teams/components/EventTypesList.tsxindex 77a273807a7..60dbd6afbe7 100644--- a/packages/features/ee/teams/components/EventTypesList.tsx+++ b/packages/features/ee/teams/components/EventTypesList.tsx@@ -1,7 +1,8 @@import type { Table } from "@tanstack/react-table";import type { Dispatch, SetStateAction } from "react";-import { useState } from "react";+import { useState, Fragment } from "react";+import { DataTableSelectionBar } from "@calcom/features/data-table";import classNames from "@calcom/lib/classNames";import { useLocale } from "@calcom/lib/hooks/useLocale";import { SchedulingType } from "@calcom/prisma/enums";@@ -93,7 +94,7 @@ export function EventTypesList({ table, teamId }: Props) {<><Popover><PopoverTrigger asChild>- <Button StartIcon="link">{t("add_to_event_type")}</Button>+ <DataTableSelectionBar.Button icon="link">{t("add_to_event_type")}</DataTableSelectionBar.Button></PopoverTrigger><PopoverContent className="w-[200px] p-0 shadow-md" align="start" sideOffset={12}><Command>@@ -108,7 +109,7 @@ export function EventTypesList({ table, teamId }: Props) {if (events.length === 0 || !teamId) return null;return (- <>+ <Fragment key={teamId}>{events.map((event) => {const hosts = event.hosts;const areAllUsersHostForEventType = selectedUsers.every((user) =>@@ -143,7 +144,7 @@ export function EventTypesList({ table, teamId }: Props) {/>);})}- </>+ </Fragment>);})}</CommandGroup>diff --git a/packages/features/ee/teams/components/MemberList.tsx b/packages/features/ee/teams/components/MemberList.tsxindex 957d0dac070..f5fdc0cca41 100644--- a/packages/features/ee/teams/components/MemberList.tsx+++ b/packages/features/ee/teams/components/MemberList.tsx@@ -674,19 +674,21 @@ export default function MemberList(props: Props) {</DataTableToolbar.Root>{numberOfSelectedRows >= 2 && dynamicLinkVisible && (- <DataTableSelectionBar.Root style={{ bottom: "5rem" }}>+ <DataTableSelectionBar.Root className="!bottom-16 md:!bottom-20"><DynamicLink table={table} domain={domain} /></DataTableSelectionBar.Root>)}{numberOfSelectedRows > 0 && (- <DataTableSelectionBar.Root>- <p className="text-brand-subtle w-full px-2 text-center leading-none">- {numberOfSelectedRows} selected+ <DataTableSelectionBar.Root className="justify-center">+ <p className="text-brand-subtle px-2 text-center text-xs leading-none sm:text-sm sm:font-medium">+ {t("number_selected", { count: numberOfSelectedRows })}</p>{numberOfSelectedRows >= 2 && (- <Button onClick={() => setDynamicLinkVisible(!dynamicLinkVisible)} StartIcon="handshake">- Group Meeting- </Button>+ <DataTableSelectionBar.Button+ onClick={() => setDynamicLinkVisible(!dynamicLinkVisible)}+ icon="handshake">+ {t("group_meeting")}+ </DataTableSelectionBar.Button>)}<EventTypesList table={table} teamId={props.team.id} /><DeleteBulkTeamMembersdiff --git a/packages/features/shell/navigation/Navigation.tsx b/packages/features/shell/navigation/Navigation.tsxindex f246f4aff6f..000c9a15f18 100644--- a/packages/features/shell/navigation/Navigation.tsx+++ b/packages/features/shell/navigation/Navigation.tsx@@ -40,6 +40,7 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTyname: "members",href: `/settings/organizations/${orgBranding.slug}/members`,icon: "building",+ moreOnMobile: true,} satisfies NavigationItemType,]: []),@@ -90,17 +91,20 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTyhref: "/apps/routing-forms/forms",icon: "file-text",isCurrent: ({ pathname }) => pathname?.startsWith("/apps/routing-forms/") ?? false,+ moreOnMobile: true,},{name: "workflows",href: "/workflows",icon: "zap",+ moreOnMobile: true,},{name: "insights",href: "/insights",icon: "chart-bar",isCurrent: ({ pathname: path, item }) => path?.startsWith(item.href) ?? false,+ moreOnMobile: true,child: [{name: "bookings",@@ -150,36 +154,27 @@ const platformNavigationItems: NavigationItemType[] = [name: "Billing",href: "/settings/platform/billing",icon: "credit-card",+ moreOnMobile: true,},{name: "Members",href: "/settings/platform/members",icon: "users",+ moreOnMobile: true,},];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 items = !isPlatformNavigation ? getNavigationItems(orgBranding) : platformNavigationItems;- 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: [] }+ const desktopNavigationItems = items.filter((item) => item.name !== MORE_SEPARATOR_NAME);+ const mobileNavigationBottomItems = items.filter(+ (item) => (!item.moreOnMobile && !item.onlyDesktop) || item.name === MORE_SEPARATOR_NAME+ );+ const mobileNavigationMoreItems = items.filter(+ (item) => item.moreOnMobile && !item.onlyDesktop && item.name !== MORE_SEPARATOR_NAME);return { desktopNavigationItems, mobileNavigationBottomItems, mobileNavigationMoreItems };diff --git a/packages/features/shell/navigation/NavigationItem.tsx b/packages/features/shell/navigation/NavigationItem.tsxindex 2dcd5f4c925..0b0dd4d02fd 100644--- a/packages/features/shell/navigation/NavigationItem.tsx+++ b/packages/features/shell/navigation/NavigationItem.tsx@@ -21,6 +21,7 @@ export type NavigationItemType = {pro?: true;onlyMobile?: boolean;onlyDesktop?: boolean;+ moreOnMobile?: boolean;isCurrent?: ({item,isChild,diff --git a/packages/features/users/components/UserTable/BulkActions/DeleteBulkUsers.tsx b/packages/features/users/components/UserTable/BulkActions/DeleteBulkUsers.tsxindex 1cbb879bdd2..55b7619d502 100644--- a/packages/features/users/components/UserTable/BulkActions/DeleteBulkUsers.tsx+++ b/packages/features/users/components/UserTable/BulkActions/DeleteBulkUsers.tsx@@ -1,6 +1,7 @@+import { DataTableSelectionBar } from "@calcom/features/data-table";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc/react";-import { Button, ConfirmationDialogContent, Dialog, DialogTrigger, showToast } from "@calcom/ui";+import { ConfirmationDialogContent, Dialog, DialogTrigger, showToast } from "@calcom/ui";import type { UserTableUser } from "../types";@@ -38,7 +39,7 @@ export function DeleteBulkUsers({ users, onRemove }: Props) {return (<Dialog><DialogTrigger asChild>- <Button StartIcon="ban">{t("Delete")}</Button>+ <DataTableSelectionBar.Button icon="ban">{t("Delete")}</DataTableSelectionBar.Button></DialogTrigger><ConfirmationDialogContentvariety="danger"diff --git a/packages/features/users/components/UserTable/BulkActions/DynamicLink.tsx b/packages/features/users/components/UserTable/BulkActions/DynamicLink.tsxindex c400468cebd..13c776dcbd9 100644--- a/packages/features/users/components/UserTable/BulkActions/DynamicLink.tsx+++ b/packages/features/users/components/UserTable/BulkActions/DynamicLink.tsx@@ -32,10 +32,10 @@ export function DynamicLink<T extends { username: string | null }>({<>{isVisible ? (<div className="w-full gap-1 rounded-lg text-sm font-medium leading-none md:flex">- <div className="max-w-[300px] items-center truncate p-2">- <p>{domainWithoutHttps}</p>+ <div className="items-center truncate p-2 md:max-w-[300px]">+ <p className="text-center md:text-left">{domainWithoutHttps}</p></div>- <div className="ml-auto flex items-center">+ <div className="ml-auto flex items-center justify-center md:justify-start"><Button StartIcon="copy" size="sm" onClick={() => copyToClipboard(dynamicLinkOfSelectedUsers)}>{!isCopied ? t("copy") : t("copied")}</Button>diff --git a/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx b/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsxindex 1b634fc8af4..86117bb1658 100644--- a/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx+++ b/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx@@ -2,6 +2,7 @@ import type { Table } from "@tanstack/react-table";import type { Dispatch, SetStateAction } from "react";import { useState, Fragment } from "react";+import { DataTableSelectionBar } from "@calcom/features/data-table";import classNames from "@calcom/lib/classNames";import { useLocale } from "@calcom/lib/hooks/useLocale";import { SchedulingType } from "@calcom/prisma/enums";@@ -97,7 +98,7 @@ export function EventTypesList({ table, orgTeams }: Props) {<><Popover><PopoverTrigger asChild>- <Button StartIcon="link">{t("add_to_event_type")}</Button>+ <DataTableSelectionBar.Button icon="link">{t("add_to_event_type")}</DataTableSelectionBar.Button></PopoverTrigger><PopoverContent className="w-[200px] p-0 shadow-md" align="start" sideOffset={12}><Command>diff --git a/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx b/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsxindex 861c5ab977b..9cdb09d5e9b 100644--- a/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx+++ b/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx@@ -3,6 +3,7 @@ import type { ColumnFiltersState } from "@tanstack/react-table";import { createContext, useContext, useState, useMemo, type PropsWithChildren } from "react";import type { Dispatch, SetStateAction } from "react";+import { DataTableSelectionBar } from "@calcom/features/data-table";import classNames from "@calcom/lib/classNames";import { useLocale } from "@calcom/lib/hooks/useLocale";import slugify from "@calcom/lib/slugify";@@ -329,7 +330,7 @@ function MassAssignAttributesBulkActionComponent({ table, filters }: Props) {}}}><PopoverTrigger asChild>- <Button StartIcon="map-pin">{t("add_attributes")}</Button>+ <DataTableSelectionBar.Button icon="tags">{t("add_attributes")}</DataTableSelectionBar.Button></PopoverTrigger>{/* We dont really use shadows much - but its needed here */}<PopoverContent className="p-0 shadow-md" align="start" sideOffset={12}>diff --git a/packages/features/users/components/UserTable/BulkActions/TeamList.tsx b/packages/features/users/components/UserTable/BulkActions/TeamList.tsxindex 4496229fa4b..5f9bc5af404 100644--- a/packages/features/users/components/UserTable/BulkActions/TeamList.tsx+++ b/packages/features/users/components/UserTable/BulkActions/TeamList.tsx@@ -2,6 +2,7 @@ import type { Table } from "@tanstack/react-table";import type { Dispatch, SetStateAction } from "react";import { useState } from "react";+import { DataTableSelectionBar } from "@calcom/features/data-table";import classNames from "@calcom/lib/classNames";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc";@@ -86,7 +87,7 @@ export function TeamListBulkAction({ table }: Props) {<><Popover><PopoverTrigger asChild>- <Button StartIcon="users">{t("add_to_team")}</Button>+ <DataTableSelectionBar.Button icon="users">{t("add_to_team")}</DataTableSelectionBar.Button></PopoverTrigger>{/* We dont really use shadows much - but its needed here */}<PopoverContent className="w-[200px] p-0 shadow-md" align="start" sideOffset={12}>diff --git a/packages/features/users/components/UserTable/UserListTable.tsx b/packages/features/users/components/UserTable/UserListTable.tsxindex e02ee4d4dce..3f139745aaa 100644--- a/packages/features/users/components/UserTable/UserListTable.tsx+++ b/packages/features/users/components/UserTable/UserListTable.tsx@@ -34,7 +34,7 @@ import {import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc";-import { Avatar, Badge, Button, Checkbox, showToast } from "@calcom/ui";+import { Avatar, Badge, Checkbox, showToast } from "@calcom/ui";import { useGetUserAttributes } from "@calcom/web/components/settings/platform/hooks/useGetUserAttributes";import { DeleteBulkUsers } from "./BulkActions/DeleteBulkUsers";@@ -176,6 +176,7 @@ export function UserListTable() {meta: {filterType: attribute.type.toLowerCase() === "text" ? "text" : "select",},+ size: 120,accessorFn: (data) => data.attributes.find((attr) => attr.attributeId === attribute.id)?.value,cell: ({ row }) => {const attributeValues = row.original.attributes.filter(@@ -280,6 +281,7 @@ export function UserListTable() {id: "role",accessorFn: (data) => data.role,header: "Role",+ size: 100,cell: ({ row, table }) => {const { role, username } = row.original;return (@@ -307,7 +309,7 @@ export function UserListTable() {id: "teams",accessorFn: (data) => data.teams.map((team) => team.name),header: "Teams",- size: 200,+ size: 140,cell: ({ row, table }) => {const { teams, accepted, email, username } = row.original;// TODO: Implement click to filter@@ -546,22 +548,24 @@ export function UserListTable() {</div>{numberOfSelectedRows >= 2 && dynamicLinkVisible && (- <DataTableSelectionBar.Root style={{ bottom: "5rem" }}>+ <DataTableSelectionBar.Root className="!bottom-16 md:!bottom-20"><DynamicLink table={table} domain={domain} /></DataTableSelectionBar.Root>)}{numberOfSelectedRows > 0 && (- <DataTableSelectionBar.Root>- <p className="text-brand-subtle w-full px-2 text-center leading-none">- {numberOfSelectedRows} selected+ <DataTableSelectionBar.Root className="justify-center">+ <p className="text-brand-subtle px-2 text-center text-xs leading-none sm:text-sm sm:font-medium">+ {t("number_selected", { count: numberOfSelectedRows })}</p>{!isPlatformUser ? (<><TeamListBulkAction table={table} />{numberOfSelectedRows >= 2 && (- <Button onClick={() => setDynamicLinkVisible(!dynamicLinkVisible)} StartIcon="handshake">- Group Meeting- </Button>+ <DataTableSelectionBar.Button+ onClick={() => setDynamicLinkVisible(!dynamicLinkVisible)}+ icon="handshake">+ {t("group_meeting")}+ </DataTableSelectionBar.Button>)}<MassAssignAttributesBulkAction table={table} filters={columnFilters} /><EventTypesList table={table} orgTeams={teams} />