Skip to content

perf(ui): optimize avatar rendering by replacing <img> with next/image in testimonials#347

Open
SadhanaShree25 wants to merge 12 commits intokeploy:mainfrom
SadhanaShree25:fix-avatar-next-image
Open

perf(ui): optimize avatar rendering by replacing <img> with next/image in testimonials#347
SadhanaShree25 wants to merge 12 commits intokeploy:mainfrom
SadhanaShree25:fix-avatar-next-image

Conversation

@SadhanaShree25
Copy link
Copy Markdown

@SadhanaShree25 SadhanaShree25 commented Mar 15, 2026

Description of the Change

This PR updates the ReviewCard component in components/testimonials.tsx to replace the standard <img> tag with the Next.js <Image /> component for optimized avatar rendering.

Why is this needed?

Performance & Core Web Vitals

The native <img> tag does not automatically optimize images or serve modern formats (like WebP). Using next/image improves performance, especially Largest Contentful Paint (LCP).

Layout Shift Prevention

Standard <img> tags can cause Cumulative Layout Shift (CLS) if dimensions are not strictly enforced. The <Image /> component ensures proper sizing and improves visual stability.

Consistency

Other components (e.g., components/tweets.tsx) already use next/image. This change aligns testimonials.tsx with the existing pattern and resolves the @next/next/no-img-element ESLint warning.


Additional Changes

  • Fixed YAML indentation and structure in .github/workflows/lighthouse_comment.yml to ensure the Lighthouse workflow triggers correctly on pull requests.
  • Added lint_utf8.txt file generated during linting.

Changes Proposed

  • Imported next/image into components/testimonials.tsx
  • Replaced <img /> with <Image /> in the ReviewCard component
  • Updated width and height props from string values ("32") to numeric values ({32})
  • Corrected GitHub Actions workflow configuration

Checklist

  • Code builds and runs locally
  • UI tested (avatars render correctly)
  • No layout shifts or console warnings
  • Workflow configuration validated

Signed-off-by: SadhanaShree25 <180205437+SadhanaShree25@users.noreply.github.com>
Signed-off-by: frontend <edstartupteam@gmail.com>
Signed-off-by: frontend <edstartupteam@gmail.com>
Signed-off-by: SadhanaShree25 <180205437+SadhanaShree25@users.noreply.github.com>
Signed-off-by: SadhanaShree25 <180205437+SadhanaShree25@users.noreply.github.com>
@dhananjay6561 dhananjay6561 requested a review from Copilot April 6, 2026 12:06
@dhananjay6561
Copy link
Copy Markdown
Member

Hey @SadhanaShree25 👋 — thanks for putting this PR together, we appreciate the effort!

We've gone ahead and requested a Copilot review on this. Here's some context from the reviewer:

Remove accidentally committed lint_output.txt. Restore avatar fallback handling (removed entirely). Conflicts with #335.

Once you've had a chance to go through the comments, please address the feedback and resolve the threads — and we'll get this across the line. Feel free to ask if anything's unclear. Happy coding! 💙

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the testimonials ReviewCard avatar rendering to use Next.js next/image, and adjusts surrounding markup to improve rendering behavior and styling consistency.

Changes:

  • Replaced <img> with <Image> for avatar rendering, using numeric width/height.
  • Added useRouter() + URL logic to proxy external avatar URLs through an internal API route.
  • Minor className/whitespace tweaks and added gradient overlay divs to the marquee container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/testimonials.tsx
Comment thread components/testimonials.tsx
Comment thread components/testimonials.tsx Outdated
Comment thread components/testimonials.tsx
Comment thread components/testimonials.tsx
SadhanaShree25 and others added 4 commits April 6, 2026 18:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sadhana Shree <180205437+SadhanaShree25@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

