'use client'; import { useTranslations } from 'next-intl'; import { ConnectedSelectionBadge } from '@/components/ui/treatment/ConnectedSelectionBadge'; import { formatToothList, prosthesisGroupLabelFromCatalog, prosthesisTypeLabelStyleFromCatalog, } from '@/components/treatment/prosthesisTypeDisplay'; import { ProsthesisStackedTypeLabel } from '@/components/ui/lab/ProsthesisStackedTypeLabel'; import type { ProsthesisCatalogEntry } from '@/types/treatment-catalog'; export type LabCaseProsthesisGroup = { prosthesisTypeCode: string; teeth: string[]; connected?: boolean; selectionGroupId?: string; }; interface LabCaseProsthesisGroupsListProps { groups: LabCaseProsthesisGroup[]; prosthesisCatalog: readonly ProsthesisCatalogEntry[]; fallbackTeeth?: string[]; } function prosthesisLabel(code: string, catalog: readonly ProsthesisCatalogEntry[]): string { return catalog.find((entry) => entry.code === code)?.label ?? prosthesisGroupLabelFromCatalog(code, catalog); } export function LabCaseProsthesisGroupsList({ groups, prosthesisCatalog, fallbackTeeth = [], }: LabCaseProsthesisGroupsListProps) { const tTreatment = useTranslations('treatment'); const archLabels = { UA: tTreatment('selectedArchUpper'), LA: tTreatment('selectedArchLower'), }; if (groups.length > 0) { return (
{formatToothList(fallbackTeeth, archLabels)}
; } return null; } export type LabCaseToothJobRow = { teeth: string[]; codes: string[]; connected?: boolean; }; interface LabCaseToothJobsListProps { rows: LabCaseToothJobRow[]; prosthesisCatalog: readonly ProsthesisCatalogEntry[]; } export function LabCaseToothJobsList({ rows, prosthesisCatalog, }: LabCaseToothJobsListProps) { const tTreatment = useTranslations('treatment'); const archLabels = { UA: tTreatment('selectedArchUpper'), LA: tTreatment('selectedArchLower'), }; if (rows.length === 0) return null; return (