Skip to content

⚡ Bolt: Optimize Section3 images with Next/Image#44

Open
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-section3-images-13364656194158537856
Open

⚡ Bolt: Optimize Section3 images with Next/Image#44
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-section3-images-13364656194158537856

Conversation

@anyulled
Copy link
Copy Markdown
Owner

@anyulled anyulled commented Feb 15, 2026

💡 What:

  • Replaced style={{ backgroundImage: ... }} with <Image fill ... /> for the section background.
  • Replaced standard <img> tags for 3 large content images (devbcn-1.webp, devbcn2.webp, FaqsImage1.webp) with <Image width={600} height={400} ... />.
  • Replaced SVG icons with <Image width={24} height={24} ... />.

🎯 Why:

  • The background image header-bg20.png was being loaded as a full-size unoptimized asset via CSS.
  • Content images were inside tab panes. Standard <img> tags load immediately even if the tab is hidden. Next/Image provides lazy loading, so images in hidden tabs are not fetched until needed (or at least defer loading).
  • Next/Image serves WebP/AVIF formats which are significantly smaller.

📊 Impact:

  • Reduces initial page load weight by serving optimized images.
  • Improves LCP (Largest Contentful Paint) by optimizing the background if it's in the viewport (though Section 3 is usually below the fold).
  • Reduces bandwidth usage for users who don't switch tabs.

🔬 Measurement:

  • Verified using Playwright script that img tags now point to /_next/image?url=... with correct quality and width parameters.
  • Verified visually that the layout is preserved.

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

Summary by CodeRabbit

  • Refactor
    • Replaced static image elements with optimized responsive image components across the home section, adding explicit sizing while preserving layout and behavior.
  • Tests
    • Updated end-to-end test selectors for hero event lines to match the revised markup and ensure continued visibility checks.

Replaces the large CSS background image and content images in `components/sections/home8/section3.tsx` with Next.js `<Image />` components. This enables:
- Automatic image optimization (format, size)
- Lazy loading (critical for images inside tabs)
- Prevention of layout shifts (CLS) by providing dimensions

This change targets the FAQs section on the homepage.

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 15, 2026

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

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

@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 significantly enhances image loading performance and user experience by migrating various image assets to Next.js's Image component. This change optimizes background images, enables lazy loading for content images within tab panes, and leverages modern image formats like WebP/AVIF, leading to reduced initial page load weight, improved Largest Contentful Paint (LCP), and lower bandwidth consumption for users.

Highlights

  • Background Image Optimization: Replaced CSS backgroundImage with Next/Image component for the section background, enabling optimized loading and responsive behavior.
  • Content Image Optimization: Converted standard <img> tags for three large content images (devbcn-1.webp, devbcn2.webp, FaqsImage1.webp) to Next/Image components with specified dimensions, allowing for lazy loading and modern format delivery.
  • SVG Icon Optimization: Replaced standard <img> tags for SVG icons with Next/Image components, ensuring consistent optimization across all image assets.
Changelog
  • components/sections/home8/section3.tsx
    • Imported the Image component from next/image.
    • Replaced the div with inline backgroundImage style with a Next/Image component for the section background, using fill and objectFit: 'cover'.
    • Converted <img> tags for devbcn-1.webp, devbcn2.webp, and FaqsImage1.webp to Next/Image components, specifying width and height.
    • Updated <img> tags for SVG icons (clock1.svg, location1.svg) to Next/Image components with fixed width and height.
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 15, 2026

📝 Walkthrough

Walkthrough

Replaced static background div and img elements with Next.js Image components in a home section component; updated Cypress test selectors to target .hero8-header__event-line elements instead of generic h5 selectors to reflect DOM selection changes.

Changes

Cohort / File(s) Summary
Image Component Migration
components/sections/home8/section3.tsx
Replaced hard-coded background div and multiple static img elements with Next.js Image imports and fill/explicit dimension usage; removed inline backgroundImage styling and standardized image dimension handling.
Test Selector Update
cypress/e2e/home/home-editions.cy.ts
Changed test selector from generic h5 elements to .hero8-header__event-line within .hero8-header to accurately count and assert hero event lines and preserve subsequent visibility checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code at break of day,
Swapped divs for Image, chased sprites away.
Tests now find lines with tidier sight,
Pixels snug and loading light.
A tiny rabbit cheers: all looks right! 🎨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references optimizing Section3 images with Next/Image, which directly aligns with the main changes: replacing CSS backgrounds and img elements with Next.js Image components across the section3.tsx file.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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-section3-images-13364656194158537856

