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

[masterbots.ai] Fix: pre ICL changes #346

Closed
wants to merge 14 commits into from
Closed

Conversation

Bran18
Copy link
Contributor

@Bran18 Bran18 commented Jan 22, 2025

Summary by Sourcery

Remove social following feature, update UI for profile and browse pages, and improve model selection.

Summary by CodeRabbit

Based on the comprehensive summary of changes, here are the release notes:

Release Notes

  • Database Changes

    • Removed social following relationships and foreign key constraints
    • Simplified database schema for user and chatbot interactions
  • User Interface

    • Added new mobile views for chatbot onboarding and details
    • Updated sidebar and header navigation
    • Introduced route-specific gradient styles
    • Removed thread publicity and follow/unfollow functionality
  • Performance

    • Streamlined component logic
    • Removed unnecessary session management checks
    • Simplified data fetching and routing mechanisms
  • Development

    • Updated dependency versions
    • Improved type-only imports
    • Enhanced error handling and code consistency
  • Routing

    • Added new route type detection
    • Modified navigation between chat and public routes

@Bran18 Bran18 requested a review from AndlerRL January 22, 2025 02:58
Copy link

sourcery-ai bot commented Jan 22, 2025

Reviewer's Guide by Sourcery

This pull request focuses on refactoring the user card component and removing the social following feature. The changes include removing the follow/unfollow logic, updating the UI, and adjusting the queries to remove the social following data.

Class diagram showing the updated UserCard component structure

classDiagram
    class UserCard {
        -user: User | null
        -loading: boolean
        -isSameUser: function
        -updateUserInfo: function
        -isLoading: boolean
        -generateType: string
        -bio: string
        -favouriteTopic: string
        -userProfilePicture: string
        -isUploadingImage: boolean
        +handleProfilePictureUpload()
        +handleUpdateUserInfo()
        +generateBio()
    }

    class User {
        +userId: string
        +username: string
        +bio: string
        +favouriteTopic: string
        +profilePicture: string
        +threads: Thread[]
    }

    class Thread {
        +threadId: string
        +messages: Message[]
    }

    UserCard --> User: contains
    User --> Thread: has many
    note for UserCard "Removed social following
functionality and simplified
component structure"
Loading

State diagram for the updated user profile picture upload flow

stateDiagram-v2
    [*] --> Idle
    Idle --> UploadingImage: User selects image
    UploadingImage --> UploadingToCloudinary: Upload starts
    UploadingToCloudinary --> UpdateUserInfo: Upload success
    UpdateUserInfo --> Idle: Update complete

    UploadingToCloudinary --> Error: Upload fails
    Error --> Idle: User acknowledges

    note right of UploadingImage
        Simplified error handling
        and removed social
        following states
    end note
Loading

File-Level Changes

Change Details Files
Refactor UserCard component
  • Removed follow/unfollow logic.
  • Removed the follow/unfollow button.
  • Removed the followers and following count.
  • Updated the UI to remove the follow/unfollow button and the followers/following count.
  • Updated the profile picture upload logic.
  • Updated the bio and favorite topic generation logic.
  • Removed the user data state.
  • Removed the isFollowLoading state.
  • Removed the session data.
  • Removed the user follow or unfollow service.
  • Removed the isFollowed util function.
  • Removed the router import.
apps/masterbots.ai/components/routes/profile/user-card.tsx
Remove social following from queries
  • Removed the followers field from the chatbot query.
  • Removed the followers field from the user query.
  • Removed the following field from the user query.
  • Removed the socialFollowing query.
  • Removed the userFollowOrUnfollow function.
  • Removed the chatbotFollowOrUnfollow function.
  • Removed the getFollowStatus function.
  • Removed the followUser function.
  • Removed the unfollowUser function.
  • Removed the getChatbotFollowStatus function.
  • Removed the followChatbot function.
  • Removed the unfollowChatbot function.
  • Removed the logic to interweave following and organic threads.
  • Removed the logic to filter threads by followed users and bots.
apps/masterbots.ai/services/hasura/hasura.service.ts
Update sidebar links
  • Added a data-route attribute to the sidebar links.
  • Added a sidebar-gradient class to the sidebar links.
  • Added a selected class to the sidebar links when they are active.
  • Added a hover effect to the sidebar links.
  • Added a routeType variable to determine the route type.
  • Added a getRouteType function to determine the route type.
  • Added a conditional rendering for the chatbot component based on the isFilterMode and isSelected variables.
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx
Update onboarding chatbot details component
  • Removed the follow button.
  • Removed the followers count.
  • Removed the thread count.
  • Removed the isFollowed util function.
  • Removed the session data.
  • Removed the onFollow prop.
  • Updated the UI to remove the follow button and the followers/following count.
  • Added a new mobile onboarding component.
  • Added a new selected bot mobile component.
