Remove advertisements from the main content grid
Remove the logic that injected ads into the main article grid and update the rendering to no longer display ad components, ensuring only articles and widgets are present. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1f7e7e89-a520-4970-9645-37daadc466dc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: bcef02dc-c87d-439a-bac8-229492bf633b Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
07afec8e0e
commit
5cf60b7d20
BIN
attached_assets/image_1772713371094.png
Normal file
BIN
attached_assets/image_1772713371094.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 368 KiB |
@ -548,27 +548,6 @@ export default function Home() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalRows = items.length / 4;
|
|
||||||
const adRows = [1, 3, 5, 7, 9, 11, 13];
|
|
||||||
let adCount = 0;
|
|
||||||
for (const row of adRows) {
|
|
||||||
if (row >= totalRows) continue;
|
|
||||||
const rowStart = row * 4;
|
|
||||||
for (let col = 3; col >= 0; col--) {
|
|
||||||
if (items[rowStart + col] && items[rowStart + col].type === "article") {
|
|
||||||
items[rowStart + col] = { type: "ad", key: `ad-${adCount++}` };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (4 < totalRows) {
|
|
||||||
const rowStart = 4 * 4;
|
|
||||||
if (items[rowStart + 1] && items[rowStart + 1].type === "article") {
|
|
||||||
items[rowStart + 1] = { type: "ad", key: `ad-${adCount++}` };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}, [shuffled, widgets]);
|
}, [shuffled, widgets]);
|
||||||
|
|
||||||
@ -685,11 +664,9 @@ export default function Home() {
|
|||||||
{row.map((item) =>
|
{row.map((item) =>
|
||||||
item.type === "widget"
|
item.type === "widget"
|
||||||
? <div key={item.key}>{item.widget!.el}</div>
|
? <div key={item.key}>{item.widget!.el}</div>
|
||||||
: item.type === "ad"
|
: item.article
|
||||||
? <div key={item.key} className="h-full" data-testid={`ad-grid-${item.key}`}><ArticleCardAd /></div>
|
? <MediumCard key={item.key} article={item.article} focalPoints={focalPoints} />
|
||||||
: item.article
|
: null
|
||||||
? <MediumCard key={item.key} article={item.article} focalPoints={focalPoints} />
|
|
||||||
: null
|
|
||||||
)}
|
)}
|
||||||
{ri === gridRows.length - 1 && widePickedArticles.length > 0 && (
|
{ri === gridRows.length - 1 && widePickedArticles.length > 0 && (
|
||||||
<div className="sm:col-span-2 lg:col-span-4 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div className="sm:col-span-2 lg:col-span-4 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user