-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
Reviewer's Guide by SourceryThis 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 structureclassDiagram
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"
State diagram for the updated user profile picture upload flowstateDiagram-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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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
apps/masterbots.ai/app/globals.cssOops! 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. WalkthroughThis 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 Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this 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 suggestionDuplicate 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 whereactiveThread
exists butchatbot
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 haveisDevEnv
. 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
: Useimport 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
⛔ 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
fromuseSidebar
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 issueImprove effect dependency management.
The effect's dependency array is missing
setActiveThread
andsetIsOpenPopup
. 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
toMessageSquareIcon
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
// 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 |
There was a problem hiding this comment.
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:
- The
biome-ignore
comment lacks explanation for ignoring keyboard events. - The div should be a button for proper keyboard interaction.
- 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.
// 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> |
<Image | ||
src={avatar} | ||
alt={`${botName} avatar`} | ||
height={64} | ||
width={64} | ||
className="object-cover rounded-full" | ||
/> |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
}, [activeCategory, activeChatbot]) | |
}, [activeCategory, activeChatbot, session?.user]) |
const handleFollow = () => { | ||
// follow logic once ready goes here | ||
console.log('Following:', botName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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 |
There was a problem hiding this comment.
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 commentbrowse-chatbot-desktop-details.tsx
: Used in follower displaybrowse-chatbot-mobile-details.tsx
: Used in follower display
Consider:
- Adding a more descriptive TODO comment (fixing typo "nees")
- Creating a shared constant for this temporary value
- 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
Closing PR. Reason: There is an updated PR version related to solve the same issue. Related |
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
User Interface
Performance
Development
Routing