From 8be611786165dd09c284df470f3ba3f27801d189 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Wed, 12 Apr 2023 18:21:13 -0400 Subject: [PATCH] feat: use field label in table headers if possible --- .../components/collections/entries/EntryListing.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/collections/entries/EntryListing.tsx b/packages/core/src/components/collections/entries/EntryListing.tsx index 8ba4d076..91e91306 100644 --- a/packages/core/src/components/collections/entries/EntryListing.tsx +++ b/packages/core/src/components/collections/entries/EntryListing.tsx @@ -120,11 +120,21 @@ const EntryListing = ({ }); }, [entries, inferFields, isSingleCollectionInList, otherProps, summaryFields, viewStyle]); + const summaryFieldHeaders = useMemo(() => { + if ('collection' in otherProps) { + return selectFields(otherProps.collection).map(f => f.label ?? f.name); + } + + return []; + }, [otherProps]); + if (viewStyle === 'VIEW_STYLE_LIST') { return ( <> {renderedCards}