apps/masterbots.ai/components/routes/chat/onboarding-chatbot-details.tsx
Update chat chatbot details component
  • Removed the follow/unfollow logic.
  • Removed the isFollowLoading state.
  • Removed the followers state.
  • Removed the handleFollow function.
  • Removed the router import.
  • Removed the social following import.
  • Removed the toast import.
  • Removed the session data.
  • Removed the social following import.
  • Removed the logic to set the followers state.
  • Removed the logic to handle the follow/unfollow button.
  • Added a new mobile onboarding component.
  • Added a new selected bot mobile component.
apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx
Remove social following from database schema
  • Removed the social_following table.
  • Removed the followers relationship from the chatbot table.
  • Removed the followers relationship from the user table.
  • Removed the following relationship from the user table.
apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml
apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml
apps/hasura/metadata/databases/masterbots/tables/public_user.yaml
Update chat combobox component
  • Added a conditional rendering for the model options based on the environment.
  • Added a isDevEnv variable to determine if the environment is development or local.
apps/masterbots.ai/components/routes/chat/chat-combobox.tsx
Update profile sidebar component
  • Removed the pro and ww buttons from the sidebar if the devMode feature is disabled.
  • Added a public button to the sidebar.
apps/masterbots.ai/components/layout/sidebar/profile-sidebar.tsx
Update utils
  • Removed the formatNumber function.
  • Removed the isFollowed function.
  • Added a getRouteType function to determine the route type.
apps/masterbots.ai/lib/utils.ts
Update global styles
  • Added a background-public-gradient variable.
  • Added a background-public-hover-gradient variable.
  • Added a background-chat-gradient variable.
  • Added a background-chat-hover-gradient variable.
  • Added a sidebar-gradient class.
  • Added a selected class.
  • Added a hover effect to the sidebar links.
apps/masterbots.ai/app/globals.css
Update prompt form component
  • Added a onClick event to the textarea to handle bot selection.
  • Added a handleBotSelection function to handle bot selection.
  • Added a conditional rendering for the select a bot message.
  • Updated the styles for the select a bot message.
apps/masterbots.ai/components/routes/chat/prompt-form.tsx
Update sidebar component
  • Added a conditional background color based on the route.
  • Added a isChatRoute variable to determine if the route is a chat route.
apps/masterbots.ai/components/layout/sidebar/sidebar.tsx
Update browse list component
  • Removed the session data.
  • Removed the userId variable.
  • Removed the followedUserId from the getBrowseThreads function.
apps/masterbots.ai/components/routes/browse/browse-list.tsx
Update chat options component
  • Removed the badge check icon.
  • Removed the font size selector.
apps/masterbots.ai/components/routes/chat/chat-options.tsx
Update tooltip component
  • Updated the animation styles.
apps/masterbots.ai/components/ui/tooltip.tsx
Update user thread panel component
  • Added a conditional rendering for the search input based on the threads length.
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx
Update header component
  • Removed the pro and ww buttons from the header if the devMode feature is disabled.
  • Added a public button to the header.
apps/masterbots.ai/components/layout/header/header.tsx
Update thread popup component
  • Removed the thread publicity switch.
apps/masterbots.ai/components/routes/thread/thread-popup.tsx
Update hasura service types
  • Removed the followedUserId from the GetBrowseThreadsParams interface.
apps/masterbots.ai/services/hasura/hasura.service.type.ts
Update browse chatbot mobile details component
  • Updated the icon from BotMessageSquareIcon to MessageSquareIcon.
  • Updated the avatar styles.
apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx
Update types
  • Removed the SocialFollowing type from the ChatbotDetailsProps interface.
apps/masterbots.ai/types/types.ts
Update sidebar category general component
  • Added a conditional rendering for the no matching categories message.
apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx
Update sidebar item component
  • Updated the import for the Chat type.
apps/masterbots.ai/components/layout/sidebar/sidebar-item.tsx
Remove migrations
  • Removed all migrations related to the social following feature.
apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql
apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql
apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql
apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql
apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql
apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql
apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql
apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql
apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql
apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql
apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql
apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql
apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql
apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql
apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql
apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql
Remove onboarding mobile component
  • Removed the onboarding mobile component.
apps/masterbots.ai/components/routes/chat/onboarding-chatbot-mobile-details.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Jan 22, 2025

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

Name Status Preview Comments Updated (UTC)
masterbots ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 2:59am

Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/masterbots.ai/app/globals.css

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

Walkthrough

This pull request involves significant changes to the database schema and application logic related to social following functionality. The modifications primarily focus on removing relationships and permissions associated with the social_following table, particularly those related to chatbots and followers. The changes span multiple files across Hasura metadata, migrations, and the frontend application, indicating a comprehensive refactoring of the social interaction features.

Changes

File Change Summary
apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml Removed followers object relationship
apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml Removed object relationships, insert/select/update/delete permissions for moderator role
apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx Removed follow/unfollow functionality and related state management
apps/masterbots.ai/services/hasura/hasura.service.ts Deleted functions related to user and chatbot following
apps/masterbots.ai/types/types.ts Removed followers property from ChatbotDetailsProps interface

Possibly related PRs

Suggested Labels

bug

