import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
} from "@/shared/common/ui/dialog";
import { ViewUsers } from "../ViewUsers";

interface ViewUsersDialogProps {
  isOpen: boolean;
  onClose: () => void;
  unitId: string;
  unitName?: string;
}

export function ViewUsersDialog({
  isOpen,
  onClose,
  unitId,
  unitName,
}: ViewUsersDialogProps) {
  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[800px] max-h-[80vh] overflow-y-auto">
        <DialogHeader>
          <DialogTitle>
            {unitName ? `Users in ${unitName}` : "Team Members"}
          </DialogTitle>
        </DialogHeader>
        <ViewUsers unitId={unitId} onClose={onClose} />
      </DialogContent>
    </Dialog>
  );
}
