Skip to content

⚡ Bolt: Optimize images in Homepage FAQ section#50

Open
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-images-home8-faq-11555456571338461021
Open

⚡ Bolt: Optimize images in Homepage FAQ section#50
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-images-home8-faq-11555456571338461021

Conversation

@anyulled
Copy link
Copy Markdown
Owner

@anyulled anyulled commented Feb 19, 2026

💡 What: Optimized images in the FAQ section of the Homepage (Home8 layout).
🎯 Why: The homepage was loading large unoptimized images using <img> tags and background-image style.
📊 Impact: Images are now lazy-loaded and optimized by Next.js, reducing initial page load weight and improving LCP/FCP.
🔬 Measurement: Verified that image src attributes now point to /_next/image using a custom Playwright script.


PR created automatically by Jules for task 11555456571338461021 started by @anyulled

Summary by CodeRabbit

  • Refactor
    • Enhanced image handling for improved performance and full-bleed, responsive display across devices.
  • Tests
    • Simplified end-to-end test checks by removing a brittle count-based assertion while retaining visibility checks for key header elements.

Replaced unoptimized <img> tags and background image with next/image in Section3 (FAQs) of Home8 layout.
- Used <Image fill> for background image with lazy loading.
- Used responsive <Image> for FAQ images with proper sizes and aspect ratio.
- Verified images load via /_next/image using Playwright script.

Co-authored-by: anyulled <100741+anyulled@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
devbcn Ready Ready Preview, Comment Feb 19, 2026 9:56am

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @anyulled, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the performance of the homepage's FAQ section by optimizing image loading. By migrating from standard image handling to Next.js's built-in Image component, the changes ensure that images are efficiently loaded, lazy-loaded, and automatically optimized, contributing to a faster and more responsive user experience.

Highlights

  • Image Optimization: Replaced traditional <img> tags and CSS background-image properties with Next.js Image components for improved performance.
  • Performance Improvement: Images are now lazy-loaded and optimized by Next.js, leading to reduced initial page load weight and better LCP/FCP scores.
  • Homepage FAQ Section: Applied image optimizations specifically to the FAQ section within the Home8 layout of the homepage.
Changelog
  • components/sections/home8/section3.tsx
    • Converted a CSS background-image to a Next.js Image component with fill and quality props.
    • Replaced multiple <img> tags with Next.js Image components, adding width, height, style, and sizes attributes for better control and optimization.
Activity
  • PR created automatically by Jules for task 11555456571338461021, initiated by @anyulled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Replaces CSS background-image and plain <img> elements in a home section with Next.js Image components (adds Image import). Background now uses a relative wrapper with a fill Image; content images use explicit width/height, sizes, objectFit: cover, borderRadius, and quality props. A Cypress assertion on h5 count was removed.

Changes

Cohort / File(s) Summary
Section: Image replacement
components/sections/home8/section3.tsx
Replaces CSS background-image with a relative-position wrapper and a Next.js Image (fill, quality: 80). Converts all inline <img> tags to Next Image components with explicit width/height, sizes, objectFit: 'cover', and borderRadius. Adds import Image from 'next/image'.
E2E test change
cypress/e2e/home/home-editions.cy.ts
Removes a runtime assertion that checked for at least two h5 elements inside .hero8-header; other visibility checks remain.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through pixels, swapped tags for grace,

Next/Image now fills the background space.
Cover and sizes snug and neat,
Quality set, each corner sweet.
A tiny rabbit cheers—images fleet! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions optimizing images in the 'Homepage FAQ section,' but the changes are actually in the 'Home8 section3' component, which appears to be a different section based on the file path and test modifications. Update the PR title to accurately reflect the actual section being modified, such as 'Optimize images in Home8 section3' or verify that 'Homepage FAQ section' correctly describes the Home8 section3 component.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bolt-optimize-images-home8-faq-11555456571338461021

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively optimizes images in the homepage FAQ section by replacing standard <img> tags and CSS background images with the Next.js <Image> component. This is a great improvement for performance, enabling lazy loading and modern image formats. I've added a few suggestions to further enhance performance and accessibility: one regarding the quality prop on the background image, another to improve the alt text for the FAQ images, and a third to refine the sizes attribute for more accurate responsive image loading. Overall, great work on improving the site's performance!

}}
>
<div className="event8-section-area sp1" style={{ position: "relative" }}>
<Image src="/assets/img/bg/header-bg20.png" alt="" fill style={{ objectFit: "cover", zIndex: -1 }} quality={80} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The quality prop is set to 80, which is higher than the Next.js default of 75. This will result in a larger image file. Since the goal of this PR is optimization, was this increase in quality intentional? If the default quality is acceptable, you could remove this prop to further reduce the image size.