Suggested Reviewers

  • AndlerRL

Poem

🐰 A Rabbit's Farewell to Following

Followers fade, connections unwind,
Social threads we once did bind,
Metadata shifts like desert sand,
No more tracking with a gentle hand.

Hop along, little database dream! 🌟

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @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.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Bran18 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

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

🔭 Outside diff range comments (1)
apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx (1)

Line range hint 113-156: Remove hardcoded follower counts.

The component still displays hardcoded follower counts (313, 3200) and following/follower UI elements despite the removal of social following functionality across the application.

Consider removing the following/follower section or replacing it with more relevant metrics:

-              <div className="h-[42px] flex-col justify-center items-center inline-flex">
-                <div className="inline-flex items-center justify-center gap-3">
-                  <div className="w-[67px] flex-col justify-end items-center gap-1.5 inline-flex">
-                    <div className="w-[70px] h-5 text-center text-zinc-950 dark:text-gray-300 text-[13px] font-normal">
-                      Following
-                    </div>
-                    <div className="justify-start items-end gap-1.5 inline-flex">
-                      <Users className="size-4 text-zinc-950 dark:text-gray-300" />
-                      <div className="text-center text-zinc-500 text-[13px] font-normal">
-                        {numberShortener(313)}
-                      </div>
-                    </div>
-                  </div>
-                  <div className="inline-flex flex-col items-center justify-center">
-                    <div className="w-[70px] h-5 text-center text-zinc-950 dark:text-gray-300 text-[13px] font-normal">
-                      Followers
-                    </div>
-                    <div className="inline-flex items-center justify-start gap-3">
-                      <div className="justify-start items-end gap-1.5 flex">
-                        <Users className="size-4 text-zinc-950 dark:text-gray-300" />
-                        <div className="text-center text-zinc-500 text-[13px] font-normal">
-                          {numberShortener(3200)}
-                        </div>
-                      </div>
-                      <Button
-                        variant="outline"
-                        size="sm"
-                        className={cn(
-                          'h-[21px] px-3 py-0.5',
-                          'rounded-md shadow',
-                          'border border-zinc-100/50',
-                          'text-zinc-500 text-sm font-normal',
-                          'hover:bg-zinc-100/10 hover:text-zinc-400',
-                          'transition-colors'
-                        )}
-                      >
-                        Follow
-                      </Button>
-                    </div>
-                  </div>
-                </div>
-              </div>
♻️ Duplicate comments (1)
apps/masterbots.ai/components/routes/chat/chat-selected-chatbot-mobile.tsx (1)

20-20: 🛠️ Refactor suggestion

Duplicate height calculation found.

This component uses the same height calculation as chat-onboarding-chatbot-mobile.tsx. Consider extracting to a shared utility class.

🧹 Nitpick comments (16)
apps/masterbots.ai/components/layout/sidebar/profile-sidebar.tsx (1)

46-57: Add error handling to the profile navigation.

While the multi-line formatting improves readability, the function could benefit from proper error handling:

  • Add try-catch block for error handling
  • Add fallback for undefined userSlug
  const goToProfile = useCallback(
    (e: React.MouseEvent) => {
-     e.preventDefault()
-     e.stopPropagation()
-     const userSlug = toSlugWithUnderScore(user.name || '')
-     if (userSlug) {
-       setIsOpen(false)
-       router.push(`/u/${userSlug}/t`)
-     }
+     try {
+       e.preventDefault()
+       e.stopPropagation()
+       const userSlug = toSlugWithUnderScore(user.name || '')
+       if (!userSlug) {
+         console.error('Invalid user slug')
+         return
+       }
+       setIsOpen(false)
+       router.push(`/u/${userSlug}/t`)
+     } catch (error) {
+       console.error('Profile navigation error:', error)
+     }
    },
    [router, user.name]
  )
apps/masterbots.ai/components/routes/chat/prompt-form.tsx (2)

65-73: Consider adding error handling for edge cases.

The handleBotSelection function is well-implemented with proper null checks and focus management. Consider adding error handling for cases where activeThread exists but chatbot is undefined.

 const handleBotSelection = () => {
   if (activeThread?.chatbot) {
     setActiveChatbot(activeThread.chatbot)
     // Focus textarea after bot selection
     if (inputRef.current) {
       inputRef.current.focus()
     }
+  } else {
+    console.warn('No chatbot available for selection')
   }
 }

118-118: Consider UX impact of click handler on textarea.

Adding onClick={handleBotSelection} to the textarea might interfere with normal text selection behavior. Consider moving this handler to a separate button or icon for clearer user interaction.

apps/masterbots.ai/components/routes/chat/chat-onboarding-chatbot-mobile.tsx (2)

6-6: Consider using a CSS utility class for the height calculation.

The height calculation h-[calc(100vh-196px)] is hardcoded. Consider extracting this to a CSS utility class for better maintainability.

-    <div className="md:hidden h-[calc(100vh-196px)] flex items-center justify-center -translate-y-8">
+    <div className="md:hidden h-mobile-content flex items-center justify-center -translate-y-8">

