Restored to '8747ae2ccba95bbf3c763eb1ba6c3d0ccf5010cc'
Replit-Restored-To: 8747ae2ccb
This commit is contained in:
4
.replit
4
.replit
@ -30,10 +30,6 @@ externalPort = 3001
|
|||||||
localPort = 38387
|
localPort = 38387
|
||||||
externalPort = 3003
|
externalPort = 3003
|
||||||
|
|
||||||
[[ports]]
|
|
||||||
localPort = 41425
|
|
||||||
externalPort = 6000
|
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 43349
|
localPort = 43349
|
||||||
externalPort = 3000
|
externalPort = 3000
|
||||||
|
|||||||
@ -54,38 +54,20 @@ export default function MainContent() {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {} as Record<string, number>);
|
}, {} as Record<string, number>);
|
||||||
|
|
||||||
// Group outlets by category and separate NEW outlets from regular ones
|
// Group outlets by category and sort
|
||||||
const getSeparatedOutlets = (category: string) => {
|
const getOutletsByCategory = (category: string) => {
|
||||||
const filtered = allOutlets.filter(outlet =>
|
const filtered = allOutlets.filter(outlet =>
|
||||||
outlet.category.toLowerCase() === category.toLowerCase()
|
outlet.category.toLowerCase() === category.toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Separate outlets with articles (NEW) from those without
|
return filtered.sort((a, b) => {
|
||||||
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") {
|
if (sortBy === "alphabetical") {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
} else {
|
} else {
|
||||||
// Sort by traffic score (descending - highest traffic first)
|
// Sort by traffic score (descending - highest traffic first)
|
||||||
return (b.trafficScore || 0) - (a.trafficScore || 0);
|
return (b.trafficScore || 0) - (a.trafficScore || 0);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
return {
|
|
||||||
newOutlets: newOutlets.sort(sortFn),
|
|
||||||
regularOutlets: regularOutlets.sort(sortFn),
|
|
||||||
total: filtered.length
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderOutletCard = (outlet: MediaOutlet) => {
|
const renderOutletCard = (outlet: MediaOutlet) => {
|
||||||
@ -217,24 +199,10 @@ export default function MainContent() {
|
|||||||
<div data-testid="section-people">
|
<div data-testid="section-people">
|
||||||
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
||||||
People
|
People
|
||||||
<span className="text-gray-400 text-base ml-2">({getSeparatedOutlets("People").total})</span>
|
<span className="text-gray-400 text-base ml-2">({getOutletsByCategory("People").length})</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{getSeparatedOutlets("People").newOutlets.length > 0 && (
|
{getOutletsByCategory("People").map(renderOutletCard)}
|
||||||
<>
|
|
||||||
<div className="flex items-center gap-2 mb-3">
|
|
||||||
<Sparkles className="h-4 w-4 text-blue-500" />
|
|
||||||
<h3 className="text-sm font-semibold text-blue-600">NEW</h3>
|
|
||||||
</div>
|
|
||||||
<div className="max-h-[200px] overflow-y-auto space-y-2 pr-1">
|
|
||||||
{getSeparatedOutlets("People").newOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
|
||||||
{getSeparatedOutlets("People").regularOutlets.length > 0 && (
|
|
||||||
<div className="border-t border-gray-200 my-4"></div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{getSeparatedOutlets("People").regularOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -242,24 +210,10 @@ export default function MainContent() {
|
|||||||
<div data-testid="section-topics">
|
<div data-testid="section-topics">
|
||||||
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
||||||
Topics
|
Topics
|
||||||
<span className="text-gray-400 text-base ml-2">({getSeparatedOutlets("Topics").total})</span>
|
<span className="text-gray-400 text-base ml-2">({getOutletsByCategory("Topics").length})</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{getSeparatedOutlets("Topics").newOutlets.length > 0 && (
|
{getOutletsByCategory("Topics").map(renderOutletCard)}
|
||||||
<>
|
|
||||||
<div className="flex items-center gap-2 mb-3">
|
|
||||||
<Sparkles className="h-4 w-4 text-blue-500" />
|
|
||||||
<h3 className="text-sm font-semibold text-blue-600">NEW</h3>
|
|
||||||
</div>
|
|
||||||
<div className="max-h-[200px] overflow-y-auto space-y-2 pr-1">
|
|
||||||
{getSeparatedOutlets("Topics").newOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
|
||||||
{getSeparatedOutlets("Topics").regularOutlets.length > 0 && (
|
|
||||||
<div className="border-t border-gray-200 my-4"></div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{getSeparatedOutlets("Topics").regularOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -267,24 +221,10 @@ export default function MainContent() {
|
|||||||
<div data-testid="section-companies">
|
<div data-testid="section-companies">
|
||||||
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
<h2 className="text-xl font-bold text-gray-900 mb-2">
|
||||||
Companies
|
Companies
|
||||||
<span className="text-gray-400 text-base ml-2">({getSeparatedOutlets("Companies").total})</span>
|
<span className="text-gray-400 text-base ml-2">({getOutletsByCategory("Companies").length})</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{getSeparatedOutlets("Companies").newOutlets.length > 0 && (
|
{getOutletsByCategory("Companies").map(renderOutletCard)}
|
||||||
<>
|
|
||||||
<div className="flex items-center gap-2 mb-3">
|
|
||||||
<Sparkles className="h-4 w-4 text-blue-500" />
|
|
||||||
<h3 className="text-sm font-semibold text-blue-600">NEW</h3>
|
|
||||||
</div>
|
|
||||||
<div className="max-h-[200px] overflow-y-auto space-y-2 pr-1">
|
|
||||||
{getSeparatedOutlets("Companies").newOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
|
||||||
{getSeparatedOutlets("Companies").regularOutlets.length > 0 && (
|
|
||||||
<div className="border-t border-gray-200 my-4"></div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{getSeparatedOutlets("Companies").regularOutlets.map(renderOutletCard)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user