* One question inside the senior's or the architect's level. * * The same component for both, because they are the same shape: a heading, the * sentence that frames the question, the rows that answer it, and the sentence * that stands in when there are none. The empty sentence is not optional an
(props: {
block: TwinReaderBlock;
say: SayFn;
openEvidence: string | undefined;
entriesFor: (factPath: string) => Evidence[];
onToggleEvidence: (factPath: string) => void;
onActivate: (row: TwinRow) => void;
onPoint?: ((row: TwinRow | undefined) => void) | undefined;
})
| 886 | * rather than as "nothing was recorded". |
| 887 | */ |
| 888 | function ReaderBlockView(props: { |
| 889 | block: TwinReaderBlock; |
| 890 | say: SayFn; |
| 891 | openEvidence: string | undefined; |
| 892 | entriesFor: (factPath: string) => Evidence[]; |
| 893 | onToggleEvidence: (factPath: string) => void; |
| 894 | onActivate: (row: TwinRow) => void; |
| 895 | onPoint?: ((row: TwinRow | undefined) => void) | undefined; |
| 896 | }): JSX.Element { |
| 897 | const { block } = props; |
| 898 | return ( |
| 899 | <section |
| 900 | className="atlas-twin-block" |
| 901 | data-testid={`codeatlas-twin-reader-${block.name}`} |
| 902 | data-block-name={block.name} |
| 903 | data-populated={block.rows.length > 0} |
| 904 | > |
| 905 | <header className="atlas-twin-section-head"> |
| 906 | <h3 className="atlas-twin-section-title">{block.title}</h3> |
| 907 | {block.weight !== undefined && ( |
| 908 | <span className="atlas-twin-section-count" data-testid="codeatlas-twin-reader-weight"> |
| 909 | {block.weight} |
| 910 | </span> |
| 911 | )} |
| 912 | </header> |
| 913 | {props.say(`block-${block.name}-lead`, block.lead, 'lead')} |
| 914 | {block.rows.length === 0 |
| 915 | ? props.say(`block-${block.name}-empty`, block.emptyText, 'note') |
| 916 | : ( |
| 917 | <ol className="atlas-twin-rows"> |
| 918 | {block.rows.flatMap((row, index) => { |
| 919 | const heading = groupHeadingFor(block.rows, index); |
| 920 | const line = ( |
| 921 | <RowView |
| 922 | key={row.id} |
| 923 | row={row} |
| 924 | sectionName={block.name} |
| 925 | openEvidence={props.openEvidence} |
| 926 | entriesFor={props.entriesFor} |
| 927 | onToggleEvidence={props.onToggleEvidence} |
| 928 | onActivate={props.onActivate} |
| 929 | onPoint={props.onPoint} |
| 930 | highlighted={false} |
| 931 | /> |
| 932 | ); |
| 933 | return heading === undefined ? [line] : [heading, line]; |
| 934 | })} |
| 935 | </ol> |
| 936 | )} |
| 937 | </section> |
| 938 | ); |
| 939 | } |
| 940 | |
| 941 | /** |
| 942 | * Where this index stops, drawn as part of the answer. |
nothing calls this directly
no test coverage detected