Add to your CSS:

.h-mobile-content {
  height: calc(100vh - 196px);
}

18-21: Improve text content accessibility.

The description text uses a hardcoded minimum height (min-h-24) which might affect readability on smaller screens.

-              <p className="w-full text-sm text-zinc-500 dark:text-zinc-500 min-h-24">
+              <p className="w-full text-sm text-zinc-500 dark:text-zinc-500">
apps/masterbots.ai/components/layout/sidebar/sidebar.tsx (1)

37-39: Consider using CSS custom properties for theme colors.

The background colors are hardcoded. Consider using CSS custom properties for better theme management.

-            ? 'bg-[#fae8ff] dark:bg-[#17021D]' // For /c routes only
-            : 'bg-[#eeffea] dark:bg-[#0B1608]'  // For other routes
+            ? 'bg-chat-route dark:bg-chat-route-dark'
+            : 'bg-public-route dark:bg-public-route-dark'

Add to your CSS:

:root {
  --bg-chat-route: #fae8ff;
  --bg-chat-route-dark: #17021D;
  --bg-public-route: #eeffea;
  --bg-public-route-dark: #0B1608;
}
apps/masterbots.ai/components/routes/chat/onboarding-chatbot-details.tsx (2)

15-16: Remove commented code.

These background style definitions are commented out and should be removed if they're no longer needed.

-    // <div className="hidden md:block w-full relative bg-left-bottom bg-[url('/hero-bg.png')] bg-no-repeat py-6">
-    //   <div className="absolute inset-0 z-0 bg-gradient-to-l from-mirage via-[#6A0D826E]/80 to-[#9412B5BF] dark:via-[#66B252BF]/80 dark:to-[#83E56A6B]/80" />

23-28: Consider extracting bio section into a separate component.

The conditional rendering of the bio section could be extracted into a separate component for better maintainability.

+const BioSection = ({ description }: { description: string }) => (
+  <div className="flex items-center px-4">
+    <Bot className="mr-2 size-4" />
+    <span className="text-sm">bio:</span>
+  </div>
+);

 {!isWelcomeView && (
-  <div className="flex items-center px-4">
-    <Bot className="mr-2 size-4" />
-    <span className="text-sm">bio:</span>
-  </div>
+  <BioSection description={description} />
 )}
apps/masterbots.ai/components/routes/chat/chat-combobox.tsx (2)

87-93: Simplify the nested environment check.

The nested environment check in the onSelect handler is redundant since we already have isDevEnv. This could be simplified while maintaining the double-check safety as per the retrieved learning.

-                    onSelect={currentValue => {
-                      process.env.NEXT_PUBLIC_APP_ENV !== 'prod'
-                        ? (setValue(currentValue === value ? '' : currentValue),
-                          changeModel(currentValue as AIModels))
-                        : ''
-                      setOpen(false) // Closes the popover after selection.
-                    }}
+                    onSelect={currentValue => {
+                      if (isDevEnv && process.env.NEXT_PUBLIC_APP_ENV !== 'prod') {
+                        setValue(currentValue === value ? '' : currentValue);
+                        changeModel(currentValue as AIModels);
+                      }
+                      setOpen(false);
+                    }}

Line range hint 34-40: Consider grouping model options by provider.

The model options array could be organized better by grouping models by their providers (OpenAI, Claude, Llama, etc.).

-const models = [
-  { label: 'GPT-4o', value: AIModels.Default, logo: 'MB' },
-  { label: 'GPT-4', value: AIModels.GPT4, logo: <IconOpenAI /> },
-  { label: 'Claude3', value: AIModels.Claude3, logo: <IconClaude /> },
-  { label: 'llama3_8', value: AIModels.llama3_8b, logo: <IconLlama /> },
-  { label: 'llama3_7', value: AIModels.llama3_7b, logo: <IconLlama /> },
-  { label: 'WordWare', value: AIModels.WordWare, logo: <IconWordware /> }
-]
+const modelsByProvider = {
+  masterbots: [
+    { label: 'GPT-4o', value: AIModels.Default, logo: 'MB' }
+  ],
+  openai: [
+    { label: 'GPT-4', value: AIModels.GPT4, logo: <IconOpenAI /> }
+  ],
+  anthropic: [
+    { label: 'Claude3', value: AIModels.Claude3, logo: <IconClaude /> }
+  ],
+  llama: [
+    { label: 'llama3_8', value: AIModels.llama3_8b, logo: <IconLlama /> },
+    { label: 'llama3_7', value: AIModels.llama3_7b, logo: <IconLlama /> }
+  ],
+  wordware: [
+    { label: 'WordWare', value: AIModels.WordWare, logo: <IconWordware /> }
+  ]
+}
+
+const models = Object.values(modelsByProvider).flat()
apps/masterbots.ai/components/routes/browse/browse-list.tsx (1)

60-67: Consider using object destructuring for better readability.

The conditional object spread could be simplified using destructuring for better readability.

