import { Link } from '@tanstack/react-router'
import { useParams } from 'common'
import { ReactNode } from 'react'
import { BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, cn } from 'ui'
import { PageBreadcrumbs } from 'ui-patterns/PageBreadcrumbs'
import { PageContainer } from 'ui-patterns/PageContainer'
import {
PageHeader,
PageHeaderDescription,
PageHeaderIcon,
PageHeaderMeta,
PageHeaderSummary,
PageHeaderTitle,
} from 'ui-patterns/PageHeader'
import { PageNav } from 'ui-patterns/PageNav'
import {
PageSection,
PageSectionContent,
PageSectionDescription,
PageSectionMeta,
PageSectionSummary,
PageSectionTitle,
} from 'ui-patterns/PageSection'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import { PRODUCT_NAME } from '@/lib/constants/compute'
// Widths roughly follow the Overview, Invocations, Logs and Activity tab labels
const TAB_WIDTHS = ['w-16', 'w-20', 'w-8', 'w-14']
// Widths roughly follow the Instances, Live, Ready and Stale counts
const INSTANCE_COUNT_WIDTHS = ['w-20', 'w-10', 'w-12', 'w-12']
// Label and value widths for the Runtime, Version, Base image, Entrypoint and Listening port rows
const CONTAINER_ROW_WIDTHS: [string, string][] = [
['w-16', 'w-16'],
['w-14', 'w-12'],
['w-20', 'w-40'],
['w-20', 'w-32'],
['w-24', 'w-24'],
]
// Label and value widths for the Size, Instances, Access and Region rows
const RESOURCE_ROW_WIDTHS: [string, string][] = [
['w-10', 'w-24'],
['w-16', 'w-6'],
['w-14', 'w-14'],
['w-14', 'w-36'],
]
const TextLoader = ({ className, height = 'h-5' }: { className: string; height?: string }) => (