Skip to content

Add support for organization URL#23

Open
swathi2006 wants to merge 3 commits intoAOSSIE-Org:mainfrom
swathi2006:url-btn
Open

Add support for organization URL#23
swathi2006 wants to merge 3 commits intoAOSSIE-Org:mainfrom
swathi2006:url-btn

Conversation

@swathi2006
Copy link

@swathi2006 swathi2006 commented Mar 21, 2026

Addressed Issues:

Fixes #21

Screenshots/Recordings:

Screen.Recording.2026-03-21.112316.mp4

Additional Notes:

Summary

This PR adds an optional url field to the organizationInformation object, allowing users to provide a link to the organization’s website.

Changes

  • Added url property to organizationInformation
  • Rendered a "Visit Organization" button when URL is provided

Benefits

  • Makes the organization section interactive
  • Allows users to navigate to the official organization page

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

  • New Features

    • Organization logo becomes a clickable external link when a valid HTTP(S) URL is provided.
  • Bug Fixes / UX

    • Sponsor, CTA, and organization links are validated and normalized before opening (requires http/https), preventing invalid-link navigation; logos render without links when no valid URL exists.
  • Documentation

    • Props docs updated to include the optional organization URL field.

@github-actions github-actions bot added enhancement New feature or request frontend Changes to frontend code javascript JavaScript/TypeScript code changes size/S Small PR (11-50 lines changed) first-time-contributor First PR of an external contributor pending-coderabbit-review labels Mar 21, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Added an optional url to the organizationInformation type and a validateUrl helper; SupportUsButton now lowercases and validates organization, sponsor, and CTA URLs, conditionally wraps the organization logo in an external link only when the URL is a valid http(s) value, and updated README examples/docs accordingly.

Changes

Cohort / File(s) Summary
Types
src/types/index.ts
Added optional url?: string to the exported organizationInformation type.
SupportUsButton component
src/components/SupportUsButton.tsx
Added `validateUrl(url?: string): string
Documentation
README.md
Documented new optional organizationInformation.url in props example and Props API table; noted that a valid URL makes the organization logo clickable.

Sequence Diagram(s)

sequenceDiagram
  participant User as "User (click)"
  participant UI as "SupportUsButton\n(component)"
  participant V as "validateUrl\n(helper)"
  participant Browser as "Browser\n(navigation)"
  participant External as "Organization Site\n(external)"

  User->>UI: click logo / CTA
  UI->>V: validateUrl(organization.url)
  alt valid http(s) URL
    V-->>UI: validated URL
    UI->>Browser: open validated URL (target=_blank)
    Browser->>External: GET / (navigate)
  else invalid or absent URL
    V-->>UI: undefined
    UI-->>User: no navigation (logo not linked)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Typescript Lang, Documentation

Suggested reviewers

  • rahul-vyas-dev

Poem

🐰 I found a link, all small and neat,
I sniffed and lowered every single feat,
If it starts with http or https true,
I let it hop, I let it through,
The rabbit cheers — safe clicks for you! 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for organization URL' is concise, clear, and directly describes the main feature addition in the changeset.
Linked Issues check ✅ Passed The PR implements all primary coding requirements: adds optional url field to organizationInformation, validates URLs for HTTP(S), and makes the logo clickable when a valid URL is provided.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the organization URL feature as specified in issue #21; no unrelated modifications detected.

✏️ 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.

Copy link

@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

🤖 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`:
- Line 210: The button text "Visit Organisation" in the SupportUsButton
component must be externalized and corrected to "Visit Organization": replace
the hardcoded string in the SupportUsButton component (search for the literal
"Visit Organisation") with a call to the i18n lookup (e.g.,
t('support.visitOrganization') or equivalent in your i18n helper), add the new
key "support.visitOrganization" with value "Visit Organization" to the i18n
resource files for all locales, and update any tests or snapshots referencing
the old text to use the i18n key/translated value.
- Around line 196-201: The anchor in SupportUsButton uses user-controlled
organizationInformation.url directly for href; validate its protocol before
rendering to prevent javascript: XSS. Update the JSX that renders the <a> (in
SupportUsButton) to only render or assign href when organizationInformation.url
has an allowed protocol (e.g., parse with the URL constructor or check
startsWith('http://')/startsWith('https://')) and otherwise omit the href or
render a safe fallback; ensure the check references organizationInformation.url
so malicious protocols are rejected.
🪄 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: f52f108c-3d1d-47f6-8d99-1d847377c4e3