-      const threads = await getBrowseThreads({
-        ...(activeCategory !== null || activeChatbot !== null
-          ? {
-            categoryId: activeCategory,
-            chatbotName: activeChatbot?.name,
-          }
-          : {
-            categoriesId,
-            chatbotsId,
-            keyword,
-          }),
-        limit: PAGE_SIZE,
-      })
+      const params = activeCategory !== null || activeChatbot !== null
+        ? { categoryId: activeCategory, chatbotName: activeChatbot?.name }
+        : { categoriesId, chatbotsId, keyword };
+      
+      const threads = await getBrowseThreads({
+        ...params,
+        limit: PAGE_SIZE
+      });
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (1)

Line range hint 3-13: Use import type for type-only imports.

Use the import type syntax for imports that are only used as types to ensure they are removed during compilation.

-import type { Category, Chatbot } from 'mb-genql'
+import { type Category, type Chatbot } from 'mb-genql'
apps/masterbots.ai/components/routes/profile/user-card.tsx (1)

258-282: Remove commented out social following UI code.

Since the social following functionality has been removed as part of this PR, the commented-out UI code should also be removed to maintain code cleanliness.

apps/masterbots.ai/services/hasura/hasura.service.ts (1)

829-850: Remove commented out social following queries.

Since the social following functionality has been removed as part of this PR, the commented-out query code should also be removed to maintain code cleanliness.

apps/masterbots.ai/app/globals.css (2)

56-58: Fix misplaced comment.

The comment "Public route gradients" is incorrectly placed above the chat-related gradient properties.

-    /* Public route gradients */
+    /* Chat route gradients */
     --background-chat-gradient: linear-gradient(180deg, rgba(155, 22, 232, 0.2) 0%, rgba(190, 22, 232, 0.53) 100%);
     --background-chat-hover-gradient: linear-gradient(-180deg, rgba(166, 22, 232, 0.1) 0%, rgba(190, 22, 232, 0.3) 100%);

105-110: Consider theme-specific gradient values.

The gradient values are identical in both light and dark modes. Consider adjusting the opacity values in dark mode for better contrast and visibility.

-    --background-public-gradient: linear-gradient(180deg, rgba(115, 201, 97, 0.2) 0%, rgba(122, 214, 104, 0.4) 100%);
-    --background-public-hover-gradient: linear-gradient(-180deg, rgba(113, 199, 96, 0.1) 0%, rgba(117, 205, 99, 0.3) 100%);
+    --background-public-gradient: linear-gradient(180deg, rgba(115, 201, 97, 0.3) 0%, rgba(122, 214, 104, 0.5) 100%);
+    --background-public-hover-gradient: linear-gradient(-180deg, rgba(113, 199, 96, 0.2) 0%, rgba(117, 205, 99, 0.4) 100%);

-    --background-chat-gradient: linear-gradient(180deg, rgba(155, 22, 232, 0.2) 0%, rgba(190, 22, 232, 0.53) 100%);
-    --background-chat-hover-gradient: linear-gradient(-180deg, rgba(166, 22, 232, 0.1) 0%, rgba(190, 22, 232, 0.3) 100%);
+    --background-chat-gradient: linear-gradient(180deg, rgba(155, 22, 232, 0.3) 0%, rgba(190, 22, 232, 0.63) 100%);
+    --background-chat-hover-gradient: linear-gradient(-180deg, rgba(166, 22, 232, 0.2) 0%, rgba(190, 22, 232, 0.4) 100%);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0485f81 and e2b35c4.

