Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable conditional rendering of social media links in Ambassadors Page #3861

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SURAJ-RATHI
Copy link

@SURAJ-RATHI SURAJ-RATHI commented Mar 10, 2025

Summary
This PR adds conditional rendering to prevent displaying undefined social links on the Ambassadors page. Previously, if an ambassador's social link (Twitter, GitHub, or LinkedIn) was missing, an empty tag was still rendered, which could lead to unnecessary spacing and accessibility issues.
Changes Implemented:
✅ Added conditional checks to ensure that only defined social links are displayed.
✅ Updated the JSX structure to prevent rendering empty links.

Before & After:

Before:

Empty links were rendered even if a social link was missing.

After:

Only available social links are displayed, improving UI consistency.

How to Test:
Run the project locally.
Navigate to the Ambassadors page.
Check if only the available social links (Twitter, GitHub, LinkedIn) are displayed.

Screenshot:
image

Checklist:
Code follows the project's contributing guidelines.
UI behaves as expected.
No console errors or warnings

Let me know if you need any modifications!** 🚀

Summary by CodeRabbit

  • Refactor
    • Enhanced ambassador profiles by displaying social media links only when the relevant information is available.
    • Removed the biography section to create a cleaner, more streamlined layout.

Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

Walkthrough

This pull request updates the rendering logic in the Ambassador Index page. The component now conditionally renders social media links for Twitter, GitHub, and LinkedIn based on the existence of corresponding URLs, avoiding the display of empty links. Additionally, the ambassador biography section has been removed, streamlining the page layout. There are no changes to exported or public entities.

Changes

File Summary
pages/.../ambassadors/index.tsx Implemented conditional rendering for Twitter, GitHub, and LinkedIn links; removed ambassador biography section.

Sequence Diagram(s)

sequenceDiagram
    participant I as Index Component
    participant A as Ambassador Data
    participant R as Rendered Output

    I->>A: Load ambassador data
    A-->>I: Provide social URLs (twitterUrl, githubUrl, linkedinUrl)
    I->>R: If twitterUrl exists, render Twitter link
    I->>R: If githubUrl exists, render GitHub link
    I->>R: If linkedinUrl exists, render LinkedIn link
Loading

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • devilkiller-ag
  • sambhavgupta0705
  • asyncapi-bot-eve
  • Mayaleeeee
  • anshgoyalevil

Poem

I hopped upon a change so neat,
With social links now skipping empty seats.
No more bio clutter on my page,
A streamlined view takes center stage.
Happy hops and code so spry,
From this clever bunny, oh my! 🐰✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d18e10c and b4c1618.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • pages/community/ambassadors/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 180000ms (3)
  • GitHub Check: Test NodeJS PR - windows-latest
  • GitHub Check: Test NodeJS PR - macos-13
  • GitHub Check: Lighthouse CI
🔇 Additional comments (2)
pages/community/ambassadors/index.tsx (2)

141-142: Descriptive comment enhances code readability.

Good practice to add a comment describing the purpose of the upcoming code block. This helps other developers understand the intent behind the conditional rendering implementation.


143-159: Well-implemented conditional rendering for social media links.

The implementation correctly uses conditional rendering to display social media links only when they're available. This addresses the issue mentioned in the PR objectives where empty links were previously displayed, causing unnecessary spacing and potential accessibility issues.

Some benefits of this approach:

  • Improves UI by eliminating empty spaces
  • Enhances accessibility by not rendering empty links
  • Makes the layout more consistent across different ambassador profiles
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Mar 10, 2025

Deploy Preview for asyncapi-website failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit b4c1618
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67cef796b537130008413a99

Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d18e10c) to head (b4c1618).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3861   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          667       667           
  Branches       113       113           
=========================================
  Hits           667       667           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TRohit20 TRohit20 changed the title Fix: Add conditional rendering for social media links in Ambassadors … fix: enable conditional rendering of social media links in Ambassadors Page Mar 10, 2025
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