import { Copy, Github, MoreVertical, Settings } from 'lucide-react' import { useRouter } from 'next/router' import InlineSVG from 'react-inlinesvg' import { toast } from 'sonner' import { Button, copyToClipboard, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from 'ui' import { inferProjectStatus } from './ProjectCard.utils' import { ProjectCardStatus } from './ProjectCardStatus' import CardButton from '@/components/ui/CardButton' import { ComputeBadgeWrapper } from '@/components/ui/ComputeBadgeWrapper' import PartnerIcon from '@/components/ui/PartnerIcon' import type { IntegrationProjectConnection } from '@/data/integrations/integrations.types' import { getManagedByFromOrganizationPartner } from '@/data/organizations/managed-by-utils' import { ProjectIndexPageLink } from '@/data/prefetchers/project.$ref' import { getComputeSize, OrgProject } from '@/data/projects/org-projects-infinite-query' import type { ResourceWarning } from '@/data/usage/resource-warnings-query' import { useCustomContent } from '@/hooks/custom-content/useCustomContent' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { BASE_PATH } from '@/lib/constants' import type { Organization } from '@/types' export interface ProjectCardProps { slug?: string project: OrgProject organization?: Organization rewriteHref?: string githubIntegration?: IntegrationProjectConnection vercelIntegration?: IntegrationProjectConnection resourceWarnings?: ResourceWarning } export const ProjectCard = ({ slug, project, rewriteHref, githubIntegration, vercelIntegration, resourceWarnings, }: ProjectCardProps) => { const router = useRouter() const { name, ref: projectRef } = project const { infraAwsNimbusLabel } = useCustomContent(['infra:aws_nimbus_label']) const providerLabel = project.cloud_provider === 'AWS_NIMBUS' ? infraAwsNimbusLabel : project.cloud_provider const desc = `${providerLabel} | ${project.region}` const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([ 'project_homepage:show_instance_size', ]) const isGithubIntegrated = githubIntegration !== undefined const isVercelIntegrated = vercelIntegration !== undefined const githubRepository = githubIntegration?.metadata.name ?? undefined const projectManagedBy = getManagedByFromOrganizationPartner( undefined, project.integration_source ) const projectStatus = inferProjectStatus(project.status) return ( <>
  • {name}
    e.preventDefault()}>

    {desc}

    {project.status !== 'INACTIVE' && projectHomepageShowInstanceSize && ( )} {isVercelIntegrated && (
    )} {isGithubIntegrated && (

    {githubRepository}

    )}
    } footer={ } containerElement={} />
  • ) }