import type { WellLegendItem } from '../types' import { toQpcrWellPlateWells } from './adapters' import { colorForIndex } from './componentPlateHelpers' import { getTemplateData } from './templateEnvelopes' import { dataFrameProps } from './componentGenericProps' import { propsBinding } from './componentPropsFactory' import type { BioTemplateComponentPropsBinding } from './componentBindings' import type { QpcrPlateTemplate } from './types' export function qpcrPlateProps(template: QpcrPlateTemplate): BioTemplateComponentPropsBinding[] { const data = getTemplateData(template, 'qpcr-plate') const frame = dataFrameProps(template) return [ propsBinding('qpcr-plate', 'WellPlate', { format: data.format, wells: toQpcrWellPlateWells(template), sampleColors: Object.fromEntries(data.samples.map((sample, index) => [sample.sampleId, colorForIndex(index)])), legendItems: data.samples.map((sample, index): WellLegendItem => ({ type: sample.sampleId, label: sample.name ?? sample.sampleId, color: colorForIndex(index), })), showLegend: true, }), frame, ] }