📥 Commits

Reviewing files that changed from the base of the PR and between 62828cd and 91c1deb.

📒 Files selected for processing (2)
  • src/components/SupportUsButton.tsx
  • src/types/index.ts

Copy link

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

Caution

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

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

463-477: ⚠️ Potential issue | 🟡 Minor

Same anchor-without-href concern applies to CTA links.

If validateUrl(link.url) returns undefined, the CTA button renders as a non-functional anchor. Since CTA buttons are prominent UI elements, consider applying the same conditional rendering pattern suggested for sponsor links.

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

In `@src/components/SupportUsButton.tsx` around lines 463 - 477, The CTA mapping
renders anchors even when validateUrl(link.url) may return undefined; update the
map over ctaSection.sponsorLink to only render the <a> (CTA button) when
validateUrl(link.url) returns a truthy URL: call validateUrl(link.url) once
(store in a local variable inside the map), and conditionally return the anchor
block only if that variable is truthy; keep existing props/behavior (target from
link.newTab, rel, title, inner div using getButtonClasses(buttonVariant),
link.icon and link.name) unchanged when rendering.

319-327: ⚠️ Potential issue | 🟡 Minor

Anchor renders without href when URL validation fails.

When validateUrl(sponsor.link) returns undefined, the <a> tag renders without an href attribute. The sponsor card will appear interactive (cursor, hover states) but won't navigate anywhere. Consider either:

  1. Conditionally rendering the <a> wrapper only when the URL is valid, or
  2. Falling back to a non-interactive <div> for sponsors without valid links.