<img src="/assets/img/all-images/about/devbcn-1.webp" alt="DevBcn" />
<Image
src="/assets/img/all-images/about/devbcn-1.webp"
alt="DevBcn"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better accessibility, the alt text should be more descriptive. Instead of the generic "DevBcn", consider describing what is in the image, especially since it's associated with a specific FAQ question. For example, a more descriptive alt text could be "A speaker presenting on stage at the DevBcn conference". This helps users of screen readers understand the image's content. This feedback applies to all similar images in this component (devbcn2.webp, FaqsImage1.webp, FaqsImage0.webp).

width={500}
height={300}
style={{ width: "100%", height: "auto", objectFit: "cover", borderRadius: "4px" }}
sizes="(max-width: 992px) 100vw, 40vw"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The sizes attribute value appears to be significantly overestimated for larger screens. On viewports wider than 992px, the image is within a col-lg-5 nested inside a col-lg-6, making its width roughly 21% of the viewport width (5/12 * 50%). The current 40vw will cause the browser to download a much larger image than necessary, which undermines the performance optimization. A more accurate value would be closer to (max-width: 991px) 90vw, 21vw. Please update this for all similar Image components in this file.

Suggested change
sizes="(max-width: 992px) 100vw, 40vw"
sizes="(max-width: 991px) 90vw, 21vw"

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
components/sections/home8/section3.tsx (1)

52-52: objectFit: "cover" has no visual effect when paired with height: "auto"

object-fit only clips/scales content when both dimensions of the image box are explicitly constrained. With height: "auto", the element always expands to the image's intrinsic aspect ratio (driven by the 500 × 300 width/height props), so there is nothing to cover or clip — the property is dead CSS.

♻️ Proposed cleanup for all four images
-  style={{ width: "100%", height: "auto", objectFit: "cover", borderRadius: "4px" }}
+  style={{ width: "100%", height: "auto", borderRadius: "4px" }}

