diff --git a/.replit b/.replit index b94bf6b..027d7ac 100644 --- a/.replit +++ b/.replit @@ -38,6 +38,10 @@ externalPort = 3000 localPort = 43777 externalPort = 4200 +[[ports]] +localPort = 44067 +externalPort = 5000 + [env] PORT = "5000" diff --git a/client/src/components/MainContent.tsx b/client/src/components/MainContent.tsx index df444ec..4573700 100644 --- a/client/src/components/MainContent.tsx +++ b/client/src/components/MainContent.tsx @@ -54,20 +54,38 @@ export default function MainContent() { return acc; }, {} as Record); - // Group outlets by category and sort - const getOutletsByCategory = (category: string) => { + // Group outlets by category and separate NEW outlets from regular ones + const getSeparatedOutlets = (category: string) => { const filtered = allOutlets.filter(outlet => outlet.category.toLowerCase() === category.toLowerCase() ); - return filtered.sort((a, b) => { + // Separate outlets with articles (NEW) from those without + const newOutlets = filtered.filter(outlet => { + const articleCount = articleCountByOutlet[outlet.id] || 0; + return articleCount > 0; + }); + + const regularOutlets = filtered.filter(outlet => { + const articleCount = articleCountByOutlet[outlet.id] || 0; + return articleCount === 0; + }); + + // Sort both groups + const sortFn = (a: MediaOutlet, b: MediaOutlet) => { if (sortBy === "alphabetical") { return a.name.localeCompare(b.name); } else { // Sort by traffic score (descending - highest traffic first) return (b.trafficScore || 0) - (a.trafficScore || 0); } - }); + }; + + return { + newOutlets: newOutlets.sort(sortFn), + regularOutlets: regularOutlets.sort(sortFn), + total: filtered.length + }; }; const renderOutletCard = (outlet: MediaOutlet) => { @@ -199,10 +217,22 @@ export default function MainContent() {

People - ({getOutletsByCategory("People").length}) + ({getSeparatedOutlets("People").total})

- {getOutletsByCategory("People").map(renderOutletCard)} + {getSeparatedOutlets("People").newOutlets.length > 0 && ( + <> +
+ +

NEW

+
+ {getSeparatedOutlets("People").newOutlets.map(renderOutletCard)} + {getSeparatedOutlets("People").regularOutlets.length > 0 && ( +
+ )} + + )} + {getSeparatedOutlets("People").regularOutlets.map(renderOutletCard)}
@@ -210,10 +240,22 @@ export default function MainContent() {

Topics - ({getOutletsByCategory("Topics").length}) + ({getSeparatedOutlets("Topics").total})

- {getOutletsByCategory("Topics").map(renderOutletCard)} + {getSeparatedOutlets("Topics").newOutlets.length > 0 && ( + <> +
+ +

NEW

+
+ {getSeparatedOutlets("Topics").newOutlets.map(renderOutletCard)} + {getSeparatedOutlets("Topics").regularOutlets.length > 0 && ( +
+ )} + + )} + {getSeparatedOutlets("Topics").regularOutlets.map(renderOutletCard)}
@@ -221,10 +263,22 @@ export default function MainContent() {

Companies - ({getOutletsByCategory("Companies").length}) + ({getSeparatedOutlets("Companies").total})

- {getOutletsByCategory("Companies").map(renderOutletCard)} + {getSeparatedOutlets("Companies").newOutlets.length > 0 && ( + <> +
+ +

NEW

+
+ {getSeparatedOutlets("Companies").newOutlets.map(renderOutletCard)} + {getSeparatedOutlets("Companies").regularOutlets.length > 0 && ( +
+ )} + + )} + {getSeparatedOutlets("Companies").regularOutlets.map(renderOutletCard)}