Ensure content displays correctly when viewing articles

Adjust the logic for displaying articles in the carousel to ensure that companion articles are always shown, even when a gallery view is active, eliminating empty space.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 517dfa7b-26ac-463d-a6e1-a58c6df97188
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 57b5fa01-af26-4fc7-ba89-0af18fec8284
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic 2026-02-28 20:49:50 +00:00
parent dab4fd8156
commit 22efad432f
2 changed files with 6 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

View File

@ -227,9 +227,13 @@ function FeaturedCarousel({ articles, popular, galleryImages }: { articles: Arti
if (!isGalleryPage && articles.length > 0) {
hero = articles[page % articles.length];
}
if (articles.length > 0) {
const offset = isGalleryPage ? 0 : 1;
side = [
articles[(page + 1) % articles.length],
articles[(page + 2) % articles.length],
articles[(page + offset) % articles.length],
articles[(page + offset + 1) % articles.length],
];
}