fix: provide fixed widths for DataTable columns (#17853)

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
Eunjae LeeandOmar López authored and GitHub committed 2024-11-26 20:17:33 +00:00
1 parent f81716fbb2
commit e22fec93b1
7 files changed
+71 -43

No files matched your search

@@ -24,6 +24,7 @@ import {
isTextFilterValue,
} from "@calcom/features/data-table";
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
import classNames from "@calcom/lib/classNames";
import { WEBAPP_URL } from "@calcom/lib/constants";
import {
downloadAsCsv,
@@ -125,7 +126,7 @@ export function UserListTable() {
const { data, isPending, fetchNextPage, isFetching } =
trpc.viewer.organizations.listMembers.useInfiniteQuery(
{
limit: 10,
limit: 30,
searchTerm: debouncedSearchTerm,
expand: ["attributes"],
filters: columnFilters,
@@ -182,13 +183,13 @@ export function UserListTable() {
);
if (attributeValues.length === 0) return null;
return (
<>
<div className={classNames(attribute.type === "NUMBER" ? "flex w-full justify-center" : "")}>
{attributeValues.map((attributeValue, index) => (
<Badge key={index} variant="gray" className="mr-1">
{attributeValue.value}
</Badge>
))}
</>
</div>
);
},
filterFn: (row, id, filterValue) => {
@@ -237,7 +238,7 @@ export function UserListTable() {
id: "member",
accessorFn: (data) => data.email,
enableHiding: false,
size: 170,
size: 200,
header: () => {
return `Members`;
},
@@ -306,6 +307,7 @@ export function UserListTable() {
id: "teams",
accessorFn: (data) => data.teams.map((team) => team.name),
header: "Teams",
size: 200,
cell: ({ row, table }) => {
const { teams, accepted, email, username } = row.original;
// TODO: Implement click to filter
@@ -323,6 +325,7 @@ export function UserListTable() {
Pending
</Badge>
)}
{teams.map((team) => (
<Badge
key={team.id}
@@ -350,7 +353,7 @@ export function UserListTable() {
{
id: "actions",
enableHiding: false,
size: 50,
size: 80,
meta: {
sticky: { position: "right" },
},
@@ -392,6 +395,9 @@ export function UserListTable() {
initialState: {
columnVisibility: initalColumnVisibility,
},
defaultColumn: {
size: 150,
},
state: {
columnFilters,
rowSelection,
@@ -534,6 +540,7 @@ export function UserListTable() {
<DataTableFilters.ActiveFilters table={table} />
</div>
</DataTableToolbar.Root>
<div style={{ gridArea: "footer", marginTop: "1rem" }}>
<DataTablePagination table={table} totalDbDataCount={totalDBRowCount} />
</div>
@@ -567,7 +574,6 @@ export function UserListTable() {
</DataTableSelectionBar.Root>
)}
</DataTable>
{state.deleteMember.showModal && <DeleteMemberModal state={state} dispatch={dispatch} />}
{state.inviteMember.showModal && <InviteMemberModal dispatch={dispatch} />}
{state.impersonateMember.showModal && <ImpersonationMemberModal dispatch={dispatch} state={state} />}
@@ -53,7 +53,7 @@ export function TableActions({
const orgId = session?.user?.org?.id;
return (
<>
<div className="flex w-full justify-center">
<ButtonGroup combined containerProps={{ className: "border-default hidden md:flex" }}>
<Tooltip content={t("view_public_page")}>
<Button
@@ -212,6 +212,6 @@ export function TableActions({
</DropdownMenuPortal>
</Dropdown>
</div>
</>
</div>
);
}