Build the complete admin panel UI at apps/web/app/(admin)/: - Admin layout with sidebar navigation and ADMIN role guard - Dashboard page with stats cards and revenue chart - User management with search, filters, pagination, detail panel, ban/unban - Listings moderation queue with approve/reject/bulk actions - KYC review page with document viewer and approve/reject flow - New reusable UI components: Dialog, Table Co-Authored-By: Paperclip <noreply@paperclip.ing>
85 lines
2.2 KiB
TypeScript
85 lines
2.2 KiB
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
interface DialogProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
function Dialog({ open, onOpenChange, children }: DialogProps) {
|
|
React.useEffect(() => {
|
|
if (open) {
|
|
document.body.style.overflow = 'hidden';
|
|
} else {
|
|
document.body.style.overflow = '';
|
|
}
|
|
return () => {
|
|
document.body.style.overflow = '';
|
|
};
|
|
}, [open]);
|
|
|
|
if (!open) return null;
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-50">
|
|
<div
|
|
className="fixed inset-0 bg-black/80 animate-in fade-in-0"
|
|
onClick={() => onOpenChange(false)}
|
|
/>
|
|
<div className="fixed inset-0 flex items-center justify-center p-4">
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const DialogContent = React.forwardRef<
|
|
HTMLDivElement,
|
|
React.HTMLAttributes<HTMLDivElement>
|
|
>(({ className, children, ...props }, ref) => (
|
|
<div
|
|
ref={ref}
|
|
className={cn(
|
|
'relative z-50 w-full max-w-lg rounded-lg border bg-background p-6 shadow-lg animate-in fade-in-0 zoom-in-95',
|
|
className,
|
|
)}
|
|
onClick={(e) => e.stopPropagation()}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
));
|
|
DialogContent.displayName = 'DialogContent';
|
|
|
|
function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
return (
|
|
<div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
|
|
);
|
|
}
|
|
|
|
function DialogTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
|
|
return (
|
|
<h2 className={cn('text-lg font-semibold leading-none tracking-tight', className)} {...props} />
|
|
);
|
|
}
|
|
|
|
function DialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {
|
|
return (
|
|
<p className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
);
|
|
}
|
|
|
|
function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
return (
|
|
<div
|
|
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-4', className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter };
|