added payment setting page and quota
This commit is contained in:
@@ -53,7 +53,31 @@ export function InfiniteSelect({
|
||||
onSearchChange,
|
||||
}: InfiniteSelectProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
||||
const sentinelRef = useRef<HTMLDivElement>(null);
|
||||
const [portalContainer, setPortalContainer] = useState<HTMLElement | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (containerRef.current) {
|
||||
const dialog = containerRef.current.closest<HTMLElement>(
|
||||
'[role="dialog"], [role="alertdialog"], [data-slot="alert-dialog-content"], [data-slot="dialog-content"]',
|
||||
);
|
||||
if (dialog) {
|
||||
setPortalContainer(dialog);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const el = scrollContainerRef.current;
|
||||
if (!el || !open) return;
|
||||
const handleWheel = (e: WheelEvent) => {
|
||||
e.stopPropagation();
|
||||
};
|
||||
el.addEventListener("wheel", handleWheel, { passive: true });
|
||||
return () => el.removeEventListener("wheel", handleWheel);
|
||||
}, [open]);
|
||||
|
||||
const selected = options.find((o) => o.value === value);
|
||||
|
||||
@@ -93,7 +117,7 @@ export function InfiniteSelect({
|
||||
}, [open, hasNextPage, isLoadingMore, onLoadMore]);
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<div ref={containerRef} className="relative">
|
||||
{label && (
|
||||
<label className="block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 select-none">
|
||||
{label}
|
||||
@@ -143,7 +167,7 @@ export function InfiniteSelect({
|
||||
</button>
|
||||
</PopoverPrimitive.Trigger>
|
||||
|
||||
<PopoverPrimitive.Portal>
|
||||
<PopoverPrimitive.Portal container={portalContainer}>
|
||||
<PopoverPrimitive.Content
|
||||
align="start"
|
||||
side="bottom"
|
||||
@@ -152,6 +176,8 @@ export function InfiniteSelect({
|
||||
avoidCollisions
|
||||
style={{ width: "var(--radix-popover-trigger-width)" }}
|
||||
className="z-50 rounded-md border border-border bg-card shadow-lg overflow-hidden max-h-[var(--radix-popover-content-available-height)] flex flex-col"
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
onTouchMove={(e) => e.stopPropagation()}
|
||||
>
|
||||
{onSearchChange && (
|
||||
<div className="flex items-center gap-2 px-3 py-2 border-b border-border bg-muted/20 shrink-0">
|
||||
@@ -176,7 +202,12 @@ export function InfiniteSelect({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="max-h-60 overflow-y-auto scrollbar-thin py-1">
|
||||
<div
|
||||
ref={scrollContainerRef}
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
onTouchMove={(e) => e.stopPropagation()}
|
||||
className="max-h-60 overflow-y-auto overscroll-contain scrollbar-thin py-1"
|
||||
>
|
||||
{loading && options.length === 0 ? (
|
||||
<p className="px-3 py-4 text-sm text-muted-foreground text-center flex items-center justify-center gap-2">
|
||||
<Loader2 size={14} className="animate-spin" /> Loading...
|
||||
|
||||
@@ -9,7 +9,7 @@ const buttonVariants = cva(
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-[#18b69b] dark:bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
||||
default: "bg-[#18b69b] hover:bg-[#149e87] active:bg-[#118a76] dark:bg-primary dark:hover:bg-primary/80 text-primary-foreground",
|
||||
outline:
|
||||
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
||||
secondary:
|
||||
|
||||
Reference in New Issue
Block a user