Skip to content

feat: Distributor badges link to relevant source#210

Merged
elliotBraem merged 1 commit intostagingfrom
feat/issue-209
Jul 7, 2025
Merged

feat: Distributor badges link to relevant source#210
elliotBraem merged 1 commit intostagingfrom
feat/issue-209

Conversation

@itexpert120
Copy link
Collaborator

@itexpert120 itexpert120 commented Jul 7, 2025

Resolved #209

Summary by CodeRabbit

  • New Features
    • Distributor badges now display user-friendly names and, when available, are clickable links that open the distributor’s page in a new tab.
  • Enhancements
    • Improved badge styling for better interactivity and appearance.
    • More accurate and informative display of distributor information.

@vercel
Copy link

vercel bot commented Jul 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curatedotfun-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 8:16pm

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

Walkthrough

The changes introduce a new utility module for generating distributor URLs and display names based on configuration. The DistributorBadges component is refactored to use these utilities, now accepting a structured DistributorConfig type and rendering clickable badges that link to distributor destinations when URLs are available.

Changes

File(s) Change Summary
apps/app/src/components/DistributorBadges.tsx Refactored to use DistributorConfig type, utilize new utilities for display name and URL, and render badges as clickable links when possible.
apps/app/src/lib/distributor-urls.ts New module providing DistributorConfig type, and utility functions: getDistributorUrl, getDistributorDisplayName, and hasSpecificUrl.

Sequence Diagram(s)

sequenceDiagram
  participant FeedPage
  participant DistributorBadges
  participant distributor-urls.ts

  FeedPage->>DistributorBadges: Render with distribute: DistributorConfig[]
  DistributorBadges->>distributor-urls.ts: getDistributorDisplayName(distributor)
  DistributorBadges->>distributor-urls.ts: getDistributorUrl(distributor)
  distributor-urls.ts-->>DistributorBadges: Returns display name and URL
  DistributorBadges-->>FeedPage: Render badges (as links if URL exists)
Loading

Assessment against linked issues

