import { useIsMFAEnabled } from 'common' import { ActionCard } from 'components/ui/ActionCard' import { useOrgProjectsInfiniteQuery } from 'data/projects/org-projects-infinite-query' import { Boxes, Lock } from 'lucide-react' import Link from 'next/link' import { Fragment } from 'react' import type { Organization } from 'types' import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui' export const OrganizationCard = ({ organization, href, isLink = true, className, onClick, }: { organization: Organization href?: string isLink?: boolean className?: string onClick?: () => void }) => { const isUserMFAEnabled = useIsMFAEnabled() const { data } = useOrgProjectsInfiniteQuery({ slug: organization.slug }) const numProjects = data?.pages[0].pagination.count ?? 0 const isMfaRequired = organization.organization_requires_mfa const renderContent = () => ( div]:w-full [&>div]:items-center max-h-min', className )} icon={} title={organization.name} onClick={onClick} description={
{organization.plan.name} Plan {numProjects > 0 && ( <> ยท {numProjects} project{numProjects > 1 ? 's' : ''} )}
{isMfaRequired && ( MFA enforced )}
} /> ) if (isLink) { return {renderContent()} } else { return {renderContent()} } }