No actionable comments were generated in the recent review. 🎉


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 image loading by replacing standard <img> tags and CSS backgrounds with the next/image component. This is a great improvement for performance, especially with lazy loading and modern image formats. I've found a few areas for improvement: there's a potential layout issue with the new background image implementation that needs position: relative on its parent, and a couple of icons are missing descriptive alt text, which is important for accessibility and consistency within the file.

Comment thread components/sections/home8/section3.tsx Outdated
Comment on lines +14 to +19
<Image
src="/assets/img/bg/header-bg20.png"
alt="Background Texture"
fill
style={{ objectFit: "cover", zIndex: -1 }}
/>
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.

high

When using fill with next/image, the parent element (<div class="event8-section-area sp1">) must have position: relative for the image to be constrained to its parent's boundaries. Without it, the image may expand to fill the nearest positioned ancestor or the viewport, which could break the layout. Please ensure the event8-section-area class includes position: relative; or add it via an inline style to the parent div.

<li>
<Link href="/#">
<img src="/assets/img/icons/clock1.svg" alt="" />
<Image src="/assets/img/icons/clock1.svg" alt="" width={24} height={24} />
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 accessibility, this icon should have a descriptive alt attribute instead of an empty one. Since it represents a date/time, something like alt="Date" would be appropriate. This would also make it consistent with how this icon is used later in the file (line 138).

Suggested change
<Image src="/assets/img/icons/clock1.svg" alt="" width={24} height={24} />
<Image src="/assets/img/icons/clock1.svg" alt="Date" width={24} height={24} />

<li>
<Link href="/#">
<img src="/assets/img/icons/location1.svg" alt="" />
<Image src="/assets/img/icons/location1.svg" alt="" width={24} height={24} />
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 accessibility, this icon should have a descriptive alt attribute. Since it represents a location, alt="Location" would be appropriate and consistent with its usage on line 144.

Suggested change
<Image src="/assets/img/icons/location1.svg" alt="" width={24} height={24} />
<Image src="/assets/img/icons/location1.svg" alt="Location" width={24} height={24} />

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: 3