Objective Addressed Explanation
twitter navigates to twitter (#209), rss navigates to the rss feed (#209), notion navigates to the notion table (#209)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Poem

In the garden of code, a badge now can gleam,
With a hop and a link, it fulfills the dream.
Twitter, Notion, RSS—each finds its way,
Clickable carrots for users today!
🥕✨

—A rabbit who loves a well-linked display

✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@itexpert120 itexpert120 linked an issue Jul 7, 2025 that may be closed by this pull request
3 tasks
@itexpert120
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (1)
apps/app/src/lib/distributor-urls.ts (1)

213-261: Consider reducing code duplication in hasSpecificUrl function.

The hasSpecificUrl function duplicates the logic from the URL generator functions. Consider refactoring to reuse the existing logic.

export function hasSpecificUrl(distributor: DistributorConfig): boolean {
-  const pluginName = getPluginName(distributor.plugin);
-  const config = distributor.config;
-
-  switch (pluginName) {
-    case "rss":
-      return !!getConfigString(config, "serviceUrl");
-    // ... other cases
-  }
+  const url = getDistributorUrl(distributor);
+  const pluginName = getPluginName(distributor.plugin);
+  
+  // Check if we got a specific URL (not just a fallback)
+  if (!url) return false;
+  
+  // For distributors that always return fallback URLs, check if they have specific config
+  const fallbackUrls = {
+    'twitter': 'https://twitter.com',
+    'telegram': 'https://telegram.org',
+    'notion': 'https://notion.so',
+    'discord': 'https://discord.com',
+    'near-social': 'https://near.social',
+    'supabase': 'https://supabase.com'
+  };
+  
+  return url !== fallbackUrls[pluginName];
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ee14d9 and ced484d.

📒 Files selected for processing (2)
  • apps/app/src/components/DistributorBadges.tsx (1 hunks)
  • apps/app/src/lib/distributor-urls.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/app/src/components/DistributorBadges.tsx (2)
apps/app/src/lib/distributor-urls.ts (3)
  • DistributorConfig (8-11)
  • getDistributorDisplayName (195-211)
  • getDistributorUrl (148-190)
packages/types/src/config.ts (1)
  • DistributorConfig (101-101)
🔇 Additional comments (8)
apps/app/src/lib/distributor-urls.ts (3)

8-11: Well-structured interface definition.

The DistributorConfig interface provides a clean abstraction for distributor configuration with the plugin name and optional config object.


13-32: Robust helper functions for safe configuration extraction.

The template variable detection and safe string extraction logic effectively prevents template variables from being used as actual URLs, which is a good security practice.


124-136: Regex pattern validation ✅
The existing regex https://([^.]+)\.supabase\.co successfully extracts project refs containing letters, numbers, hyphens, and underscores—and correctly ignores the root supabase.co URL. No changes needed.

apps/app/src/components/DistributorBadges.tsx (5)

2-6: Clean integration of the new utility module.

The import statement correctly brings in the required utilities and type definition from the new distributor-urls module.


11-11: Improved type safety with structured DistributorConfig type.

The prop type has been updated to use the more structured DistributorConfig[] type, which provides better type safety and consistency with the utility functions.


15-23: Efficient use of utility functions for display and URL generation.

The component now leverages the centralized utility functions to determine display names and URLs, improving maintainability and consistency across the application.


25-38: Proper implementation of conditional link rendering with security attributes.

The component correctly wraps badges in links when URLs are available, includes proper security attributes (rel="noopener noreferrer"), and opens links in new tabs for better user experience.


20-20: Consistent styling between linked and non-linked badges.

The styling is properly maintained between linked and non-linked badges, with appropriate hover effects added to linked badges to indicate their clickable nature.

Also applies to: 43-43

Comment on lines +98 to +107
function getDiscordUrl(config: Record<string, unknown> | undefined): string {
// Discord links to the specific channel if available
const channelId = getConfigString(config, "channelId");
if (channelId) {
// Discord channel URLs format: https://discord.com/channels/serverId/channelId
// Since we don't have serverId, we use @me which works for direct channel links
return `https://discord.com/channels/@me/${channelId}`;
}
return "https://discord.com";
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Discord URL construction may not work reliably.

The Discord URL construction uses @me as the server ID, which may not work for all channel types. Discord channel URLs typically require both server ID and channel ID.

Consider adding a comment to clarify the limitation or implement a more robust solution:

  if (channelId) {
    // Discord channel URLs format: https://discord.com/channels/serverId/channelId
-    // Since we don't have serverId, we use @me which works for direct channel links
+    // Since we don't have serverId, we use @me which may not work for all channel types
    return `https://discord.com/channels/@me/${channelId}`;
  }
📝 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
function getDiscordUrl(config: Record<string, unknown> | undefined): string {
// Discord links to the specific channel if available
const channelId = getConfigString(config, "channelId");
if (channelId) {
// Discord channel URLs format: https://discord.com/channels/serverId/channelId
// Since we don't have serverId, we use @me which works for direct channel links
return `https://discord.com/channels/@me/${channelId}`;
}
return "https://discord.com";
}
function getDiscordUrl(config: Record<string, unknown> | undefined): string {
// Discord links to the specific channel if available
const channelId = getConfigString(config, "channelId");
if (channelId) {
// Discord channel URLs format: https://discord.com/channels/serverId/channelId
// Since we don't have serverId, we use @me which may not work for all channel types
return `https://discord.com/channels/@me/${channelId}`;
}
return "https://discord.com";
}
🤖 Prompt for AI Agents
In apps/app/src/lib/distributor-urls.ts around lines 98 to 107, the Discord URL
construction uses '@me' as a placeholder for serverId, which may not work for
all channel types since Discord URLs typically require both serverId and
channelId. To fix this, add a clear comment explaining this limitation and
consider implementing a more robust solution that retrieves or requires the
actual serverId to construct valid Discord channel URLs.

Comment on lines +85 to +93
function getCrosspostUrl(config: Record<string, unknown> | undefined): string {
// Crosspost links to the Open Crosspost platform
// Could potentially link to specific account if signerId is available
const signerId = getConfigString(config, "signerId");
if (signerId) {
return `https://near.social/mob.near/widget/MainPage.N.Profile.Page?accountId=${signerId}`;
}
return "https://opencrosspost.com";
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Inconsistent fallback URL for crosspost distributor.

The crosspost function constructs NEAR Social URLs when signerId is available, but falls back to "https://opencrosspost.com" when not. This creates an inconsistency where the same distributor type can link to different platforms.

Consider using a consistent fallback that aligns with the primary URL construction:

-  return "https://opencrosspost.com";
+  return "https://near.social";
📝 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
function getCrosspostUrl(config: Record<string, unknown> | undefined): string {
// Crosspost links to the Open Crosspost platform
// Could potentially link to specific account if signerId is available
const signerId = getConfigString(config, "signerId");
if (signerId) {
return `https://near.social/mob.near/widget/MainPage.N.Profile.Page?accountId=${signerId}`;
}
return "https://opencrosspost.com";
}
function getCrosspostUrl(config: Record<string, unknown> | undefined): string {
// Crosspost links to the Open Crosspost platform
// Could potentially link to specific account if signerId is available
const signerId = getConfigString(config, "signerId");
if (signerId) {
return `https://near.social/mob.near/widget/MainPage.N.Profile.Page?accountId=${signerId}`;
}
return "https://near.social";
}
🤖 Prompt for AI Agents
In apps/app/src/lib/distributor-urls.ts around lines 85 to 93, the fallback URL
for the crosspost distributor is inconsistent, linking to
"https://opencrosspost.com" instead of a NEAR Social URL. To fix this, update
the fallback URL to a consistent NEAR Social URL that aligns with the primary
URL structure, ensuring all crosspost links point to the same platform
regardless of signerId presence.

@elliotBraem elliotBraem merged commit e639b07 into staging Jul 7, 2025
4 checks passed
@elliotBraem elliotBraem deleted the feat/issue-209 branch July 7, 2025 21:23
@coderabbitai coderabbitai bot mentioned this pull request Jul 9, 2025
elliotBraem added a commit that referenced this pull request Jul 9, 2025
* add feed conflicts and lowercase id

* Adds "my feeds" on profile (#204)

* feat: update my feeds tab on profile page

* feat: update tabs to be routes

* fix: double scrollbar

* comment unused files in overview tab

* fix: revert rsbuild

* fmt

* fix: add routegen to prettier ignore

* clean up, server side

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* Resolve shot's comments (#205)

* feat: add name and tag validation to create

* feat: add no activity data in activity tab

* add coming soon sections for profile page

* feat: clicking on leaderboard feed hashtag will redirect to that feed

* fix: keeps name on start when disable feed names collapse

* fix: rsbuild

* fix: add routegen to prettier ignore

* fix: add ability to navigate to collapsed feeds in leaderboard

* add ability to expand or collapse all

* fix: rsbuild

* adjustments

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* feat: new feed edit (#198)

* feat: update the feed editor

* feat: improve performance, and fix bugs

* feat: revert local development change

* add routegen to pretttier ignore

* fix: resolve code rabbit comments

* fix some nitpick comments

* fix prettier and build config

* formats

* merge

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* debounce

* nitpicks

* adds processing step plan

* fix auth

* Feat: recent content (#208)

* Feat: add recent feeds

* feat: add recent content to the main feed page

* fmt

* Update apps/app/src/hooks/use-rss-feed.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@everything.dev>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* atuh flow

* delete old requests

* feat: Distributor badges link to relevant source (#210)

* add _tabs

* init with a rss feed

* xml

* fmt

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jul 9, 2025
* add feed conflicts and lowercase id

* Adds "my feeds" on profile (#204)

* feat: update my feeds tab on profile page

* feat: update tabs to be routes

* fix: double scrollbar

* comment unused files in overview tab

* fix: revert rsbuild

* fmt

* fix: add routegen to prettier ignore

* clean up, server side

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* Resolve shot's comments (#205)

* feat: add name and tag validation to create

* feat: add no activity data in activity tab

* add coming soon sections for profile page

* feat: clicking on leaderboard feed hashtag will redirect to that feed

* fix: keeps name on start when disable feed names collapse

* fix: rsbuild

* fix: add routegen to prettier ignore

* fix: add ability to navigate to collapsed feeds in leaderboard

* add ability to expand or collapse all

* fix: rsbuild

* adjustments

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* feat: new feed edit (#198)

* feat: update the feed editor

* feat: improve performance, and fix bugs

* feat: revert local development change

* add routegen to pretttier ignore

* fix: resolve code rabbit comments

* fix some nitpick comments

* fix prettier and build config

* formats

* merge

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* debounce

* nitpicks

* adds processing step plan

* fix auth

* Feat: recent content (#208)

* Feat: add recent feeds

* feat: add recent content to the main feed page

* fmt

* Update apps/app/src/hooks/use-rss-feed.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@everything.dev>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* atuh flow

* delete old requests

* feat: Distributor badges link to relevant source (#210)

* add _tabs

* init with a rss feed

* xml

* fmt

* append

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jul 9, 2025
* add feed conflicts and lowercase id

* Adds "my feeds" on profile (#204)

* feat: update my feeds tab on profile page

* feat: update tabs to be routes

* fix: double scrollbar

* comment unused files in overview tab

* fix: revert rsbuild

* fmt

* fix: add routegen to prettier ignore

* clean up, server side

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* Resolve shot's comments (#205)

* feat: add name and tag validation to create

* feat: add no activity data in activity tab

* add coming soon sections for profile page

* feat: clicking on leaderboard feed hashtag will redirect to that feed

* fix: keeps name on start when disable feed names collapse

* fix: rsbuild

* fix: add routegen to prettier ignore

* fix: add ability to navigate to collapsed feeds in leaderboard

* add ability to expand or collapse all

* fix: rsbuild

* adjustments

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* feat: new feed edit (#198)

* feat: update the feed editor

* feat: improve performance, and fix bugs

* feat: revert local development change

* add routegen to pretttier ignore

* fix: resolve code rabbit comments

* fix some nitpick comments

* fix prettier and build config

* formats

* merge

---------

Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* debounce

* nitpicks

* adds processing step plan

* fix auth

* Feat: recent content (#208)

* Feat: add recent feeds

* feat: add recent content to the main feed page

* fmt

* Update apps/app/src/hooks/use-rss-feed.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* nitpicks

---------

Co-authored-by: Elliot Braem <elliot@everything.dev>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Elliot Braem <elliot@ejlbraem.com>

* atuh flow

* delete old requests

* feat: Distributor badges link to relevant source (#210)

* add _tabs

* init with a rss feed

* xml

* fmt

* append

* add service url

* adjustments

* fix

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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.

[Task]: Feed page header should navigate to distributors

2 participants