.github/workflows/lighthouse_comment.yml:24

  • This workflow is now triggered on pull_request, but it attempts to download the lighthouse-comment artifact without specifying a run-id. actions/download-artifact will only download artifacts from the current workflow run by default, so this job will not find the artifact produced by the separate Lighthouse – Run workflow. Consider reverting to a workflow_run trigger (and using the triggering run’s id), or restructure so the comment generation and posting happen in the same workflow/run.
on:
 pull_request:
  branches:
    - main

permissions:
  issues: write
  pull-requests: write

jobs:
  comment:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - name: Download Lighthouse comment artifact
        uses: actions/download-artifact@v4
        with:
          name: lighthouse-comment
          path: .

lint_utf8.txt:23

  • lint_utf8.txt looks like captured next lint output (including a UTF-8 BOM on line 1) and contains transient warnings. Committing this kind of build/lint output into the repo will create noise and go stale quickly; it’s better to keep lint output in CI logs/artifacts instead of version control.

> lint
> next lint


./components/more-stories.tsx
65:6  Warning: React Hook useEffect has a missing dependency: 'localSearchTerm'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
151:6  Warning: React Hook useEffect has missing dependencies: 'buffer.length', 'initialPageInfo?.hasNextPage', and 'loadMoreInBackground'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

./components/navbar/FloatingNavbarClient.tsx
202:6  Warning: React Hook useEffect has missing dependencies: 'communityState.length', 'router.basePath', and 'techState.length'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps
764:6  Warning: React Hook useEffect has a missing dependency: 'router?.basePath'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
784:6  Warning: React Hook useEffect has missing dependencies: 'communityLatest' and 'techLatest'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

./components/post-body.tsx
152:6  Warning: React Hook useEffect has a missing dependency: 'isUserEnteredURL'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
221:6  Warning: React Hook useEffect has a missing dependency: 'handleHeadingCopyClick'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

./components/testimonials.tsx
31:11  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/lighthouse_comment.yml Outdated
@dhananjay6561
Copy link
Copy Markdown
Member

Hi @SadhanaShree25
please resolve the copilot comments and please reply to them too.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

.github/workflows/lighthouse_comment.yml:23

  • This workflow is triggered on pull_request but it downloads an artifact named lighthouse-comment without any prior step/job in the same workflow run uploading that artifact. As written, actions/download-artifact@v4 will fail because the artifact won’t exist. Either switch back to workflow_run for the "Lighthouse – Run" workflow and download from that run-id, or generate/upload the lighthouse-comment.md artifact in this workflow before attempting to download it.
on:
  pull_request:
    branches:
      - main

permissions:
  issues: write

jobs:
  comment:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - name: Download Lighthouse comment artifact
        uses: actions/download-artifact@v4
        with:
          name: lighthouse-comment
          path: .


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lint_utf8.txt Outdated
Comment on lines +1 to +22

> lint
> next lint


./components/more-stories.tsx
65:6 Warning: React Hook useEffect has a missing dependency: 'localSearchTerm'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
151:6 Warning: React Hook useEffect has missing dependencies: 'buffer.length', 'initialPageInfo?.hasNextPage', and 'loadMoreInBackground'. Either include them or remove the dependency array. react-hooks/exhaustive-deps

./components/navbar/FloatingNavbarClient.tsx
202:6 Warning: React Hook useEffect has missing dependencies: 'communityState.length', 'router.basePath', and 'techState.length'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
764:6 Warning: React Hook useEffect has a missing dependency: 'router?.basePath'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
784:6 Warning: React Hook useEffect has missing dependencies: 'communityLatest' and 'techLatest'. Either include them or remove the dependency array. react-hooks/exhaustive-deps

./components/post-body.tsx
152:6 Warning: React Hook useEffect has a missing dependency: 'isUserEnteredURL'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
221:6 Warning: React Hook useEffect has a missing dependency: 'handleHeadingCopyClick'. Either include it or remove the dependency array. react-hooks/exhaustive-deps

./components/testimonials.tsx
31:11 Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
Comment thread .github/workflows/lighthouse_comment.yml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sadhana Shree <180205437+SadhanaShree25@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.

3 participants