🛡️ Option 1: Conditionally wrap with anchor
 {sponsors.map((sponsor, index) => {
+  const validSponsorUrl = validateUrl(sponsor.link);
+  const CardContent = (
+    <div className={`...`}>
+      {/* existing card content */}
+    </div>
+  );
+
+  return validSponsorUrl ? (
     <a
-      href={validateUrl(sponsor.link)}
+      href={validSponsorUrl}
       key={index}
       target="_blank"
       rel="noopener noreferrer"
       title={`Visit ${sponsor.name}'s website`}
     >
-      <div ...>
+      {CardContent}
     </a>
+  ) : (
+    <div key={index}>{CardContent}</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 319 - 327, The anchor
currently receives an undefined href when validateUrl(sponsor.link) returns
undefined; update the sponsors.map rendering inside SupportUsButton so you first
store the validated URL (const url = validateUrl(sponsor.link)) and then
conditionally render: if url is truthy render the existing <a> with href={url},
target/_rel/title as before; otherwise render a non-interactive wrapper (e.g., a
<div> with the same classes and title but without href/target/rel and without
pointer cursor) to preserve layout and accessibility; ensure you keep the same
key and inner sponsor content for both branches.
🤖 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 206-208: The code calls validateUrl(organizationInformation.url)
twice which is redundant; compute it once and reuse it. In the SupportUsButton
component, store the result of validateUrl(organizationInformation.url) in a
local variable (e.g., const validUrl = validateUrl(organizationInformation.url))
and use that variable for both the conditional rendering and the anchor href
instead of calling validateUrl twice.

---

Outside diff comments:
In `@src/components/SupportUsButton.tsx`:
- Around line 463-477: The CTA mapping renders anchors even when
validateUrl(link.url) may return undefined; update the map over
ctaSection.sponsorLink to only render the <a> (CTA button) when
validateUrl(link.url) returns a truthy URL: call validateUrl(link.url) once
(store in a local variable inside the map), and conditionally return the anchor
block only if that variable is truthy; keep existing props/behavior (target from
link.newTab, rel, title, inner div using getButtonClasses(buttonVariant),
link.icon and link.name) unchanged when rendering.
- Around line 319-327: The anchor currently receives an undefined href when
validateUrl(sponsor.link) returns undefined; update the sponsors.map rendering
inside SupportUsButton so you first store the validated URL (const url =
validateUrl(sponsor.link)) and then conditionally render: if url is truthy
render the existing <a> with href={url}, target/_rel/title as before; otherwise
render a non-interactive wrapper (e.g., a <div> with the same classes and title
but without href/target/rel and without pointer cursor) to preserve layout and
accessibility; ensure you keep the same key and inner sponsor content for both
branches.
🪄 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: 778f7a7b-9209-476f-a206-d0cdf4ce0897

📥 Commits

Reviewing files that changed from the base of the PR and between 91c1deb and 9493fa4.

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

Copy link

@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.

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)

323-329: ⚠️ Potential issue | 🟠 Major

Don’t render sponsor and CTA actions as dead anchors.

validateUrl() can return undefined, but both branches still emit <a>. That silently turns an invalid URL into a non-functional control instead of a safe fallback. This is especially risky for ctaSection.sponsorLink, because src/types/index.ts:98-106 still declares url as required. Branch on the validated href and render a non-link/disabled state (or skip the item) when validation fails.

Also applies to: 466-470

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

In `@src/components/SupportUsButton.tsx` around lines 323 - 329, The anchor
elements in SupportUsButton are using validateUrl(sponsor.link) (and similarly
for ctaSection.sponsorLink) but still render an <a> even when validateUrl
returns undefined; change the logic inside the SupportUsButton component to
first store the result of validateUrl(...) (e.g., const href =
validateUrl(sponsor.link)) and conditionally render: if href is truthy render
the <a> with target/rel/title, otherwise render a safe fallback (skip the item
or render a non-clickable element/button with disabled styling and accessible
text) so you never produce a dead anchor for invalid URLs; apply the same
pattern for ctaSection.sponsorLink and anywhere validateUrl is used to generate
anchor hrefs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/SupportUsButton.tsx`:
- Around line 323-329: The anchor elements in SupportUsButton are using
validateUrl(sponsor.link) (and similarly for ctaSection.sponsorLink) but still
render an <a> even when validateUrl returns undefined; change the logic inside
the SupportUsButton component to first store the result of validateUrl(...)
(e.g., const href = validateUrl(sponsor.link)) and conditionally render: if href
is truthy render the <a> with target/rel/title, otherwise render a safe fallback
(skip the item or render a non-clickable element/button with disabled styling
and accessible text) so you never produce a dead anchor for invalid URLs; apply
the same pattern for ctaSection.sponsorLink and anywhere validateUrl is used to
generate anchor hrefs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 16aa12c6-9928-4945-80b5-6f8d17f58593

📥 Commits

Reviewing files that changed from the base of the PR and between 9493fa4 and 57f8924.

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

@swathi2006
Copy link
Author

hi @Zahnentferner , @rahul-vyas-dev
could you please review this pr when convenient?

@rahul-vyas-dev
Copy link
Contributor

@swathi2006 please make corresponding changes to the README file

@rahul-vyas-dev
Copy link
Contributor

Don't create a completely new button for Visit Organization bcz the user will be redirected to the Support US page from the organization home page itself, so again creating a new compo to redirect on Home page is not necessary.

Instead, you can add this org link to the org logo. If provided, then ok otherwise display the Logo only.

@swathi2006
Copy link
Author

Don't create a completely new button for Visit Organization bcz the user will be redirected to the Support US page from the organization home page itself, so again creating a new compo to redirect on Home page is not necessary.

Instead, you can add this org link to the org logo. If provided, then ok otherwise display the Logo only.

Thanks for the suggestion! I’ll remove the button and make the organization logo clickable instead, and update the README accordingly.

@github-actions github-actions bot added size/M Medium PR (51-200 lines changed) and removed size/S Small PR (11-50 lines changed) labels Mar 21, 2026
Copy link

@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

🤖 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 184-196: The rendering logic in SupportUsButton uses
organizationInformation.logo but doesn't handle a missing logo, causing a broken
<img>; update the SupportUsButton component to first check whether
organizationInformation.logo is truthy before rendering either the string logo
branch or the <img> branch (e.g., guard on organizationInformation.logo), and if
it's falsy render nothing or a provided fallback element; apply the same
guard/fallback to the other identical block referenced (lines around the second
logo usage) so no <img src={organizationInformation.logo?.src}> is emitted when
logo is undefined.
- Line 182: The title prop in SupportUsButton is hardcoded as `title={`Visit
${organizationInformation?.name}`}`; move this user-visible string into i18n
resources by replacing the JSX literal with a translated string (e.g., use the
app's translation function like t('support.visit', { name:
organizationInformation?.name }) or equivalent) and add a new key (e.g.,
"support.visit": "Visit {{name}}") to the locale resource files so the tooltip
is localized and interpolates organizationInformation?.name.
- Around line 51-59: The current validateUrl function is too strict for
sponsor/CTA hrefs and breaks relative links; split it into two helpers: keep the
existing validateUrl (used for organizationInformation.url) enforcing only
http(s) and preventing javascript: URIs, and add a new validateHref (or
validateSponsorHref) that allows safe relative paths and the plain strings the
sponsor/CTA props expect (e.g., paths starting with "/", "./", "../" and
optionally protocol schemes like "mailto:"/"tel:" if supported), but still
rejects javascript: and other dangerous schemes; update usages so
organizationInformation.url continues to call validateUrl while sponsor.link and
ctaSection.sponsorLink.url call validateHref (and replace other calls to
validateUrl accordingly).
🪄 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: 16291ae5-97bb-4fce-ace5-620891bad3ff

📥 Commits

Reviewing files that changed from the base of the PR and between 57f8924 and 18fa0d3.

📒 Files selected for processing (2)
  • src/components/SupportUsButton.tsx
  • src/types/index.ts

@github-actions github-actions bot added the documentation Changes to documentation files label Mar 21, 2026
@swathi2006
Copy link
Author

@CodeRabbit can you review changes

@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the PR diff and file contents
gh pr diff 23 --repo AOSSIE-Org/SupportUsButton

echo "---FILE: types/index.ts---"
cat src/types/index.ts

echo "---FILE: SupportUsButton.tsx---"
cat src/components/SupportUsButton.tsx

Length of output: 31937


@swathi2006 Here is my review of the changes in PR #23. The core approach — validateUrl() helper + conditionally wrapping the logo in an <a> — is solid. A few issues need attention though:


🔴 Critical

1. Missing newline at end of file (SupportUsButton.tsx)

The diff ends with \ No newline at end of file. The original had a trailing newline which has been removed. Please restore it:

export default SupportUsButton;
// ← newline here

2. Silent breaking change — validateUrl applied to sponsor and CTA links

Previously, sponsor.link and ctaSection.sponsorLink[].url were used directly as href. Now both are passed through validateUrl, which silently drops relative URLs (e.g. /support, //example.com). Anyone currently using relative URLs for these fields will get a broken (missing) href with no error or warning. Consider either:

  • Documenting this restriction in the README/JSDoc, or
  • Only applying validateUrl to the new organizationInformation.url field (where XSS risk is most relevant), and leaving the existing sponsor/CTA links unchanged (they are consumer-controlled).

🟡 Important

3. Logo rendering logic is duplicated (DRY violation)

The string/image logo rendering appears three times — once in the linked <a> branch and twice in the no-URL branches. Extract it into a local variable or inner component:

const logoContent =
  typeof organizationInformation.logo === "string" ? (
    <span className="block h-fit w-fit p-4 bg-black text-white rounded-2xl">
      <b className="text-2xl italic">{organizationInformation.logo}</b>
    </span>
  ) : (
    <img
      className="w-24 h-24 bg-white/80 select-none rounded-2xl object-cover object-center"
      src={organizationInformation.logo?.src}
      alt={organizationInformation.logo?.alt}
      draggable={false}
    />
  );

Then render conditionally:

<div>
  {organizationInformation?.logo &&
    (validatedUrl ? (
      <a
        href={validatedUrl}
        target="_blank"
        rel="noopener noreferrer"
        title={`Visit ${organizationInformation.name}`}
        className="inline-block transition-transform duration-200 hover:scale-105 hover:shadow-lg cursor-pointer"
      >
        {logoContent}
      </a>
    ) : (
      logoContent
    ))}
</div>

4. Misleading README code example

url:"" in the code example is an empty string, which validateUrl will reject — so the logo won't be clickable. A developer copy-pasting from the docs will wonder why the link doesn't work. Change it to a descriptive placeholder:

-        url:"",// ← If a valid organization URL is provided, the organization logo becomes clickable
+        url: "https://example.com", // ← optional: if a valid https:// URL is provided, the logo becomes clickable

🟢 Minor

5. url?:string formatting in src/types/index.ts

Missing space after colon and no JSDoc comment, unlike other fields:

-  url?:string;
+  /** Organization URL — makes the logo clickable when provided */
+  url?: string;

6. Indentation inconsistency in JSX

The logo <div> block is indented with 7 leading spaces, which doesn't match the surrounding 12-space JSX indentation. Please align it consistently.

7. Leftover blank lines

There are a few stray blank lines in the JSX after the {/* Organization name and description */} section. Please clean those up.

8. Unnecessary optional chaining

organizationInformation is a required prop (organizationInformation: organizationInformation in the interface), so organizationInformation?.url and organizationInformation?.name don't need the ?. operator. Use organizationInformation.url directly.

9. title attribute removed from logo <img>

The original had title={organizationInformation.logo?.alt} on the <img>. Removing it is a minor accessibility/usability regression (no tooltip on hover). Consider restoring it, or relying on the title of the wrapping <a> tag (which is already present when a URL is provided).


Summary table:

# Severity File Issue
1 🔴 Critical SupportUsButton.tsx EOF newline removed
2 🔴 Critical SupportUsButton.tsx validateUrl silently breaks existing relative sponsor/CTA links
3 🟡 Important SupportUsButton.tsx Duplicated logo rendering logic
4 🟡 Important README.md Empty string url:"" example is misleading
5 🟢 Minor src/types/index.ts Missing space + JSDoc for url
6 🟢 Minor SupportUsButton.tsx Indentation inconsistency
7 🟢 Minor SupportUsButton.tsx Stray blank lines in JSX
8 🟢 Minor SupportUsButton.tsx Unnecessary optional chaining on required prop
9 🟢 Minor SupportUsButton.tsx title removed from logo <img>

The feature direction is great — the validateUrl helper is a nice security touch and making the logo clickable (rather than a separate button) is the right UX call per @rahul-vyas-dev's suggestion. Please address the items above, especially #1 and #2. Happy to help with any of the changes!

Copy link

@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.

♻️ Duplicate comments (2)
src/components/SupportUsButton.tsx (2)

51-59: ⚠️ Potential issue | 🟠 Major

validateUrl is too strict for sponsor and CTA links—relative URLs will silently break.

The validateUrl helper rejects anything that doesn't start with http:// or https://. When applied to sponsor.link (Line 328) and ctaSection.sponsorLink[].url (Line 471), legitimate relative paths (e.g., /donate, ./sponsor) or other safe schemes (mailto:) are dropped, rendering the anchor non-navigable without any warning.

Additionally, sponsorLink.url is a required field per the type definition—passing it through validateUrl returns string | undefined, creating a runtime type gap where navigation silently fails.

Consider splitting validation: keep strict http(s) checks for the new external organizationInformation.url, but use a separate permissive validator for sponsor/CTA links that allows relative paths and rejects only dangerous schemes like javascript:.

,

♻️ Suggested approach
+// Strict: only allow http(s) for external org links
 function validateUrl(url?: string): string | undefined {
   if (!url) return undefined;
   const lowerUrl = url.toLowerCase();
   if (lowerUrl.startsWith("http://") || lowerUrl.startsWith("https://")) {
     return url;
   }
   return undefined;
 }

+// Permissive: block dangerous schemes but allow relative URLs
+function sanitizeHref(url?: string): string | undefined {
+  if (!url) return undefined;
+  const lower = url.toLowerCase().trim();
+  if (lower.startsWith("javascript:") || lower.startsWith("data:") || lower.startsWith("vbscript:")) {
+    return undefined;
+  }
+  return url;
+}

Then use sanitizeHref for sponsor and CTA links:

-                  href={validateUrl(sponsor.link)}
+                  href={sanitizeHref(sponsor.link)}
-                href={validateUrl(link.url)}
+                href={sanitizeHref(link.url)}

Also applies to: 328-328, 471-471

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

In `@src/components/SupportUsButton.tsx` around lines 51 - 59, The current
validateUrl function is too strict and drops valid relative or safe-scheme links
(breaking sponsor.link and ctaSection.sponsorLink[].url) and returns undefined
for required fields; create two validators instead: keep a strictHttpValidator
(for organizationInformation.url) that only allows http/https, and add a
permissive sanitizeHref (used for sponsor.link and ctaSection.sponsorLink[].url)
that allows relative paths and safe schemes like mailto: but rejects dangerous
schemes such as javascript:; update usages to call sanitizeHref for sponsor/CTA
links (so required url fields remain usable) and strictHttpValidator only for
the external org URL, ensuring typings reflect that sponsor/CTA validators
return a string for required fields or explicitly handle invalid values with a
fallback/console warning.

183-183: ⚠️ Potential issue | 🟡 Minor

Externalize the tooltip text.

The title attribute is user-visible but remains hardcoded. Move this string to i18n resources for localization. As per coding guidelines, "User-visible strings should be externalized to resource files (i18n)".

,

💬 Suggested change
-                title={`Visit ${organizationInformation?.name}`}
+                title={t("supportUs.visitOrganization", { name: organizationInformation?.name })}

Add the key to locale files:

{
  "supportUs.visitOrganization": "Visit {{name}}"
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SupportUsButton.tsx` at line 183, The tooltip title in
SupportUsButton is hardcoded; add a locale key (e.g.,
"supportUs.visitOrganization": "Visit {{name}}") to your i18n resource files and
replace the inline title with an i18n lookup inside the SupportUsButton
component (use the app's translate function, e.g.,
t('supportUs.visitOrganization', { name: organizationInformation?.name })) so
the tooltip is localized; ensure you import/use the same translation hook (e.g.,
useTranslation or t) used across the codebase and pass
organizationInformation?.name as the interpolation parameter.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/components/SupportUsButton.tsx`:
- Around line 51-59: The current validateUrl function is too strict and drops
valid relative or safe-scheme links (breaking sponsor.link and
ctaSection.sponsorLink[].url) and returns undefined for required fields; create
two validators instead: keep a strictHttpValidator (for
organizationInformation.url) that only allows http/https, and add a permissive
sanitizeHref (used for sponsor.link and ctaSection.sponsorLink[].url) that
allows relative paths and safe schemes like mailto: but rejects dangerous
schemes such as javascript:; update usages to call sanitizeHref for sponsor/CTA
links (so required url fields remain usable) and strictHttpValidator only for
the external org URL, ensuring typings reflect that sponsor/CTA validators
return a string for required fields or explicitly handle invalid values with a
fallback/console warning.
- Line 183: The tooltip title in SupportUsButton is hardcoded; add a locale key
(e.g., "supportUs.visitOrganization": "Visit {{name}}") to your i18n resource
files and replace the inline title with an i18n lookup inside the
SupportUsButton component (use the app's translate function, e.g.,
t('supportUs.visitOrganization', { name: organizationInformation?.name })) so
the tooltip is localized; ensure you import/use the same translation hook (e.g.,
useTranslation or t) used across the codebase and pass
organizationInformation?.name as the interpolation parameter.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b47d544c-2541-4433-9f55-0442b884a2cc

📥 Commits

Reviewing files that changed from the base of the PR and between 18fa0d3 and ff73977.

📒 Files selected for processing (2)
  • README.md
  • src/components/SupportUsButton.tsx

@swathi2006
Copy link
Author

swathi2006 commented Mar 21, 2026

@rahul-vyas-dev All CodeRabbit issues have been addressed.

  • The organization logo is now clickable and redirects to the organization URL when a valid link is provided, otherwise it remains static.
  • Updated the README to document this behavior.

Please let me know if any further changes are needed.

@rahul-vyas-dev
Copy link
Contributor

@swathi2006 share a SS of working code.

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

Labels

documentation Changes to documentation files enhancement New feature or request first-time-contributor First PR of an external contributor frontend Changes to frontend code javascript JavaScript/TypeScript code changes pending-coderabbit-review size/M Medium PR (51-200 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add support for organization website/GitHub link

2 participants