Prioritize newly marked media outlets at the top of the list
Update the sorting logic in MainContent.tsx to place media outlets with new articles at the beginning, followed by the rest sorted alphabetically. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9a264234-c5d7-4dcc-adf3-a954b149b30d Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/9a264234-c5d7-4dcc-adf3-a954b149b30d/X7hAtXn
This commit is contained in:
@ -61,6 +61,14 @@ export default function MainContent() {
|
||||
);
|
||||
|
||||
return filtered.sort((a, b) => {
|
||||
const aHasArticles = (articleCountByOutlet[a.id] || 0) > 0;
|
||||
const bHasArticles = (articleCountByOutlet[b.id] || 0) > 0;
|
||||
|
||||
// First, sort by NEW badge (outlets with articles come first)
|
||||
if (aHasArticles && !bHasArticles) return -1;
|
||||
if (!aHasArticles && bHasArticles) return 1;
|
||||
|
||||
// Within same group (both have or both don't have articles), sort by chosen method
|
||||
if (sortBy === "alphabetical") {
|
||||
return a.name.localeCompare(b.name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user