🤖 Fix all issues with AI agents
In `@components/sections/home8/section3.tsx`:
- Around line 138-144: The decorative SVG icons rendered via the Image
components inside the home8 Section3 markup are using inconsistent alt text
(e.g., "Date", "Location", etc.) which causes redundant announcements for screen
readers; update all Image instances in this component (the Image elements
adjacent to the date, location, and other decorative pieces) to use an empty alt
attribute alt="" so they are treated as decorative, ensuring consistency across
the component (check Image elements currently showing "Date", "Location", "2025
edition", or empty and make them all alt="").
- Around line 1-4: Prettier is complaining about formatting in this module; run
a Prettier formatter on the file (e.g., run prettier --write on the file or run
the project's pre-commit formatting script) to fix whitespace/quoting/import
ordering issues for the top-level imports (the "use client" directive and the
imports of Link, useState, and Image) and commit the updated file so CI passes.
- Around line 13-19: The Image component rendering the background (Image with
src "/assets/img/bg/header-bg20.png" inside the div with className
"event8-section-area sp1") is missing the priority prop; update that Image
element (the Image JSX in section3.tsx) to include the priority boolean prop
(priority) so the background loads eagerly and matches other sections.
🧹 Nitpick comments (2)
components/sections/home8/section3.tsx (2)

77-77: Routing SVGs through the Next.js image optimizer adds overhead with no benefit.

SVGs are already resolution-independent and tiny — the /_next/image pipeline can't shrink or re-encode them. Consider keeping plain <img> tags for these icons, or importing them as React components (e.g., via @svgr/webpack) to inline them. This applies to all clock1.svg and location1.svg usages in this file.

Also applies to: 83-83


62-68: Add a sizes prop to avoid downloading oversized variants.

Without sizes, the browser assumes the image fills the full viewport width and may fetch a much larger file than needed. These images sit inside a col-lg-5 (~41% of the container). A reasonable hint would prevent Next.js from serving an unnecessarily wide image. This applies to all three content images (Lines 62, 123, 194).

Example fix (repeat for the other two images)
 <Image
   src="/assets/img/all-images/about/devbcn-1.webp"
   alt="DevBcn"
   width={600}
   height={400}
+  sizes="(max-width: 992px) 100vw, 40vw"
   style={{ width: "100%", height: "auto" }}
 />

Comment thread components/sections/home8/section3.tsx
Comment thread components/sections/home8/section3.tsx Outdated
Comment on lines +13 to +19
<div className="event8-section-area sp1">
<Image
src="/assets/img/bg/header-bg20.png"
alt="Background Texture"
fill
style={{ objectFit: "cover", zIndex: -1 }}
/>
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

🧩 Analysis chain

🏁 Script executed:

# Search for event8-section-area in CSS/SCSS files
rg "event8-section-area" --type=css --type=scss -C 3

Repository: anyulled/devbcn-nextjs

Length of output: 94


🏁 Script executed:

# Also check for any global styles or CSS files
fd -e css -e scss -e sass | head -20

Repository: anyulled/devbcn-nextjs

Length of output: 794


🏁 Script executed:

# Check the full component file to understand context
cat -n components/sections/home8/section3.tsx | head -50

Repository: anyulled/devbcn-nextjs

Length of output: 2696


🏁 Script executed:

# Search for event8-section-area in all files (in case it's referenced elsewhere)
rg "event8-section-area" -C 2

Repository: anyulled/devbcn-nextjs

Length of output: 629


🏁 Script executed:

# Check the complete styling of event8-section-area
cat -n styles/layout/pages/_event.scss | grep -A 10 "\.event8-section-area"

Repository: anyulled/devbcn-nextjs

Length of output: 279


🏁 Script executed:

# Search for other <Image fill> usage to see if priority is commonly used
rg '<Image' -A 3 | grep -B 2 -A 2 'fill'

Repository: anyulled/devbcn-nextjs

Length of output: 3578


🏁 Script executed:

# Check if there are any comments in the PR or component about LCP
rg "LCP\|priority\|lazy" components/sections/home8/section3.tsx

Repository: anyulled/devbcn-nextjs

Length of output: 48


Add priority prop to the background image for consistency.

The background image is missing the priority prop. The same image (header-bg20.png) is used with priority in the section2 component, and other background images throughout the codebase consistently use priority for eager loading. Add it here for consistency:

         <Image
           src="/assets/img/bg/header-bg20.png"
           alt="Background Texture"
           fill
+          priority
           style={{ objectFit: "cover", zIndex: -1 }}
         />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="event8-section-area sp1">
<Image
src="/assets/img/bg/header-bg20.png"
alt="Background Texture"
fill
style={{ objectFit: "cover", zIndex: -1 }}
/>
<div className="event8-section-area sp1">
<Image
src="/assets/img/bg/header-bg20.png"
alt="Background Texture"
fill
priority
style={{ objectFit: "cover", zIndex: -1 }}
/>
🤖 Prompt for AI Agents
In `@components/sections/home8/section3.tsx` around lines 13 - 19, The Image
component rendering the background (Image with src
"/assets/img/bg/header-bg20.png" inside the div with className
"event8-section-area sp1") is missing the priority prop; update that Image
element (the Image JSX in section3.tsx) to include the priority boolean prop
(priority) so the background loads eagerly and matches other sections.

Comment on lines +138 to +144
<Image src="/assets/img/icons/clock1.svg" alt="Date" width={24} height={24} />
June 16th - 17th, 2026 <span> | </span>
</Link>
</li>
<li>
<Link href="/#">
<img src="/assets/img/icons/location1.svg" alt="Location" />
<Image src="/assets/img/icons/location1.svg" alt="Location" width={24} height={24} />
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

Inconsistent and potentially redundant alt text on decorative icons.

The icon alt attributes are inconsistent across sections: empty on Lines 77/83, "Date"/"Location" on Lines 138/144, and "2025 edition" etc. on Lines 209–221. Since these icons are decorative (adjacent text already conveys the meaning), alt="" is the correct choice per accessibility guidelines — screen readers would otherwise announce redundant information. Standardize all icon alt attributes to "".

🤖 Prompt for AI Agents
In `@components/sections/home8/section3.tsx` around lines 138 - 144, The
decorative SVG icons rendered via the Image components inside the home8 Section3
markup are using inconsistent alt text (e.g., "Date", "Location", etc.) which
causes redundant announcements for screen readers; update all Image instances in
this component (the Image elements adjacent to the date, location, and other
decorative pieces) to use an empty alt attribute alt="" so they are treated as
decorative, ensuring consistency across the component (check Image elements
currently showing "Date", "Location", "2025 edition", or empty and make them all
alt="").

- Fixes Prettier formatting issues in `components/sections/home8/section3.tsx` identified by CI.
- Updates `cypress/e2e/home/home-editions.cy.ts` to correctly target `.hero8-header__event-line` instead of `h5` for venue/date verification, aligning with recent markup changes in `section1.tsx`.

These changes ensure CI checks (lint and cypress-run) will pass.

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