⛔ Files ignored due to path filters (5)
  • bun.lockb is excluded by !**/bun.lockb
  • packages/mb-genql/generated/index.ts is excluded by !**/generated/**
  • packages/mb-genql/generated/schema.graphql is excluded by !**/generated/**
  • packages/mb-genql/generated/schema.ts is excluded by !**/generated/**
  • packages/mb-genql/generated/types.ts is excluded by !**/generated/**
📒 Files selected for processing (46)
  • apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml (0 hunks)
  • apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml (0 hunks)
  • apps/hasura/metadata/databases/masterbots/tables/public_user.yaml (2 hunks)
  • apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql (0 hunks)
  • apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql (0 hunks)
  • apps/masterbots.ai/app/globals.css (3 hunks)
  • apps/masterbots.ai/components/layout/header/header.tsx (1 hunks)
  • apps/masterbots.ai/components/layout/sidebar/profile-sidebar.tsx (2 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx (1 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-item.tsx (2 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (9 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar.tsx (2 hunks)
  • apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx (3 hunks)
  • apps/masterbots.ai/components/routes/browse/browse-list.tsx (2 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx (3 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-combobox.tsx (4 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-onboarding-chatbot-mobile.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-options.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-selected-chatbot-mobile.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/onboarding-chatbot-details.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/onboarding-chatbot-mobile-details.tsx (0 hunks)
  • apps/masterbots.ai/components/routes/chat/prompt-form.tsx (5 hunks)
  • apps/masterbots.ai/components/routes/profile/user-card.tsx (4 hunks)
  • apps/masterbots.ai/components/routes/thread/thread-popup.tsx (0 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (1 hunks)
  • apps/masterbots.ai/components/ui/tooltip.tsx (2 hunks)
  • apps/masterbots.ai/lib/utils.ts (2 hunks)
  • apps/masterbots.ai/next-env.d.ts (1 hunks)
  • apps/masterbots.ai/package.json (1 hunks)
  • apps/masterbots.ai/services/hasura/hasura.service.ts (7 hunks)
  • apps/masterbots.ai/services/hasura/hasura.service.type.ts (0 hunks)
  • apps/masterbots.ai/types/types.ts (1 hunks)
💤 Files with no reviewable changes (21)
  • apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql
  • apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql
  • apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql
  • apps/masterbots.ai/services/hasura/hasura.service.type.ts
  • apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml
  • apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql
  • apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql
  • apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql
  • apps/masterbots.ai/components/routes/thread/thread-popup.tsx
  • apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql
  • apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql
  • apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql
  • apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql
  • apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql
  • apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql
  • apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql
  • apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql
  • apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql
  • apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql
  • apps/masterbots.ai/components/routes/chat/onboarding-chatbot-mobile-details.tsx
  • apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml
✅ Files skipped from review due to trivial changes (5)
  • apps/masterbots.ai/next-env.d.ts
  • apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx
  • apps/masterbots.ai/package.json
  • apps/masterbots.ai/components/ui/tooltip.tsx
  • apps/masterbots.ai/components/layout/sidebar/sidebar-item.tsx
🧰 Additional context used
📓 Learnings (2)
apps/masterbots.ai/components/routes/chat/chat-combobox.tsx (1)
Learnt from: Bran18
PR: bitcashorg/masterbots#336
File: apps/masterbots.ai/components/routes/chat/chat-combobox.tsx:87-93
Timestamp: 2025-01-20T21:55:28.946Z
Learning: In the ChatCombobox component of masterbots.ai, model selection functionality uses double environment checks (outer `isDevEnv` and inner `process.env.NEXT_PUBLIC_APP_ENV !== 'prod'`) as an intentional safeguard to ensure the feature is strictly limited to development environments.
apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx (1)
Learnt from: Bran18
PR: bitcashorg/masterbots#324
File: apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx:145-146
Timestamp: 2024-12-11T19:40:37.103Z
Learning: In `apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx`, the follower and following counts are currently hardcoded as these features are being developed in other PRs.
🪛 Biome (1.9.4)
apps/masterbots.ai/components/routes/profile/user-card.tsx

[error] 10-10: All these imports are only used as types.

Importing the types with import type ensures that they are removed by the compilers and avoids loading unnecessary modules.
Safe fix: Use import type.

(lint/style/useImportType)


[error] 12-12: Some named imports are only used as types.

This import is only used as a type.

Importing the types with import type ensures that they are removed by the compilers and avoids loading unnecessary modules.
Safe fix: Add inline type keywords.

(lint/style/useImportType)

🔇 Additional comments (21)
apps/masterbots.ai/components/layout/header/header.tsx (1)

23-24: LGTM! Navigation structure changes look consistent.

The changes simplify the navigation by:

  • Adding an unconditional "Public" link
  • Maintaining the conditional "Pro" link for dev mode
  • Removing the "Ww" link
apps/masterbots.ai/components/layout/sidebar/profile-sidebar.tsx (2)

125-125: LGTM! Button text change aligns with header navigation.

The change from "Browse" to "Public" maintains consistency with the header navigation changes.


129-144: LGTM! Improved code structure with fragment.

The dev mode buttons are now properly wrapped in a fragment, improving code organization while maintaining the same functionality.

apps/masterbots.ai/components/routes/chat/prompt-form.tsx (2)

60-64: LGTM! Clean hook integration.

The addition of setActiveChatbot from useSidebar hook is well-integrated and follows React patterns.


103-104: LGTM! Improved responsive design.

The CSS changes enhance mobile responsiveness while maintaining Tailwind conventions.

Also applies to: 123-125

apps/masterbots.ai/components/layout/sidebar/sidebar.tsx (1)

19-26: ⚠️ Potential issue

Improve effect dependency management.

The effect's dependency array is missing setActiveThread and setIsOpenPopup. This could lead to stale closures.

  React.useEffect(() => {
    if (rootAndChatRegex.test(pathname)) {
      setActiveThread(null)
      setIsOpenPopup(false)
    }
    prevPathRef.current = pathname
-  }, [pathname])
+  }, [pathname, setActiveThread, setIsOpenPopup])

Likely invalid or redundant comment.

apps/masterbots.ai/components/routes/browse/browse-list.tsx (1)

118-118: LGTM! Dependencies are correctly updated.

The useEffect dependencies have been properly updated to remove session-related dependencies, which aligns with the removal of social following functionality.

apps/masterbots.ai/types/types.ts (1)

4-4: LGTM! Import cleanup is correct.

The removal of the SocialFollowing import aligns with the removal of social following functionality.

apps/masterbots.ai/components/routes/chat/chat-options.tsx (1)

21-21: LGTM!

The import statement has been updated to include only the icons that are actively used in the component.

apps/masterbots.ai/components/routes/browse/browse-chatbot-mobile-details.tsx (1)

9-9: LGTM!

The icon change from BotMessageSquareIcon to MessageSquareIcon is consistently applied across import and usage.

Also applies to: 46-46

apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (1)

214-221: LGTM!

The search input is now conditionally rendered only when there are threads available to search through, improving the user experience.

apps/masterbots.ai/lib/utils.ts (2)

4-4: LGTM!

The removal of the SocialFollowing import aligns with the broader removal of social following functionality across the application.


332-342: LGTM!

The new getRouteType function is well-documented and provides a clear way to determine the route type based on the pathname.

apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (2)

Line range hint 21-195: LGTM! The SidebarLink component changes look good.

The changes improve the component by:

  • Adding route type calculation for better navigation tracking
  • Enhancing accessibility with ARIA attributes
  • Maintaining consistent styling with the design system

207-304: LGTM! The ChatbotComponent changes look good.

The changes improve the component by:

  • Adding route type tracking
  • Enhancing error handling for image loading
  • Maintaining consistent styling with the design system
apps/masterbots.ai/components/routes/profile/user-card.tsx (3)

82-84: LGTM! Error handling improvements look good.

The changes improve error handling by:

  • Adding detailed error messages
  • Proper error propagation
  • Consistent error handling patterns

Also applies to: 96-96, 134-136, 146-148


25-29: LGTM! State management improvements look good.

The changes improve state management by:

  • Adding proper type annotations
  • Initializing state with undefined
  • Consistent state update patterns

290-299: LGTM! Profile picture handling looks good.

The changes improve profile picture handling by:

  • Adding proper error fallback
  • Using proper image dimensions
  • Maintaining consistent styling
apps/masterbots.ai/services/hasura/hasura.service.ts (1)

Line range hint 371-482: LGTM! Query structure improvements look good.

The changes improve the query structure by:

  • Better organization of query conditions
  • Consistent formatting
  • Proper type safety
apps/hasura/metadata/databases/masterbots/tables/public_user.yaml (1)

Line range hint 34-66: LGTM! New array relationships look good.

The changes improve the data model by adding well-structured relationships for:

  • User prompts
  • User referrals (both as referrer and referee)
  • User threads
apps/masterbots.ai/app/globals.css (1)

325-345: Well-structured sidebar gradient implementation!

The sidebar gradient styles are well-organized with:

  • Smooth transitions between states
  • Clear separation of route-specific styles
  • Proper handling of hover and selected states

Comment on lines +145 to +159
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
<div
onClick={handleBotSelection}
className={cn(
'backdrop-blur-[1px] font-semibold border border-[#27272A] rounded-[6px] absolute size-full top-0 left-0',
'flex justify-center items-center dark:bg-[#27272A80] text-2xl',
'cursor-pointer transition-all',
'hover:border-[#82e46a] hover:text-[#82e46a]'
)}
>
Select{' '}
<span className="mx-2 text-[#82e46a]">
{activeThread?.chatbot?.name}
</span>{' '}
to continue
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve accessibility of the overlay.

The overlay implementation has several accessibility concerns:

  1. The biome-ignore comment lacks explanation for ignoring keyboard events.
  2. The div should be a button for proper keyboard interaction.
  3. Missing ARIA attributes for screen readers.
-// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
-<div
+<button
   onClick={handleBotSelection}
+  onKeyDown={(e) => e.key === 'Enter' && handleBotSelection()}
+  role="button"
+  aria-label={`Select ${activeThread?.chatbot?.name} to continue`}
   className={cn(
     'backdrop-blur-[1px] font-semibold border border-[#27272A] rounded-[6px] absolute size-full top-0 left-0',
     'flex justify-center items-center dark:bg-[#27272A80] text-2xl',
     'cursor-pointer transition-all',
     'hover:border-[#82e46a] hover:text-[#82e46a]'
   )}
 >
   Select{' '}
   <span className="mx-2 text-[#82e46a]">
     {activeThread?.chatbot?.name}
   </span>{' '}
   to continue
-</div>
+</button>
📝 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
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
<div
onClick={handleBotSelection}
className={cn(
'backdrop-blur-[1px] font-semibold border border-[#27272A] rounded-[6px] absolute size-full top-0 left-0',
'flex justify-center items-center dark:bg-[#27272A80] text-2xl',
'cursor-pointer transition-all',
'hover:border-[#82e46a] hover:text-[#82e46a]'
)}
>
Select{' '}
<span className="mx-2 text-[#82e46a]">
{activeThread?.chatbot?.name}
</span>{' '}
to continue
<button
onClick={handleBotSelection}
onKeyDown={(e) => e.key === 'Enter' && handleBotSelection()}
role="button"
aria-label={`Select ${activeThread?.chatbot?.name} to continue`}
className={cn(
'backdrop-blur-[1px] font-semibold border border-[#27272A] rounded-[6px] absolute size-full top-0 left-0',
'flex justify-center items-center dark:bg-[#27272A80] text-2xl',
'cursor-pointer transition-all',
'hover:border-[#82e46a] hover:text-[#82e46a]'
)}
>
Select{' '}
<span className="mx-2 text-[#82e46a]">
{activeThread?.chatbot?.name}
</span>{' '}
to continue
</button>

Comment on lines +45 to +51
<Image
src={avatar}
alt={`${botName} avatar`}
height={64}
width={64}
className="object-cover rounded-full"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add image loading and error handling.

The Image component lacks loading and error handling properties.

  <Image
    src={avatar}
    alt={`${botName} avatar`}
    height={64}
    width={64}
-   className="object-cover rounded-full"
+   className="object-cover rounded-full transition-opacity"
+   loading="lazy"
+   onError={(e) => {
+     e.currentTarget.src = '/default-avatar.png'
+   }}
  />

Committable suggestion skipped: line range outside the PR's diff.

@@ -120,7 +60,7 @@ export default function ChatChatbotDetails() {
}

fetchData()
}, [activeCategory, activeChatbot, session?.user])
}, [activeCategory, activeChatbot])
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incomplete effect dependencies.

The effect's dependency array is missing session?.user, which was previously included. This might cause issues with data fetching when the session changes.

-  }, [activeCategory, activeChatbot])
+  }, [activeCategory, activeChatbot, session?.user])
📝 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
}, [activeCategory, activeChatbot])
}, [activeCategory, activeChatbot, session?.user])

Comment on lines +76 to +79
const handleFollow = () => {
// follow logic once ready goes here
console.log('Following:', botName)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider removing placeholder follow handler.

Since the PR's objective is to remove social following functionality, this placeholder handler should be removed.

-  const handleFollow = () => {
-    // follow logic once ready goes here
-    console.log('Following:', botName)
-  }

Also remove the onFollow prop from sharedProps:

   const sharedProps = {
     botName,
     avatar: activeChatbot?.avatar || randomChatbot?.avatar || '',
     description: activeChatbot?.description,
     threadCount: activeChatbot
       ? (activeChatbot?.threads?.length ?? 0)
       : threadNum,
     followersCount: 3200,
     isWelcomeView,
     categoryName,
-    onNewChat: handleNewChat,
-    onFollow: handleFollow
+    onNewChat: handleNewChat
   }
📝 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
const handleFollow = () => {
// follow logic once ready goes here
console.log('Following:', botName)
}
const sharedProps = {
botName,
avatar: activeChatbot?.avatar || randomChatbot?.avatar || '',
description: activeChatbot?.description,
threadCount: activeChatbot
? (activeChatbot?.threads?.length ?? 0)
: threadNum,
followersCount: 3200,
isWelcomeView,
categoryName,
onNewChat: handleNewChat
}

const sharedProps = {
botName,
avatar: activeChatbot?.avatar || randomChatbot?.avatar || '',
description: activeChatbot?.description,
threadCount: activeChatbot
? (activeChatbot?.threads?.length ?? 0)
: threadNum,
followersCount: followers.length || 0, // This nees to be changed once following feat is ready
followersCount: 3200, // This nees to be changed once following feat is ready
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Hardcoded follower count needs systematic revision

The hardcoded value 3200 is used consistently across multiple components:

  • chat-chatbot-details.tsx: Direct assignment with comment
  • browse-chatbot-desktop-details.tsx: Used in follower display
  • browse-chatbot-mobile-details.tsx: Used in follower display

Consider:

  1. Adding a more descriptive TODO comment (fixing typo "nees")
  2. Creating a shared constant for this temporary value
  3. Adding tracking issue reference in the TODO comment
🔗 Analysis chain

Hardcoded follower count needs revision.

Based on the retrieved learning from PR #324, the follower count is temporarily hardcoded as the following feature is under development. Consider adding a TODO comment to track this.

-    followersCount: 3200, // This nees to be changed once following feat is ready
+    followersCount: 3200, // TODO(following-feature): Update with actual follower count once the following feature is implemented
🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Search for follower-related hardcoded values and comments
rg -i "follower.*\d+" --type ts --type tsx -C 2

# Search for TODO comments related to following feature
rg -i "todo.*follow" --type ts --type tsx

# Search for following/follower functionality references
ast-grep --pattern 'followersCount: $_'

Length of output: 191


Script:

#!/bin/bash
# Add custom file types and search for follower-related values
rg --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -i "follower.*\d+" --type tsx --type ts -C 2

# Search for specific hardcoded value
rg --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' "3200" --type tsx --type ts -C 2

# Search for TODO comments related to following feature
rg --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -i "todo.*follow" --type tsx --type ts

# Search for following/follower functionality references
ast-grep --pattern 'followersCount: 3200'

Length of output: 3209

@AndlerRL
Copy link
Member

Closing PR. Reason: There is an updated PR version related to solve the same issue.

Related

@AndlerRL AndlerRL closed this Jan 24, 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.

2 participants