diff --git a/apps/web/src/components/ChildCollection.tsx b/apps/web/src/components/ChildCollection.tsx index af3d764..bd4a5eb 100644 --- a/apps/web/src/components/ChildCollection.tsx +++ b/apps/web/src/components/ChildCollection.tsx @@ -118,6 +118,16 @@ export function ChildCollection({ } } + const colCount = config.fields.length + (canEdit ? 1 : 0); + + function editorRow() { + return ( + + {editor()} + + ); + } + function editor() { return (
@@ -196,39 +206,44 @@ export function ChildCollection({ - {rows.map((row) => ( - - {config.fields.map((f) => ( - {cellText(f, row[f.key])} - ))} - {canEdit && ( - -
- - -
- - )} - - ))} + {adding && editorRow()} + {rows.map((row) => + editingId === String(row.id) ? ( + + {editor()} + + ) : ( + + {config.fields.map((f) => ( + {cellText(f, row[f.key])} + ))} + {canEdit && ( + +
+ + +
+ + )} + + ), + )}
)} - - {(adding || editingId !== null) && editor()} ); }