Also applies to: 87-87, 133-133, 168-168

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/sections/home8/section3.tsx` at line 52, The inline style object
on the JSX <img> elements (style={{ width: "100%", height: "auto", objectFit:
"cover" }}) is ineffective because objectFit requires an explicit height; either
remove objectFit or change the height from "auto" to an explicit/constrained
value (e.g., a fixed px, responsive max-height, or use a wrapper with a set
height and overflow hidden) so objectFit: "cover" can actually crop the
image—apply the same fix to each of the four image occurrences that use this
style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/sections/home8/section3.tsx`:
- Around line 47-54: The sizes prop on the Image elements in
components/sections/home8/section3.tsx overestimates rendered width (~40vw) and
causes oversized srcset selection; update each Image's sizes (the four JSX
<Image> instances used for the content images) to reflect the actual rendered
width at lg — e.g. use "(max-width: 992px) 100vw, 20vw" (or an equivalent value
near 20vw) instead of "40vw" for all four Image components so Next.js will pick
appropriately sized sources.
- Line 49: The four img elements currently use the non‑descriptive attribute
alt="DevBcn"; update each img in components/sections/home8/section3.tsx to have
unique, meaningful alt text that describes the visual content or the FAQ topic
it accompanies (replace alt="DevBcn" in each image element with a specific
description such as "illustration of pricing FAQ", "illustration of schedule
FAQ", etc.), ensuring none are left as the generic event name or empty unless
truly decorative.

---

Nitpick comments:
In `@components/sections/home8/section3.tsx`:
- Line 52: The inline style object on the JSX <img> elements (style={{ width:
"100%", height: "auto", objectFit: "cover" }}) is ineffective because objectFit
requires an explicit height; either remove objectFit or change the height from
"auto" to an explicit/constrained value (e.g., a fixed px, responsive
max-height, or use a wrapper with a set height and overflow hidden) so
objectFit: "cover" can actually crop the image—apply the same fix to each of the
four image occurrences that use this style.

Comment on lines +47 to +54
<Image
src="/assets/img/all-images/about/devbcn-1.webp"
alt="DevBcn"
width={500}
height={300}
style={{ width: "100%", height: "auto", objectFit: "cover", borderRadius: "4px" }}
sizes="(max-width: 992px) 100vw, 40vw"
/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

sizes overestimates display width by ~2×, negating the optimization

These images sit inside col-lg-5 (≈41.7%) nested inside col-lg-6 (50%), so their actual rendered width at the lg breakpoint is:

5/12 × 6/12 × 960 px (Bootstrap lg container) ≈ 200 px ≈ 20 vw

The declared 40vw is roughly double the true size, which causes Next.js's srcset selection to fetch an image ~2× larger than necessary on desktop — directly undermining the performance goal of this PR.

🛠️ Proposed fix for `sizes` on all four content images
-  sizes="(max-width: 992px) 100vw, 40vw"
+  sizes="(max-width: 992px) 100vw, 21vw"

Apply to all four <Image> instances (lines 53, 88, 134, 169).

Also applies to: 82-89, 128-135, 163-170

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/sections/home8/section3.tsx` around lines 47 - 54, The sizes prop
on the Image elements in components/sections/home8/section3.tsx overestimates
rendered width (~40vw) and causes oversized srcset selection; update each
Image's sizes (the four JSX <Image> instances used for the content images) to
reflect the actual rendered width at lg — e.g. use "(max-width: 992px) 100vw,
20vw" (or an equivalent value near 20vw) instead of "40vw" for all four Image
components so Next.js will pick appropriately sized sources.

<img src="/assets/img/all-images/about/devbcn-1.webp" alt="DevBcn" />
<Image
src="/assets/img/all-images/about/devbcn-1.webp"
alt="DevBcn"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Non-descriptive alt="DevBcn" on all four content images

All four FAQ images share the same generic alt text. These images are informative (each accompanies a distinct FAQ topic), so each should have alt text that describes its visual content rather than repeating the event name. Empty alt="" would only be appropriate if the images were purely decorative. As-is, screen readers read "DevBcn" four times in a row without context.

♿ Example fix for each image
-  alt="DevBcn"  // line 49 — FAQ about the conference
+  alt="Barcelona Developers Conference venue and attendees"

-  alt="DevBcn"  // line 84 — FAQ about why to participate
+  alt="Attendees at a DevBcn session"

-  alt="DevBcn"  // line 130 — FAQ about tech tracks
+  alt="DevBcn speakers on stage"

-  alt="DevBcn"  // line 165 — FAQ about community & networking
+  alt="Networking event at DevBcn"

Also applies to: 84-84, 130-130, 165-165

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/sections/home8/section3.tsx` at line 49, The four img elements
currently use the non‑descriptive attribute alt="DevBcn"; update each img in
components/sections/home8/section3.tsx to have unique, meaningful alt text that
describes the visual content or the FAQ topic it accompanies (replace
alt="DevBcn" in each image element with a specific description such as
"illustration of pricing FAQ", "illustration of schedule FAQ", etc.), ensuring
none are left as the generic event name or empty unless truly decorative.

The `home-editions.cy.ts` test was failing because it expected an `h5` tag for event details, which is no longer present in `section1.tsx`. The component uses `div` elements with class `hero8-header__event-line`.

This change removes the `cy.get("h5").should("have.length.at.least", 2)` assertion and relies on `cy.contains` to verify the presence of the venue and date text, which is more robust to markup changes.

Co-authored-by: anyulled <100741+anyulled@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant