Skip to content

fix: improve organization's sponsor logo rendering#26

Open
rahul-vyas-dev wants to merge 1 commit intoAOSSIE-Org:mainfrom
rahul-vyas-dev:main
Open

fix: improve organization's sponsor logo rendering#26
rahul-vyas-dev wants to merge 1 commit intoAOSSIE-Org:mainfrom
rahul-vyas-dev:main

Conversation

@rahul-vyas-dev
Copy link
Copy Markdown
Contributor

@rahul-vyas-dev rahul-vyas-dev commented Mar 27, 2026

Improved the sponsor section to not display when no sponsors are provided.

Screenshots/Recordings:

Before:
Screenshot 2026-03-28 004444

After:
Screenshot 2026-03-28 004500

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Bug Fixes
    • Sponsors section now only displays when sponsors are available, preventing empty containers from rendering.

@github-actions github-actions bot added no-issue-linked PR is not linked to any issue frontend Changes to frontend code javascript JavaScript/TypeScript code changes labels Mar 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

Walkthrough

Restructured JSX indentation and nesting within the SupportUsButton component to correctly position the logoContent assignment. Added an outer conditional wrapper that renders the sponsors section only when sponsors data exists and has length, removing redundant nested conditionals within the card markup.

Changes

Cohort / File(s) Summary
SupportUsButton Component
src/components/SupportUsButton.tsx
Restructured JSX indentation/parentheses for logoContent nesting; added outer conditional render for sponsors container (sponsors && sponsors.length > 0); removed redundant nested condition within sponsor card; minor whitespace cleanup and trailing newline addition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Typescript Lang

Poem

🐰 A rabbit hops through JSX so neat,
Restructuring sponsors—conditional and sweet!
Nesting corrected with pristine care,
Sponsors now render when data's there! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving sponsor logo rendering by conditionally rendering the sponsors section only when sponsors exist.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions bot added size/L Large PR (201-500 lines changed) repeat-contributor PR from an external contributor who already had PRs merged pending-coderabbit-review labels Mar 27, 2026
Copy link
Copy Markdown

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/SupportUsButton.tsx (1)

1-1: 🧹 Nitpick | 🔵 Trivial

Missing "use client" directive for NextJS client component.

Per coding guidelines, NextJS components should include the "use client" directive. This component renders interactive elements and should be explicitly marked as a client component.

Proposed fix
+"use client";
+
 import React from "react";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SupportUsButton.tsx` at line 1, This component
(SupportUsButton) is missing the Next.js client directive; add the line "use
client" at the very top of the file before any imports so the component is
treated as a client component (place the directive above the existing import
React from "react"; and ensure it remains a plain string literal on the first
non-comment line).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/SupportUsButton.tsx`:
- Around line 303-307: Replace the hardcoded heading text in the SupportUsButton
component (the h2 element rendering "Our Sponsors") with an i18n lookup; import
and use the appropriate translation function or hook (e.g., t or useTranslation)
and replace the literal string with t('support_us.ourSponsors') or the agreed
key, ensuring the new key is added to the resource files for all locales and
used in the h2 inside SupportUsButton.tsx so the className and markup remain
unchanged.
- Around line 317-322: The sponsor.anchor currently uses sponsor.link directly;
update SupportUsButton to validate sponsor.link with the same validateUrl(...)
used for organizationInformation.url and only set href (and target/rel/title)
when validateUrl(sponsor.link) returns true (otherwise omit the href or render a
non-clickable element/fallback). Locate the anchor that references sponsor.link
and wrap its href assignment in the validateUrl check (or conditionally render
the <a>), reusing the validateUrl function to prevent javascript: XSS vectors.
- Around line 316-319: The sponsors.map in the SupportUsButton component is
using the array index as the React key which can cause rendering bugs when the
list changes; update the key prop on the <a> element inside sponsors.map to use
a stable unique identifier from the sponsor object (e.g., sponsor.name or
sponsor.link) instead of index so React can correctly track items during
re-renders.
- Around line 273-275: Remove the redundant inner conditional around the
sponsors list in the SupportUsButton component: delete the inner "sponsors &&
sponsors.length > 0 &&" check and directly render the <div> that lists sponsors
(the block that references sponsors and their logos), since the outer wrapper
already guarantees sponsors is non-empty; update any corresponding parentheses
so the JSX remains valid and no extra nesting remains.

---

Outside diff comments:
In `@src/components/SupportUsButton.tsx`:
- Line 1: This component (SupportUsButton) is missing the Next.js client
directive; add the line "use client" at the very top of the file before any
imports so the component is treated as a client component (place the directive
above the existing import React from "react"; and ensure it remains a plain
string literal on the first non-comment line).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42461e85-652d-43b7-888b-dc92250c4635

📥 Commits

Reviewing files that changed from the base of the PR and between 59fd0c6 and 2d3054a.

📒 Files selected for processing (1)
  • src/components/SupportUsButton.tsx

Comment on lines +273 to +275
{sponsors && sponsors.length > 0 && (
// List of sponsors with their logos and links, styled according to the selected theme and custom class names
<div
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Redundant conditional check.

The inner sponsors && sponsors.length > 0 check at line 273 is redundant since the outer wrapper at line 264 already guarantees this condition is true. This adds unnecessary nesting and complexity.

Proposed fix to remove redundant conditional
         ${Theme === "corporate" && "bg-blue-600/50"}`}
         >
-          {sponsors && sponsors.length > 0 && (
-            // List of sponsors with their logos and links, styled according to the selected theme and custom class names
-            <div
-              className={`${classNames.sponsors} ${classAccordingToTheme(Theme)}
+          {/* List of sponsors with their logos and links, styled according to the selected theme and custom class names */}
+          <div
+            className={`${classNames.sponsors} ${classAccordingToTheme(Theme)}
             ...
-            </div>
-          )}
+          </div>
         </div>
       )}
📝 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
{sponsors && sponsors.length > 0 && (
// List of sponsors with their logos and links, styled according to the selected theme and custom class names
<div
{/* List of sponsors with their logos and links, styled according to the selected theme and custom class names */}
<div
className={`${classNames.sponsors} ${classAccordingToTheme(Theme)}
...
</div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SupportUsButton.tsx` around lines 273 - 275, Remove the
redundant inner conditional around the sponsors list in the SupportUsButton
component: delete the inner "sponsors && sponsors.length > 0 &&" check and
directly render the <div> that lists sponsors (the block that references
sponsors and their logos), since the outer wrapper already guarantees sponsors
is non-empty; update any corresponding parentheses so the JSX remains valid and
no extra nesting remains.

Comment on lines +303 to +307
<h2
className={`font-extrabold text-4xl md:text-5xl lg:text-6xl`}
>
Our Sponsors
</h2>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Hardcoded user-visible string.

The text "Our Sponsors" is hardcoded. Per coding guidelines, user-visible strings should be externalized to resource files (i18n) for internationalization support.

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

In `@src/components/SupportUsButton.tsx` around lines 303 - 307, Replace the
hardcoded heading text in the SupportUsButton component (the h2 element
rendering "Our Sponsors") with an i18n lookup; import and use the appropriate
translation function or hook (e.g., t or useTranslation) and replace the literal
string with t('support_us.ourSponsors') or the agreed key, ensuring the new key
is added to the resource files for all locales and used in the h2 inside
SupportUsButton.tsx so the className and markup remain unchanged.

Comment on lines +316 to +319
{sponsors.map((sponsor, index) => (
<a
href={sponsor.link}
key={index}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Avoid using array index as React key.

Using index as the key can cause rendering issues if the sponsors list is reordered or modified. Use a stable identifier like sponsor.name or sponsor.link instead.

Proposed fix
                 {sponsors.map((sponsor, index) => (
                   <a
                     href={sponsor.link}
-                    key={index}
+                    key={sponsor.link || sponsor.name}
                     target="_blank"
📝 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
{sponsors.map((sponsor, index) => (
<a
href={sponsor.link}
key={index}
{sponsors.map((sponsor, index) => (
<a
href={sponsor.link}
key={sponsor.link || sponsor.name}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SupportUsButton.tsx` around lines 316 - 319, The sponsors.map
in the SupportUsButton component is using the array index as the React key which
can cause rendering bugs when the list changes; update the key prop on the <a>
element inside sponsors.map to use a stable unique identifier from the sponsor
object (e.g., sponsor.name or sponsor.link) instead of index so React can
correctly track items during re-renders.

Comment on lines +317 to +322
<a
href={sponsor.link}
key={index}
target="_blank"
rel="noopener noreferrer"
title={`Visit ${sponsor.name}'s website`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing URL validation for sponsor links.

The sponsor.link is used directly without validation, while organizationInformation.url at line 83 is validated using validateUrl() to prevent XSS via javascript: protocol. Apply the same validation to sponsor links for consistent security.

Proposed fix
-                  <a
-                    href={sponsor.link}
+                  <a
+                    href={validateUrl(sponsor.link) || "#"}
                     key={index}
                     target="_blank"
                     rel="noopener noreferrer"
                     title={`Visit ${sponsor.name}'s website`}
                   >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SupportUsButton.tsx` around lines 317 - 322, The
sponsor.anchor currently uses sponsor.link directly; update SupportUsButton to
validate sponsor.link with the same validateUrl(...) used for
organizationInformation.url and only set href (and target/rel/title) when
validateUrl(sponsor.link) returns true (otherwise omit the href or render a
non-clickable element/fallback). Locate the anchor that references sponsor.link
and wrap its href assignment in the validateUrl check (or conditionally render
the <a>), reusing the validateUrl function to prevent javascript: XSS vectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes to frontend code javascript JavaScript/TypeScript code changes no-issue-linked PR is not linked to any issue pending-coderabbit-review repeat-contributor PR from an external contributor who already had PRs merged size/L Large PR (201-500 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant