From 218c8ff1c1cca62e4797311071b8d0edb7500bc4 Mon Sep 17 00:00:00 2001 From: mukimovd <41473651-mukimovd@users.noreply.replit.com> Date: Fri, 2 May 2025 00:25:00 +0000 Subject: [PATCH] Keep author sorting options visible while authors are loading on the page Wrap Tabs component in a div to maintain its width in Authors.tsx during loading. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cbacfb18-842a-4116-a907-18c0105ad8ec Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/94b44ce2-af2e-4b59-bb9d-f8907a9baca2.jpg --- client/src/pages/authors/Authors.tsx | 167 ++++++--------------------- 1 file changed, 36 insertions(+), 131 deletions(-) diff --git a/client/src/pages/authors/Authors.tsx b/client/src/pages/authors/Authors.tsx index 1ed86b2..e68f8ed 100644 --- a/client/src/pages/authors/Authors.tsx +++ b/client/src/pages/authors/Authors.tsx @@ -567,13 +567,15 @@ export default function Authors() { {/* View controls bar */}
- - - All Authors - Alphabetical - Chronological - - +
+ + + All Authors + Alphabetical + Chronological + + +
@@ -714,134 +716,37 @@ export default function Authors() { )} {/* Author grid or list */} - - {isLoading ? ( -
- {Array.from({ length: PAGE_SIZE }).map((_, i) => ( - - -
-
-
-
-
-
+ {/* Note: Using the first Tabs component that already exists in the view controls */} + {isLoading ? ( +
+ {Array.from({ length: PAGE_SIZE }).map((_, i) => ( + + +
+
+
+
+
-
- - - ))} -
- ) : ( - <> - {viewMode === 'grid' ? ( -
- {sortedAuthors.map(author => renderAuthorCard(author))} -
- ) : ( -
- {sortedAuthors.map(author => renderAuthorListItem(author))} -
- )} - - )} - - - - {isLoading ? ( -
- {Array.from({ length: 3 }).map((_, i) => ( -
-
-
- {Array.from({ length: 4 }).map((_, j) => ( -
- ))}
-
- ))} -
- ) : ( - <> - {/* Alphabet navigation */} -
-
- {[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map(letter => { - const hasAuthors = sortedGroupKeys.includes(letter); - return ( - - {letter} - - ); - })} -
+
+ + + ))} +
+ ) : ( + <> + {viewMode === 'grid' ? ( +
+ {sortedAuthors.map(author => renderAuthorCard(author))}
- -
- {sortedGroupKeys.map(letter => ( -
-

- {letter} -

-
- {groupedAuthors![letter].map(author => ( - viewMode === 'grid' ? renderAuthorCard(author) : renderAuthorListItem(author) - ))} -
-
- ))} + ) : ( +
+ {sortedAuthors.map(author => renderAuthorListItem(author))}
- - )} - - - - {isLoading ? ( -
- {Array.from({ length: 4 }).map((_, i) => ( -
-
-
- {Array.from({ length: 3 }).map((_, j) => ( -
- ))} -
-
- ))} -
- ) : ( -
- {/* Group authors by century */} - {Array.from(new Set(authors?.map(a => Math.floor((a.birthYear || 1800) / 100) * 100))).sort().map(century => { - const centuryLabel = `${century}s`; - const centuryAuthors = authors?.filter(a => - Math.floor((a.birthYear || 1800) / 100) * 100 === century - ); - - return ( -
-

- {centuryLabel} -

-
- {centuryAuthors?.map(author => ( - viewMode === 'grid' ? renderAuthorCard(author) : renderAuthorListItem(author) - ))} -
-
- ); - })} -
- )} -
+ )} + + )} {/* Pagination */} {totalPages > 1 && (