fix: large org routing insights UI issues (#17687)

* fix overflow colour in darkmode

* truncate/show overflow scroll indicator when overflowing on response values

* remove total created count

* overflow Y on failed response container

* fix darkmode styles on barlist

* radix hovercards to properly allow overflow in container

* column visible state

* remove constrained width on dropdowns to w-fit

* export type
This commit is contained in:
sean-brydon authored and GitHub committed 2024-11-16 11:01:26 -03:00
1 parent 7fef3e7b85
commit b1a0cdc8e2
12 files changed
+296 -50

No files matched your search

@@ -41,6 +41,9 @@ function ColumnVisibilityButtonComponent<TData>(
const { t } = useLocale();
const allColumns = table.getAllLeafColumns();
const [open, setOpen] = useState(false);
const [visibleColumns, setVisibleColumns] = useState(
() => new Set(allColumns.filter((col) => col.getIsVisible()).map((col) => col.id))
);
return (
<Popover open={open} onOpenChange={setOpen}>
@@ -59,15 +62,28 @@ function ColumnVisibilityButtonComponent<TData>(
const canHide = column.getCanHide();
if (!column.columnDef.header || typeof column.columnDef.header !== "string" || !canHide)
return null;
const isVisible = column.getIsVisible();
const isVisible = visibleColumns.has(column.id);
return (
<CommandItem key={column.id} onSelect={() => column.toggleVisibility(!isVisible)}>
<CommandItem
key={column.id}
onSelect={() => {
column.toggleVisibility(!isVisible);
setVisibleColumns((prev) => {
const next = new Set(prev);
if (isVisible) {
next.delete(column.id);
} else {
next.add(column.id);
}
return next;
});
}}>
<div
className={classNames(
"border-subtle mr-2 flex h-4 w-4 items-center justify-center rounded-sm border",
isVisible ? "text-emphasis" : "opacity-50 [&_svg]:invisible"
)}>
<Icon name="check" className={classNames("h-4 w-4")} />
<Icon name="check" className={classNames("h-4 w-4", !isVisible && "invisible")} />
</div>
{column.columnDef.header}
</CommandItem>
@@ -78,7 +94,10 @@ function ColumnVisibilityButtonComponent<TData>(
<CommandSeparator />
<CommandGroup>
<CommandItem
onSelect={() => allColumns.forEach((column) => column.toggleVisibility(true))}
onSelect={() => {
allColumns.forEach((column) => column.toggleVisibility(true));
setVisibleColumns(new Set(allColumns.map((col) => col.id)));
}}
className={classNames(
"w-full justify-center text-center",
buttonClasses({ color: "secondary" })
+1 -1
View File
@@ -39,7 +39,7 @@ export const DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenuConten
{...props}
sideOffset={sideOffset}
className={classNames(
"shadow-dropdown w-50 bg-default border-subtle relative z-10 ml-1.5 origin-top-right rounded-md border text-sm",
"shadow-dropdown bg-default border-subtle relative z-10 ml-1.5 origin-top-right rounded-md border text-sm",
"[&>*:first-child]:mt-1 [&>*:last-child]:mb-1",
props.className
)}
@@ -0,0 +1,29 @@
"use client";
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
import * as React from "react";
import { classNames } from "@calcom/lib";
const HoverCard = HoverCardPrimitive.Root;
const HoverCardTrigger = HoverCardPrimitive.Trigger;
const HoverCardContent = React.forwardRef<
React.ElementRef<typeof HoverCardPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
<HoverCardPrimitive.Content
ref={ref}
align={align}
sideOffset={sideOffset}
className={classNames(
"bg-default text-default data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-subtle z-50 w-64 rounded-md border p-2 shadow-sm outline-none",
className
)}
{...props}
/>
));
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
export { HoverCard, HoverCardTrigger, HoverCardContent };
+2
View File
@@ -170,6 +170,8 @@ export {
CommandShortcut,
} from "./components/command";
export { HoverCard, HoverCardTrigger, HoverCardContent } from "./components/hover-card";
export { OrgBanner } from "./components/organization-banner";
export type { OrgBannerProps } from "./components/organization-banner";