Skip to content

Commit 994c475

Browse files
committed
show first 10 authors + et al. if author list exceeds 10
1 parent 9472281 commit 994c475

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/PublicationsTabs.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids, fe
2525
const [currentPage, setCurrentPage] = useState(1);
2626
const publicationsPerPage = 15;
2727

28+
// Format author list: if more than 10 authors, show first 10 + "et al."
29+
const formatAuthors = (authors: string): string => {
30+
if (!authors) return '';
31+
const authorList = authors.split(',').map(a => a.trim());
32+
return authorList.length > 10 ? `${authorList.slice(0, 10).join(', ')} et al.` : authors;
33+
};
34+
2835
// Filter featured publications
2936
const featuredPublications = publications.filter(pub =>
3037
(pub.pmid && featuredPmids.includes(pub.pmid)) ||
@@ -112,7 +119,7 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids, fe
112119
</div>
113120
</div>
114121
<div className="text-sm text-muted-foreground mt-1">
115-
{publication.authors}
122+
{formatAuthors(publication.authors)}
116123
</div>
117124
</CardHeader>
118125
<CardFooter className="pt-0">
@@ -344,7 +351,7 @@ export default function PublicationsTabsLoaded({ publications, featuredPmids, fe
344351
</div>
345352
</div>
346353
<div className="text-sm text-muted-foreground mt-1">
347-
{publication.authors}
354+
{formatAuthors(publication.authors)}
348355
</div>
349356
</CardHeader>
350357
<CardFooter className="pt-0">

0 commit comments

Comments
 (0)