import { Github, MoreVertical, Trash, Copy } from 'lucide-react' import InlineSVG from 'react-inlinesvg' import { useState } from 'react' import CardButton from 'components/ui/CardButton' import { ComputeBadgeWrapper } from 'components/ui/ComputeBadgeWrapper' import { DeleteProjectModal } from 'components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal' import type { IntegrationProjectConnection } from 'data/integrations/integrations.types' 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 { inferProjectStatus } from './ProjectCard.utils' import { ProjectCardStatus } from './ProjectCardStatus' import type { Organization } from 'types' import { toast } from 'sonner' import { copyToClipboard, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Button, } from 'ui' export interface ProjectCardProps { slug?: string project: OrgProject organization?: Organization rewriteHref?: string githubIntegration?: IntegrationProjectConnection vercelIntegration?: IntegrationProjectConnection resourceWarnings?: ResourceWarning } export const ProjectCard = ({ slug, project, organization, rewriteHref, githubIntegration, vercelIntegration, resourceWarnings, }: ProjectCardProps) => { const { name, ref: projectRef } = project const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false) 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 projectStatus = inferProjectStatus(project.status) return ( <>
  • {name}
    e.preventDefault()}>

    {desc}

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

    {githubRepository}

    )}
    } footer={ } containerElement={} />
  • setIsDeleteModalOpen(false)} project={project} organization={organization} /> ) }