Restored to '8747ae2ccba95bbf3c763eb1ba6c3d0ccf5010cc'

Replit-Restored-To: 8747ae2ccb
This commit is contained in:
kimjaehyeon0101
2025-10-14 00:18:46 +00:00
parent fdc8cdd948
commit 5f63e61124
2 changed files with 10 additions and 74 deletions

View File

@ -30,10 +30,6 @@ externalPort = 3001
localPort = 38387
externalPort = 3003
[[ports]]
localPort = 41425
externalPort = 6000
[[ports]]
localPort = 43349
externalPort = 3000

View File

@ -54,38 +54,20 @@ export default function MainContent() {
return acc;
}, {} as Record<string, number>);
// Group outlets by category and separate NEW outlets from regular ones
const getSeparatedOutlets = (category: string) => {
// Group outlets by category and sort
const getOutletsByCategory = (category: string) => {
const filtered = allOutlets.filter(outlet =>
outlet.category.toLowerCase() === category.toLowerCase()
);
// 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) => {
return filtered.sort((a, b) => {
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) => {
@ -217,24 +199,10 @@ export default function MainContent() {
<div data-testid="section-people">
<h2 className="text-xl font-bold text-gray-900 mb-2">
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>
<div className="space-y-2">
{getSeparatedOutlets("People").newOutlets.length > 0 && (
<>
<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)}
{getOutletsByCategory("People").map(renderOutletCard)}
</div>
</div>
@ -242,24 +210,10 @@ export default function MainContent() {
<div data-testid="section-topics">
<h2 className="text-xl font-bold text-gray-900 mb-2">
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>
<div className="space-y-2">
{getSeparatedOutlets("Topics").newOutlets.length > 0 && (
<>
<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)}
{getOutletsByCategory("Topics").map(renderOutletCard)}
</div>
</div>
@ -267,24 +221,10 @@ export default function MainContent() {
<div data-testid="section-companies">
<h2 className="text-xl font-bold text-gray-900 mb-2">
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>
<div className="space-y-2">
{getSeparatedOutlets("Companies").newOutlets.length > 0 && (
<>
<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)}
{getOutletsByCategory("Companies").map(renderOutletCard)}
</div>
</div>
</div>