();
const notes: CollabNoteCard[] = [];
let more = 0;
for (const { card } of cards) {
if (card.kind !== 'collabNotes') continue;
more = Math.max(more, card.more);
for (const note of card.notes) {
if (note.noteId !== null && seen.has(note.noteId)) continue;
if (note.noteId !== null) seen.add(note.noteId);
notes.push(note);
}
}
if (notes.length === 0) return null;
const title = t('collab.tabs.notes');
return (
}
/>
{notes.map((note, index) => )}
);
}
/** A change row's note, after the change, marked by how it stands. */
export function CollabNotesBody({ card, item }: { card: NotesCard; item: ChangeItem }) {
return (
{card.notes.map((note, index) => )}
);
}
/**
* The faint line of a note change: its title and category before and after
* from the change's own rows, and whether it gets pinned or unpinned, read
* from the note the change leaves.
*/
export function CollabNoteFacts({ card, item }: { card: NotesCard; item: ChangeItem }) {
const { t } = useTranslation();
const rows = item.preview?.rows ?? [];
// The pin reads from the note as the change leaves it, not from the row's check glyph.
const pinned = card.notes[0]?.pinned === true;
return (
<>
{rows.map((row, index) => {
if (row.labelKey === 'name') {
const key = `${row.labelKey}-${index}`;
return ;
}
if (row.labelKey === 'category') {
return ;
}
if (row.labelKey === 'field' && row.field === 'pinned') {
return (
);
}
return null;
})}
>
);
}