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

Shallow routing for category & chatbots for chat & profile page #313

Merged
merged 13 commits into from
Nov 28, 2024

Conversation

sheriffjimoh
Copy link
Contributor

@sheriffjimoh sheriffjimoh commented Nov 25, 2024

Summary by Sourcery

Enhancements:

  • Implement shallow routing for category and chatbot navigation, replacing full page reloads with history state updates.

Summary by CodeRabbit

  • New Features

    • Enhanced sidebar navigation with improved thread toggle functionality, reflecting the current thread view in the browser's history.
    • Streamlined navigation process for categories and chatbots, allowing for smoother user interactions without full page reloads.
    • Introduced flexible user identification in the user thread panel, improving thread fetching based on user context.
  • Bug Fixes

    • Improved logic for managing thread visibility and loading states, ensuring a more responsive user experience.
  • Documentation

    • Updated internal documentation to reflect new navigation parameters and methods for better developer understanding.

Copy link

vercel bot commented Nov 25, 2024

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 Nov 28, 2024 7:12pm

Copy link

sourcery-ai bot commented Nov 25, 2024

Reviewer's Guide by Sourcery

This PR implements shallow routing for category and chatbot navigation, replacing Next.js Link navigation with window.history.pushState() to update URLs without triggering full page reloads. The changes primarily affect the sidebar navigation and profile page components.

Sequence diagram for shallow routing in sidebar navigation

sequenceDiagram
    actor User
    participant SidebarLink
    participant Browser

    User->>SidebarLink: Click on category
    SidebarLink->>Browser: window.history.pushState({}, '', '/c/category-name')
    Note right of Browser: URL updated without page reload

    User->>SidebarLink: Click on chatbot
    SidebarLink->>Browser: window.history.pushState({}, '', '/c/category-name/chatbot-name')
    Note right of Browser: URL updated without page reload
Loading

Class diagram for updated SidebarLink component

classDiagram
    class SidebarLink {
        -category
        -isFilterMode
        -page
        +setActiveCategory()
        +setActiveChatbot()
        +window.history.pushState()
    }
    note for SidebarLink "Replaced router.push with window.history.pushState for shallow routing"
Loading

Class diagram for updated ProfileSidebar component

classDiagram
    class ProfileSidebar {
        +handleToggleThreads()
        +window.history.pushState()
    }
    note for ProfileSidebar "Added handleToggleThreads to manage thread state and URL"
Loading

File-Level Changes

Change Details Files
Implemented shallow routing for category selection
  • Replaced router.push() with window.history.pushState()
  • Added URL updates for both category selection and deselection
  • Modified Link href to '#' to prevent default navigation
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx
Added shallow routing for chatbot selection
  • Implemented URL updates using window.history.pushState() when selecting chatbots
  • Disabled default Link navigation behavior
  • Updated URL structure to reflect selected chatbot
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx
Updated profile page navigation behavior
  • Added handleToggleThreads function for thread navigation
  • Implemented shallow routing for thread toggle
  • Modified thread panel behavior conditions
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx
apps/masterbots.ai/components/routes/thread/user-thread-panel.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
Contributor

coderabbitai bot commented Nov 25, 2024

Walkthrough

The changes introduce enhancements to the sidebar and thread components in the application. A new function handleToggleThreads is added to the ProfileSidebar to manage thread toggling and update browser history. The SidebarLink component is modified to use a centralized navigateTo function for navigation, improving state management. Additionally, the UserThreadPanel component's control flow is updated to allow for more responsive thread fetching based on user identification. Overall, the modifications streamline navigation and user interactions across the sidebar and thread functionalities.

Changes

File Path Change Summary
apps/masterbots.ai/components/layout/profile/... Introduced handleToggleThreads in ProfileSidebar to manage thread toggling and update browser history.
apps/masterbots.ai/components/layout/sidebar/... Updated SidebarLink and ChatbotComponent to use a new navigateTo function for structured navigation. Simplified active chatbot state management.
apps/masterbots.ai/components/routes/thread/... Updated UserThreadPanel to include an optional slug parameter and added fetchBrowseThreads for flexible thread fetching.
apps/masterbots.ai/lib/hooks/use-sidebar.tsx Added NavigationParams interface and navigateTo method in SidebarContext for improved navigation handling.

Possibly related issues

Possibly related PRs

  • Add chat publicity trigger #258: The changes in this PR involve the SidebarLink component, which is related to the sidebar's functionality and state management, similar to the updates made in the ProfileSidebar component in the main PR.
  • Hotfix: Infinite loop Issue #261: This PR modifies the ChatAccordion and ChatList components, which are part of the sidebar's interaction and state management, aligning with the changes made in the main PR regarding sidebar state handling.
  • feat(masterbots.ai): chat sidebar filtering #264: This PR introduces chat sidebar filtering, which directly relates to the sidebar's functionality and state management, similar to the updates in the main PR.
  • fix:sideBar updating URL #286: The modifications in this PR enhance the SidebarLink component's functionality, which is closely related to the changes made in the ProfileSidebar component in the main PR.
  • feat: reorganize navigation menu for mobile view #298: This PR reorganizes the navigation menu, which includes the sidebar components, thus connecting it to the changes made in the main PR regarding sidebar functionality.
  • [masterbots.ai] Fix: browse and chat content search #304: The updates in this PR enhance the search functionality within the browsing experience, which relates to the overall user interaction improvements made in the main PR.
  • Improve seo sitemap #306: This PR focuses on improving the SEO sitemap, which indirectly relates to the overall structure and functionality of the application, including the sidebar updates in the main PR.

Suggested labels

enhancement, feature

Suggested reviewers

  • AndlerRL

🐇 In the sidebar, we now toggle with ease,
Updating threads brings joy like a breeze.
History flows without a hitch,
Navigation's smooth, no need to switch.
So hop along, let’s navigate bright,
With threads in view, everything feels right! 🌟

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/components/layout/profile/profile-page-sidebar.tsx

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.


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

@sheriffjimoh sheriffjimoh changed the title Shallow routing for category & chatbots Shallow routing for category & chatbots[WIP] ⚠️ Nov 25, 2024
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 @sheriffjimoh - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using Next.js's built-in shallow routing (router.push(url, undefined, { shallow: true })) instead of direct window.history manipulation for better integration with Next.js's features
  • Avoid using href='#' in Link components - maintain real URLs for proper browser functionality (new tabs, bookmarks) and accessibility
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 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.

@sheriffjimoh sheriffjimoh changed the title Shallow routing for category & chatbots[WIP] ⚠️ Shallow routing for category & chatbots for chat & profile page [WIP] ⚠️ Nov 25, 2024
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: 6

🧹 Outside diff range and nitpick comments (1)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (1)

120-123: Consider implementing debouncing for thread fetches

The current implementation might trigger multiple rapid API calls as state changes. Consider implementing debouncing to optimize performance.

Here's a suggested implementation using a debounce utility:

import { debounce } from 'lodash'

// At the top of the component
const debouncedThreadsChange = useMemo(
  () => debounce(handleThreadsChange, 300),
  [handleThreadsChange]
)

// In the useEffect
useEffect(() => {
  if (!isOpenPopup && (activeCategory !== undefined || activeChatbot !== undefined)) {
    debouncedThreadsChange()
  }
  
  return () => {
    debouncedThreadsChange.cancel()
  }
}, [activeCategory, activeChatbot, isOpenPopup, debouncedThreadsChange])
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c4a500c and 9741806.

📒 Files selected for processing (3)
  • apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (2 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (4 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (1 hunks)
🧰 Additional context used
📓 Learnings (1)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (2)
Learnt from: AndlerRL
PR: bitcashorg/masterbots#300
File: apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx:120-123
Timestamp: 2024-11-20T04:00:45.413Z
Learning: In React code, when reviewing `useEffect` dependencies, it's not always necessary to add functions like `handleThreadsChange` to the dependency array, as this may lead to unnecessary re-renders and performance issues. Only include dependencies that are essential and may change.
Learnt from: AndlerRL
PR: bitcashorg/masterbots#287
File: apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx:39-45
Timestamp: 2024-11-12T03:32:08.432Z
Learning: In the `UserThreadPanel` component (`apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx`), the `count` state variable is used in the `loadMore` function and depends on `finalThreads.length`, so updating `count` in the `useEffect` is necessary.
🔇 Additional comments (4)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (1)

31-31: LGTM!

The sameUser variable is correctly computed using the isSameUser helper function with proper null checking.

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

120-123: ⚠️ Potential issue

Fix the condition logic and dependencies in useEffect

The current implementation has several issues:

  1. The condition !isOpenPopup || activeCategory || activeChatbot will trigger handleThreadsChange too frequently because:
    • It uses OR (||) operators, making it true in most cases
    • activeCategory and activeChatbot are evaluated as truthy/falsy
  2. The page dependency is unused in the condition

Apply this diff to fix the logic:

- if( !isOpenPopup || activeCategory || activeChatbot) {
-   handleThreadsChange()
- } }
- , [activeCategory, activeChatbot, isOpenPopup, page])
+ if (!isOpenPopup && (activeCategory !== undefined || activeChatbot !== undefined)) {
+   handleThreadsChange()
+ }
+ }, [activeCategory, activeChatbot, isOpenPopup])

Let's verify the impact of these changes on thread fetching:

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

238-239: ⚠️ Potential issue

Restore proper href for chatbot links

Same accessibility concerns as mentioned in the category link review above.

Apply the same fix using the proper URL:

- href="#"
- // href={ page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`: `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`}
+ href={buildChatbotUrl(category.name, chatbot.name, page, slug)}

Line range hint 1-255: Verify security and optimize performance

A few additional considerations for the implementation:

  1. Ensure toSlug properly sanitizes input to prevent XSS
  2. Consider memoizing slug generation for frequently accessed values

Let's verify the security of the URL construction:

✅ Verification successful

Let me gather more information about the toSlug implementation to verify its security:


Let me check the URL sanitization utilities found:


Let me check the implementation of toSlug from the mb-lib package:


Let me check the actual implementation of the text utilities in mb-lib:


URL construction is secure but performance can be improved

The implementation is safe as:

  1. The toSlug function properly sanitizes input by:
    • Converting to lowercase
    • Removing special characters
    • Only allowing alphanumeric and hyphen characters
    • Using proper string replacement patterns

However, performance optimizations are recommended:

  • Memoize the slug generation for category names since they're used multiple times in the component
  • Consider moving the URL construction logic to a dedicated utility function to avoid repetition

Example refactor:

const categorySlug = useMemo(() => toSlug(category.name.toLowerCase()), [category.name]);
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of toSlug to ensure consistent security measures
rg "toSlug\(" --type typescript

# Check for potential XSS vulnerabilities in URL construction
ast-grep --pattern 'window.history.pushState($_, $_, $_)'

Length of output: 3052


Script:

#!/bin/bash
# Search for toSlug implementation
fd -e ts -e js toSlug
cat $(fd -e ts -e js toSlug)

# Search for any URL sanitization utilities
rg -g '*.{ts,js}' -l "sanitize|escape|encodeURI"

Length of output: 180


Script:

#!/bin/bash
# Check URL sanitization implementation
cat apps/masterbots.ai/lib/url.ts

# Check if toSlug is imported from an external package
rg -g '*.{ts,js}' "from 'mb-lib'" -A 3

Length of output: 5879


Script:

#!/bin/bash
# Check package contents for mb-lib
fd -e ts -e js -p "packages/mb-lib" "toSlug"
cat $(fd -e ts -e js -p "packages/mb-lib" "toSlug")

# Check for any URL-related utilities in mb-lib
rg -g '*.{ts,js}' "url|slug" packages/mb-lib

Length of output: 870


Script:

#!/bin/bash
# Check the implementation of text utilities including toSlug
cat packages/mb-lib/src/text/text.lib.ts

# Also check if there are any tests for the slug functionality
fd -e test.ts -e spec.ts -p "packages/mb-lib" "text"

Length of output: 1473

Comment on lines 71 to 72
href="#"
onClick={handleToggleThreads}
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 link semantics and accessibility

Using "#" as href is not semantic and could affect SEO and accessibility.

Consider this improvement:

-  href="#"
+  href={`/u/${slug}/t`}
   onClick={handleToggleThreads}
+  role="button"
+  aria-expanded={isThreadsOpen}

This maintains proper semantics while still using your custom navigation logic. The aria-expanded attribute helps screen readers understand the current state.

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

Comment on lines 189 to 200
else {
setActiveChatbot(chatbot)
if(chatbot){
window.history.pushState(
{},
'',
page === 'profile'
? `/u/${slug}/t/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`
: `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`
)
}
}
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

Handle edge cases and improve state management

The current implementation has potential issues with state management and error handling:

  1. Possible race condition between state update and navigation
  2. No error handling for invalid chatbot names
  3. Duplicated URL construction logic

Consider this improved implementation:

- else {
-   setActiveChatbot(chatbot)
-   if(chatbot){
-     window.history.pushState(
-       {}, 
-       '', 
-       page === 'profile' 
-         ? `/u/${slug}/t/${toSlug(category.name)}/${chatbot.name.toLowerCase()}` 
-         : `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`
-     )
-   }
- }
+ else {
+   try {
+     if (!chatbot?.name) {
+       throw new Error('Invalid chatbot data')
+     }
+     
+     const url = buildChatbotUrl(category.name, chatbot.name, page, slug)
+     
+     // Batch state updates
+     Promise.resolve().then(() => {
+       setActiveChatbot(chatbot)
+       window.history.pushState({}, '', url)
+     })
+   } catch (error) {
+     console.error('Navigation failed:', error)
+     // Optionally show user feedback
+   }
+ }

Add this utility function to your shared utilities:

const buildChatbotUrl = (
  categoryName: string,
  chatbotName: string,
  page?: string,
  slug?: string
) => {
  return page === 'profile'
    ? `/u/${slug}/t/${toSlug(categoryName)}/${chatbotName.toLowerCase()}`
    : `/c/${toSlug(categoryName)}/${chatbotName.toLowerCase()}`
}

Comment on lines 149 to 150
href="#"
// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
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

Restore proper href for accessibility and UX

Using href="#" reduces accessibility and prevents users from:

  • Opening links in new tabs
  • Using right-click context menu options
  • Copying link addresses

Keep the proper URL in the href while still using pushState for navigation:

- href="#"
- //  href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
+ href={buildCategoryUrl(category.name, page, slug)}

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

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: 3

🧹 Outside diff range and nitpick comments (7)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (3)

54-64: Fix inconsistent spacing in object parameters

The object parameters passed to navigateTo have inconsistent spacing around the colon.

  navigateTo({
-   page,
-   slug: slug  as string,
-   categoryName: toSlug(category.name.toLowerCase())
+   page,
+   slug: slug as string,
+   categoryName: toSlug(category.name.toLowerCase())
  })

Line range hint 43-68: Update useCallback dependencies

The handleClickCategory callback is missing some dependencies and includes unnecessary ones.

  }, [
    category.categoryId,
    category.name,
    setActiveCategory,
    setExpandedCategories,
    setActiveChatbot,
-   router,
-   isFilterMode,
-   isBrowse
+   isFilterMode,
+   navigateTo,
+   page,
+   slug
  ])

181-190: Simplify handleChatbotClick implementation

The current implementation has unnecessary nesting and conditional checks.

- e.preventDefault()
- setActiveChatbot(chatbot)
- if(chatbot){
-   navigateTo({
-     page,
-     slug: slug as string,
-     categoryName: toSlug(category.name.toLowerCase()),
-     chatbotName: chatbot.name.toLowerCase()
-   })
- }
+ setActiveChatbot(chatbot)
+ navigateTo({
+   page,
+   slug: slug as string,
+   categoryName: toSlug(category.name.toLowerCase()),
+   chatbotName: chatbot.name.toLowerCase()
+ })
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (3)

57-57: Consider enhancing error handling in user fetching

The user fetching logic is well-implemented, but could benefit from explicit error handling and loading states for better user experience.

Consider adding error state management:

 const userWithSlug = useAsync(async () => {
   if (!slug) return { user: null }
   const result = await getUserBySlug({
     slug,
     isSameUser: session?.user?.slug === slug
   })
   return result
-}, [])
+}, [slug, session?.user?.slug])
+
+useEffect(() => {
+  if (userWithSlug.error) {
+    console.error('Failed to fetch user:', userWithSlug.error);
+    // Handle error state (e.g., show error message)
+  }
+}, [userWithSlug.error]);

Also applies to: 64-74


115-131: Enhance type safety and error handling in fetchBrowseThreads

While the function is well-structured, it could benefit from improved type safety and error handling.

Consider these improvements:

-  const fetchBrowseThreads = async () => {
+  const fetchBrowseThreads = async (): Promise<Thread[]> => {
     try {
-      if(!slug) return []
+      if (!slug) {
+        console.debug('No slug provided for thread browsing');
+        return [];
+      }
       const user = userWithSlug.value?.user
-      if (!user) return []
+      if (!user) {
+        console.debug('No user found for slug:', slug);
+        return [];
+      }
       return await getBrowseThreads({ 
         userId: user.userId, 
         categoryId: activeCategory,
         chatbotName: activeChatbot?.name,
         limit: PAGE_SIZE,
       });
     } catch (error) {
-      console.error('Failed to fetch threads:', error);
+      console.error('Failed to fetch threads:', error instanceof Error ? error.message : error);
       return [];
     }
   };

134-145: Simplify handleThreadsChange control flow

The function handles both authenticated and unauthenticated cases well, but the control flow could be simplified.

Consider this restructuring:

 const handleThreadsChange = async () => {
-  let threads: Thread[] = []
   setLoading(true)
+  const currentFetchId = Date.now()
+  fetchIdRef.current = currentFetchId
+
+  try {
+    const threads = !session?.user && page === 'profile'
+      ? await fetchBrowseThreads()
+      : session?.user
+        ? await getThreads({
+            jwt: session.user.hasuraJwt,
+            userId: session.user.id,
+            limit: PAGE_SIZE,
+            categoryId: activeCategory,
+            chatbotName: activeChatbot?.name
+          })
+        : [];
+
+    if (fetchIdRef.current === currentFetchId) {
+      setThreads(threads);
+      setCount(threads.length);
+      setTotalThreads(threads.length);
+    }
+  } catch (error) {
+    console.error('Failed to fetch threads:', error);
+  } finally {
+    setLoading(false);
+  }
-  if (!session?.user) {
-    if(page === 'profile') {
-      threads = await fetchBrowseThreads();
-      setThreads(_prev => threads ?? [])
-      setCount(_prev => threads.length ?? 0)
-      setTotalThreads(threads?.length ?? 0)
-    }
-    setLoading(false)
-    return;
-  }
-  // ... rest of the function
 }
apps/masterbots.ai/lib/hooks/use-sidebar.tsx (1)

183-205: Consider adding navigation event handling and testing.

To improve the robustness of the navigation system:

  1. Add event handling for navigation state changes
  2. Implement navigation interceptors for analytics or route guards
  3. Add unit tests for URL construction and navigation logic
  4. Consider adding integration tests for the complete navigation flow

Example test cases should cover:

  • URL construction with various parameter combinations
  • History state management
  • Error scenarios
  • Integration with React Router or Next.js routing

Would you like me to provide example test cases or implementation details for any of these suggestions?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9741806 and 0e1c3ce.

📒 Files selected for processing (3)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (5 hunks)
  • apps/masterbots.ai/lib/hooks/use-sidebar.tsx (4 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 180-180: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 180-180: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 180-180: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 180-180: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 180-180: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

[error] 102-102: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 103-103: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)

🔇 Additional comments (5)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (1)

54-64: Consider implementing popstate handler for browser navigation

The implementation of navigateTo should handle browser back/forward navigation events as mentioned in a previous review comment.

Also applies to: 181-190

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

35-35: LGTM: Import additions support new functionality

The new imports are well-organized and necessary for implementing unauthenticated thread viewing capability.

Also applies to: 40-41


168-171: LGTM: Effect dependencies are properly configured

The useEffect dependencies and conditions are correctly implemented to trigger thread changes based on relevant state updates.

apps/masterbots.ai/lib/hooks/use-sidebar.tsx (2)

12-17: LGTM! Well-structured interface definition.

The NavigationParams interface is well-defined with clear optional and required parameters, following TypeScript best practices.


237-237: LGTM! Clean context update.

The addition of navigateTo to the context provider value is clean and maintains consistency with the existing structure.

Comment on lines 184 to 205
const buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): string => {
const base = page === 'profile' ? `/u/${slug}/t` : '/c'
const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
return `${base}${categoryPath}${chatbotPath}`
}


const navigateTo = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): void => {
const url = buildNavigationUrl({ page, slug, categoryName, chatbotName })
window.history.pushState({}, '', url)
}
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

Add input validation and error handling for navigation.

The navigation implementation has several potential issues that should be addressed:

  1. Add parameter validation before URL construction
  2. Handle special characters and invalid slugs
  3. Add browser context check before using window.history
  4. Sanitize user input for URL safety

Consider applying these improvements:

 const buildNavigationUrl = ({
   page,
   slug,
   categoryName,
   chatbotName
 }: NavigationParams): string => {
+  if (!page || !slug) {
+    throw new Error('Page and slug are required parameters');
+  }
+
+  const sanitizeUrlPart = (part: string): string => {
+    return encodeURIComponent(part.toLowerCase());
+  };
+
   const base = page === 'profile' ? `/u/${slug}/t` : '/c'
-  const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
-  const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
+  const categoryPath = categoryName ? `/${sanitizeUrlPart(toSlug(categoryName))}` : ''
+  const chatbotPath = chatbotName ? `/${sanitizeUrlPart(chatbotName)}` : ''
   return `${base}${categoryPath}${chatbotPath}`
 }

 const navigateTo = ({
   page,
   slug,
   categoryName,
   chatbotName
 }: NavigationParams): void => {
+  if (typeof window === 'undefined') {
+    return;
+  }
+
   const url = buildNavigationUrl({ page, slug, categoryName, chatbotName })
   window.history.pushState({}, '', url)
 }
📝 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 buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): string => {
const base = page === 'profile' ? `/u/${slug}/t` : '/c'
const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
return `${base}${categoryPath}${chatbotPath}`
}
const navigateTo = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): void => {
const url = buildNavigationUrl({ page, slug, categoryName, chatbotName })
window.history.pushState({}, '', url)
}
const buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): string => {
if (!page || !slug) {
throw new Error('Page and slug are required parameters');
}
const sanitizeUrlPart = (part: string): string => {
return encodeURIComponent(part.toLowerCase());
};
const base = page === 'profile' ? `/u/${slug}/t` : '/c'
const categoryPath = categoryName ? `/${sanitizeUrlPart(toSlug(categoryName))}` : ''
const chatbotPath = chatbotName ? `/${sanitizeUrlPart(chatbotName)}` : ''
return `${base}${categoryPath}${chatbotPath}`
}
const navigateTo = ({
page,
slug,
categoryName,
chatbotName
}: NavigationParams): void => {
if (typeof window === 'undefined') {
return;
}
const url = buildNavigationUrl({ page, slug, categoryName, chatbotName })
window.history.pushState({}, '', url)
}

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: 3

🧹 Outside diff range and nitpick comments (6)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (5)

57-57: Consider handling loading state for user data

While the user fetching logic is well-implemented, consider handling the loading state from useAsync to show appropriate UI feedback during user data fetching.

+ const [userLoading, setUserLoading] = useState(true)
  const userWithSlug = useAsync(async () => {
    if (!slug) return { user: null }
    const result = await getUserBySlug({
      slug,
      isSameUser: session?.user?.slug === slug
    })
+   setUserLoading(false)
    return result
  }, [slug])

Also applies to: 64-74


90-106: Enhance error handling specificity

While error handling is present, consider implementing more specific error handling to better manage different types of failures (network, validation, etc.).

 const fetchBrowseThreads = async () => {
   try {
     if(!slug) return []
     const user = userWithSlug.value?.user
     if (!user) return []
     return await getBrowseThreads({ 
       userId: user.userId, 
       categoryId: activeCategory,
       chatbotName: activeChatbot?.name,
       limit: PAGE_SIZE,
     });
   } catch (error) {
-    console.error('Failed to fetch threads:', error);
+    if (error instanceof NetworkError) {
+      console.error('Network error while fetching threads:', error);
+    } else if (error instanceof ValidationError) {
+      console.error('Invalid data while fetching threads:', error);
+    } else {
+      console.error('Unexpected error while fetching threads:', error);
+    }
     return [];
   }
 };

131-143: Consider extracting profile-specific logic

The function handles multiple responsibilities. Consider extracting the profile-specific logic into a separate function for better maintainability.

+ const handleProfileThreads = async () => {
+   if(page === 'profile') {
+     const threads = await fetchBrowseThreads();
+     setThreads(_prev => threads ?? [])
+     setCount(_prev => threads.length ?? 0)
+     setTotalThreads(threads?.length ?? 0)
+   }
+ }

  const handleThreadsChange = async () => {
    let threads: Thread[] = []
    setLoading(true)
    const isOwnProfile = session?.user?.slug === slug;
    if (!session?.user || !isOwnProfile) {
-     if(page === 'profile') {
-       threads = await fetchBrowseThreads();
-       setThreads(_prev => threads ?? [])
-       setCount(_prev => threads.length ?? 0)
-       setTotalThreads(threads?.length ?? 0)
-     }
+     await handleProfileThreads();
      setLoading(false)
      return;
    }
    // ... rest of the function

166-166: Improve effect hook condition readability

The current condition is hard to parse. Consider restructuring it for better readability.

- if(!isOpenPopup && activeCategory || activeChatbot) {
+ if((!isOpenPopup && activeCategory) || activeChatbot) {

Line range hint 1-224: Consider splitting into smaller components

The component has grown to handle multiple responsibilities including:

  • Thread fetching and management
  • User profile handling
  • Search functionality
  • UI rendering

Consider splitting this into smaller, more focused components:

  • ThreadManager (handling thread state and operations)
  • ThreadView (handling UI rendering)
  • UserProfileThreads (handling profile-specific logic)

Would you like assistance in planning this refactoring?

🧰 Tools
🪛 Biome (1.9.4)

[error] 117-117: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 118-118: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 148-148: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 149-149: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)

apps/masterbots.ai/lib/hooks/use-sidebar.tsx (1)

12-17: Add documentation and strengthen type safety.

Consider adding JSDoc documentation and making the interface more type-safe:

+/**
+ * Parameters for navigation within the application
+ * @property {string} page - The target page ('profile' or other)
+ * @property {string} slug - User or category identifier
+ * @property {string} [categoryName] - Optional category name for filtering
+ * @property {string} [chatbotName] - Optional chatbot name for filtering
+ */
 interface NavigationParams {
-  page: string | undefined
-  slug: string | undefined
+  page: 'profile' | 'category'  // Limit to valid page types
+  slug: string
   categoryName?: string
   chatbotName?: string
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1c3ce and 4002dc8.

📒 Files selected for processing (4)
  • apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (1 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (5 hunks)
  • apps/masterbots.ai/lib/hooks/use-sidebar.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 174-174: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 174-174: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 174-174: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 174-174: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 174-174: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

[error] 117-117: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 118-118: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)

🔇 Additional comments (4)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (2)

35-35: LGTM: Import additions align with new functionality

The new imports support the added features for browsing threads and user profile handling.

Also applies to: 40-41


113-124: ⚠️ Potential issue

Fix unsafe non-null assertions in thread loading

The thread loading logic contains unsafe non-null assertions that could lead to runtime errors.

Apply this fix to handle potential null values safely:

 if(page === 'profile' && !session?.user) {
   moreThreads = await fetchBrowseThreads();
 } else {
   moreThreads = await getThreads({
-    jwt: session!.user?.hasuraJwt,
-    userId: session!.user.id,
+    jwt: session?.user?.hasuraJwt,
+    userId: session?.user?.id,
     offset: threads.length,
     limit: PAGE_SIZE,
     categoryId: activeCategory,
     chatbotName: activeChatbot?.name
   })
 }
🧰 Tools
🪛 Biome (1.9.4)

[error] 117-117: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 118-118: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)

apps/masterbots.ai/lib/hooks/use-sidebar.tsx (2)

242-242: LGTM!

The addition of navigateTo to the context value is correct and properly integrated.


184-210: ⚠️ Potential issue

Add security measures and error handling to navigation.

The current implementation needs several security and reliability improvements:

 const buildNavigationUrl = ({
   page,
   slug,
   categoryName,
   chatbotName
 }: NavigationParams): string => {
+  // Validate required parameters
+  if (!page || !slug) {
+    throw new Error('Page and slug are required for navigation');
+  }
+
+  // Sanitize inputs to prevent XSS
+  const sanitizeUrlPart = (part: string): string => {
+    return encodeURIComponent(part.trim().toLowerCase());
+  };
+
+  // Validate page type
+  if (!['profile', 'category'].includes(page)) {
+    throw new Error('Invalid page type');
+  }
+
   const base = page === 'profile' ? `/u/${slug}/t` : '/c'

   if (!categoryName && !chatbotName) {
     return base
   }

-  const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
-  const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
+  const categoryPath = categoryName ? `/${sanitizeUrlPart(toSlug(categoryName))}` : ''
+  const chatbotPath = chatbotName ? `/${sanitizeUrlPart(chatbotName)}` : ''
   return `${base}${categoryPath}${chatbotPath}`
 }

 const navigateTo = ({
   page,
   slug,
   categoryName,
   chatbotName
 }: NavigationParams): void => {
+  try {
+    // Check if we're in a browser environment
+    if (typeof window === 'undefined') {
+      throw new Error('Navigation is only available in browser environment');
+    }
+
     const url = buildNavigationUrl({ page, slug, categoryName, chatbotName })
     window.history.pushState({}, '', url)
+  } catch (error) {
+    console.error('Navigation failed:', error);
+    // Consider adding error reporting or user notification here
+  }
 }

Let's verify the usage of these navigation functions across the codebase:

@@ -129,7 +134,7 @@ export default function SidebarLink({ category, isFilterMode, page }: SidebarLin
return (
<div className={cn('flex flex-col mb-2')}>
<Link
href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
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

Extract URL construction logic

The URL construction is duplicated in multiple places. This should be centralized into a utility function.

Create a utility function in a shared location:

// utils/url.ts
export const buildUrl = (params: {
  page?: string;
  slug?: string;
  categoryName: string;
  chatbotName?: string;
}) => {
  const { page, slug, categoryName, chatbotName } = params;
  const base = page === 'profile' ? `/u/${slug}/t` : '/c';
  const category = `/${toSlug(categoryName.toLowerCase())}`;
  const chatbot = chatbotName ? `/${chatbotName.toLowerCase()}` : '';
  return `${base}${category}${chatbot}`;
};

Then update the Link components:

- href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
+ href={buildUrl({ page, slug, categoryName: category.name })}

- href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`: `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`}
+ href={buildUrl({ page, slug, categoryName: category.name, chatbotName: chatbot.name })}

Also applies to: 222-222

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

🧹 Outside diff range and nitpick comments (6)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (1)

22-23: Improve formatting consistency

The destructuring statement could be more concise and consistent with common JavaScript formatting practices.

-  const { isSidebarOpen,  toggleSidebar, setActiveCategory,
-    setActiveChatbot, } = useSidebar();
+  const { 
+    isSidebarOpen, 
+    toggleSidebar, 
+    setActiveCategory,
+    setActiveChatbot 
+  } = useSidebar();
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (1)

56-56: Remove debug console.log statement

Debug console.log statements should not be committed to production code.

- console.log("the isBrowse::",isBrowse)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (2)

57-57: Add type definition for the page parameter

The page parameter should have its possible values defined using a string literal type for better type safety.

  page?: string
+  page?: 'profile' | 'chat' // Add other valid page values

Also applies to: 64-65


66-74: Consider handling loading state for user data fetching

The useAsync hook provides loading and error states that could be utilized to improve the user experience.

- const userWithSlug = useAsync(async () => {
+ const { loading: userLoading, error: userError, value: userWithSlug } = useAsync(async () => {
   if (!slug) return { user: null }
   const result = await getUserBySlug({
     slug,
     isSameUser: session?.user?.slug === slug
   })
   return result
 }, [slug])
apps/masterbots.ai/lib/hooks/use-sidebar.tsx (2)

12-18: LGTM with a minor suggestion for type safety

The interface definitions are well-structured. Consider using a union type for the page parameter to restrict it to valid values.

 interface NavigationParams {
-  page: string | undefined
+  page: 'profile' | 'community' | undefined
   slug: string | undefined
   categoryName?: string
   chatbotName?: string
   isBrowse?: boolean
 }

Also applies to: 45-45


185-187: Remove debug console.log statements

Remove the console.log statements as they shouldn't be in production code.

-    console.log({
-      isBrowse
-    })

Also applies to: 212-214

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4002dc8 and fa6a7f7.

📒 Files selected for processing (4)
  • apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (3 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (5 hunks)
  • apps/masterbots.ai/lib/hooks/use-sidebar.tsx (4 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 186-186: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 186-186: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 186-186: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 186-186: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 186-186: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

[error] 117-117: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 118-118: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 173-173: This hook does not specify all of its dependencies: handleThreadsChange

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

🔇 Additional comments (7)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (1)

33-37: Verify state management across component boundaries

The changes to thread toggle behavior and state management could affect other components that rely on this state.

Also applies to: 74-74

✅ Verification successful

State management changes are properly contained within the component hierarchy

The search results show that the state management is well-structured and the changes are safe:

  • isThreadsOpen and its setter are only used within profile-page-sidebar.tsx
  • setActiveCategory and setActiveChatbot are part of a shared sidebar context (use-sidebar.tsx) and are properly managed through the context's API
  • The handleToggleThreads function is locally scoped and only used within the same component

The state reset behavior in handleToggleThreads follows the existing pattern used elsewhere in the codebase, where category and chatbot states are cleared together during navigation changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for components that might be affected by thread state changes

echo "Checking for components using thread state..."
rg -A 5 "isThreadsOpen|setIsThreadsOpen" --type=tsx

echo "Checking for components using category/chatbot state..."
rg -A 5 "setActiveCategory|setActiveChatbot" --type=tsx

echo "Checking for other navigation handlers..."
rg -A 5 "handleToggleThreads|toggleThread" --type=tsx

Length of output: 566


Script:

#!/bin/bash
# Check for components that might be affected by thread state changes, using correct file type

echo "Checking for components using thread state..."
rg -A 5 "isThreadsOpen|setIsThreadsOpen" --type=typescript

echo "Checking for components using category/chatbot state..."
rg -A 5 "setActiveCategory|setActiveChatbot" --type=typescript

echo "Checking for other navigation handlers..."
rg -A 5 "handleToggleThreads|toggleThread" --type=typescript

Length of output: 608


Script:

#!/bin/bash
# Search without specifying file type, as the environment might not recognize typescript/tsx extensions

echo "Checking for components using thread state..."
rg -A 5 "isThreadsOpen|setIsThreadsOpen"

echo "Checking for components using category/chatbot state..."
rg -A 5 "setActiveCategory|setActiveChatbot"

echo "Checking for other navigation handlers..."
rg -A 5 "handleToggleThreads|toggleThread"

Length of output: 15535

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

35-35: LGTM: Import additions align with new functionality

The new imports support the added functionality for browsing threads and handling user slugs.

Also applies to: 40-41


90-106: LGTM: Well-implemented thread fetching with proper error handling

The fetchBrowseThreads function includes proper error handling and null checks.


170-172: LGTM: Good use of refs for tracking previous values

Using refs to track previous values is a good pattern for comparing state changes.


113-124: ⚠️ Potential issue

Replace non-null assertions with optional chaining

The non-null assertions (!.) should be replaced with optional chaining (?.) for better type safety.

Apply this fix:

- jwt: session!.user?.hasuraJwt,
- userId: session!.user.id,
+ jwt: session?.user?.hasuraJwt,
+ userId: session?.user?.id,

Also applies to: 147-152

🧰 Tools
🪛 Biome (1.9.4)

[error] 117-117: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 118-118: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


173-192: ⚠️ Potential issue

Add missing dependency to useEffect

The effect hook is missing handleThreadsChange in its dependency array.

- }, [activeCategory, activeChatbot, isOpenPopup]);
+ }, [activeCategory, activeChatbot, isOpenPopup, handleThreadsChange]);

Consider wrapping handleThreadsChange with useCallback to prevent infinite loops:

const handleThreadsChange = useCallback(async () => {
  // existing implementation
}, [session, activeCategory, activeChatbot, page, slug]);
⛔ Skipped due to learnings
Learnt from: AndlerRL
PR: bitcashorg/masterbots#300
File: apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx:120-123
Timestamp: 2024-11-20T04:00:45.413Z
Learning: In React code, when reviewing `useEffect` dependencies, it's not always necessary to add functions like `handleThreadsChange` to the dependency array, as this may lead to unnecessary re-renders and performance issues. Only include dependencies that are essential and may change.
🧰 Tools
🪛 Biome (1.9.4)

[error] 173-173: This hook does not specify all of its dependencies: handleThreadsChange

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

apps/masterbots.ai/lib/hooks/use-sidebar.tsx (1)

266-266: LGTM!

The addition of navigateTo to the context value is correct and consistent with the interface definition.

Comment on lines 54 to 71
if (newCategory) {
setActiveChatbot(null)
router.push( page === 'profile' ? `/u/${slug}/t/${toSlug(category.name.toLowerCase())}` :`/c/${toSlug(category.name.toLowerCase())}`)
}
console.log("the isBrowse::",isBrowse)
navigateTo({
page,
slug: slug as string,
categoryName: toSlug(category.name.toLowerCase()),
isBrowse
})

}else{
setActiveChatbot(null)
navigateTo({
page,
slug: slug as string,
isBrowse
})
}
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

Refactor category navigation logic

The code has several issues:

  1. Unsafe type assertion for slug
  2. Duplicate setActiveChatbot(null) calls
  3. Redundant else block with similar navigation logic

Consider this improved implementation:

  if (newCategory) {
    setActiveChatbot(null)
-   console.log("the isBrowse::",isBrowse)
    navigateTo({
      page,
-     slug: slug as string,
+     slug: typeof slug === 'string' ? slug : undefined,
      categoryName: toSlug(category.name.toLowerCase()),
      isBrowse
    })
- }else{
-   setActiveChatbot(null)
-   navigateTo({
-     page,
-     slug: slug as string,
-     isBrowse
-   })
+ } else {
+   navigateTo({
+     page,
+     slug: typeof slug === 'string' ? slug : undefined,
+     isBrowse
+   })
  }
📝 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
if (newCategory) {
setActiveChatbot(null)
router.push( page === 'profile' ? `/u/${slug}/t/${toSlug(category.name.toLowerCase())}` :`/c/${toSlug(category.name.toLowerCase())}`)
}
console.log("the isBrowse::",isBrowse)
navigateTo({
page,
slug: slug as string,
categoryName: toSlug(category.name.toLowerCase()),
isBrowse
})
}else{
setActiveChatbot(null)
navigateTo({
page,
slug: slug as string,
isBrowse
})
}
if (newCategory) {
setActiveChatbot(null)
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined,
categoryName: toSlug(category.name.toLowerCase()),
isBrowse
})
} else {
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined,
isBrowse
})
}

Comment on lines 184 to 203
const getBasePath = ({ page, slug, isBrowse }: NavigationParams) => {
console.log({
isBrowse
})
// Handle browse page first
if (isBrowse) {
return '';
}

// Handle profile page
if (page === 'profile') {
return `/u/${slug}/t`;
}

// Default to community path
const base = '/c';


return base;
};
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 base path handling

The base path logic could be more robust:

  1. The empty string return for browse page could be confusing
  2. Missing validation for required parameters
 const getBasePath = ({ page, slug, isBrowse }: NavigationParams) => {
+  if (isBrowse) {
+    return '/browse';
+  }
+
+  if (page === 'profile') {
+    if (!slug) {
+      throw new Error('Slug is required for profile pages');
+    }
+    return `/u/${slug}/t`;
+  }
+
+  return '/c';
-  console.log({
-    isBrowse
-  })
-  // Handle browse page first
-  if (isBrowse) {
-    return '';
-  }
-
-  // Handle profile page
-  if (page === 'profile') {
-    return `/u/${slug}/t`;
-  }
-
-  // Default to community path
-  const base = '/c';
-
-  return base;
 };
📝 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 getBasePath = ({ page, slug, isBrowse }: NavigationParams) => {
console.log({
isBrowse
})
// Handle browse page first
if (isBrowse) {
return '';
}
// Handle profile page
if (page === 'profile') {
return `/u/${slug}/t`;
}
// Default to community path
const base = '/c';
return base;
};
const getBasePath = ({ page, slug, isBrowse }: NavigationParams) => {
if (isBrowse) {
return '/browse';
}
if (page === 'profile') {
if (!slug) {
throw new Error('Slug is required for profile pages');
}
return `/u/${slug}/t`;
}
return '/c';
};

Comment on lines 204 to 222
const buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName,
isBrowse
}: NavigationParams): string => {
const base = getBasePath({ page, slug, isBrowse, categoryName, chatbotName });
console.log({
isBrowse
})
if (!categoryName && !chatbotName) {
return base
}

const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
return `${base}${categoryPath}${chatbotPath}`
}
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

Add input validation and URL safety measures

The URL construction needs additional safety measures:

  1. Input validation for required parameters
  2. URL encoding for user-provided values
  3. Proper slug generation
 const buildNavigationUrl = ({
   page,
   slug,
   categoryName,
   chatbotName,
   isBrowse
 }: NavigationParams): string => {
+  // Validate required parameters
+  if (!page) {
+    throw new Error('Page parameter is required');
+  }
+
+  // Sanitize and encode user-provided values
+  const sanitizeUrlPart = (part: string): string => {
+    return encodeURIComponent(toSlug(part.toLowerCase()));
+  };
+
   const base = getBasePath({ page, slug, isBrowse, categoryName, chatbotName });
-  console.log({
-    isBrowse
-  })
   if (!categoryName && !chatbotName) {
     return base;
   }

-  const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
-  const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
+  const categoryPath = categoryName ? `/${sanitizeUrlPart(categoryName)}` : '';
+  const chatbotPath = chatbotName ? `/${sanitizeUrlPart(chatbotName)}` : '';
   return `${base}${categoryPath}${chatbotPath}`;
 }
📝 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 buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName,
isBrowse
}: NavigationParams): string => {
const base = getBasePath({ page, slug, isBrowse, categoryName, chatbotName });
console.log({
isBrowse
})
if (!categoryName && !chatbotName) {
return base
}
const categoryPath = categoryName ? `/${toSlug(categoryName.toLowerCase())}` : ''
const chatbotPath = chatbotName ? `/${chatbotName.toLowerCase()}` : ''
return `${base}${categoryPath}${chatbotPath}`
}
const buildNavigationUrl = ({
page,
slug,
categoryName,
chatbotName,
isBrowse
}: NavigationParams): string => {
// Validate required parameters
if (!page) {
throw new Error('Page parameter is required');
}
// Sanitize and encode user-provided values
const sanitizeUrlPart = (part: string): string => {
return encodeURIComponent(toSlug(part.toLowerCase()));
};
const base = getBasePath({ page, slug, isBrowse, categoryName, chatbotName });
if (!categoryName && !chatbotName) {
return base;
}
const categoryPath = categoryName ? `/${sanitizeUrlPart(categoryName)}` : '';
const chatbotPath = chatbotName ? `/${sanitizeUrlPart(chatbotName)}` : '';
return `${base}${categoryPath}${chatbotPath}`;
}

@sheriffjimoh sheriffjimoh changed the title Shallow routing for category & chatbots for chat & profile page [WIP] ⚠️ Shallow routing for category & chatbots for chat & profile page Nov 26, 2024
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: 8

🧹 Outside diff range and nitpick comments (6)
apps/masterbots.ai/components/routes/browse/browse-list.tsx (3)

Line range hint 69-82: Ensure consistency in thread fetching parameters

The loadMore function only uses selectedCategories while the initial fetchThreads uses both selectedCategories and selectedChatbots. This inconsistency could lead to data mismatches.

Here's the suggested fix:

  const loadMore = async () => {
    console.log('🟡 Loading More Content')
    setLoading(true)

    const moreThreads = await getBrowseThreads({
      categoriesId: selectedCategories,
+     chatbotsId: selectedChatbots,
      offset: threads.length,
      limit: PAGE_SIZE
    })

    setThreads(prevState => [...prevState, ...moreThreads])
    setCount(moreThreads.length)
    setLoading(false)
  }

Line range hint 52-65: Optimize debounce implementation

The current implementation creates a new debounced function on every call to verifyKeyword. This is inefficient and defeats the purpose of debouncing.

Move the debounced function outside the verifyKeyword function:

+ const debouncedFilter = debounce((threads: Thread[], keyword: string) => {
+   return threads.filter((thread: Thread) => searchThreadContent(thread, keyword))
+ }, 230)

  const verifyKeyword = () => {
    if (!keyword) {
      setFilteredThreads(threads)
    } else {
-     debounce(() => {
-       setFilteredThreads(
-         threads.filter((thread: Thread) =>
-           searchThreadContent(thread, keyword)
-         )
-       )
-     }, 230)()
+     const filtered = debouncedFilter(threads, keyword)
+     setFilteredThreads(filtered)
    }
  }

111-111: Add proper explanations for lint ignore comments

The biome-ignore comments lack proper explanations. Always provide clear reasons for ignoring linting rules.

Update the comments with proper explanations:

- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Dependencies are handled through stable memoized values

- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Keyword and threads are the only dependencies needed for search filtering

Also applies to: 127-127

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

Line range hint 45-56: Consider using a union type for the page prop

Instead of using a generic string type, consider defining specific allowed values for better type safety.

-  page?: string
+  page?: 'profile' | 'chat' | 'home'  // adjust union values based on actual pages
🧰 Tools
🪛 Biome (1.9.4)

[error] 119-119: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 120-120: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 152-152: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 153-153: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


66-73: Consider handling error state from useAsync

The useAsync hook provides error state that could be used to show error feedback to users.

- const userWithSlug = useAsync(async () => {
+ const { value: userWithSlug, error } = useAsync(async () => {

Then handle the error state appropriately in the UI.


169-173: Remove commented code

Remove commented out code to maintain cleaner codebase. If this code needs to be referenced later, it should be tracked in version control history.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fa6a7f7 and 41c70ec.

📒 Files selected for processing (4)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
  • apps/masterbots.ai/components/routes/browse/browse-list.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (4 hunks)
  • apps/masterbots.ai/lib/hooks/use-sidebar.tsx (4 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 182-182: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 182-182: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 182-182: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 182-182: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 182-182: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

[error] 119-119: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 120-120: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 176-176: This hook does not specify all of its dependencies: handleThreadsChange

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

🔇 Additional comments (1)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (1)

38-38: LGTM! Good centralization of navigation logic

The addition of navigateTo from useSidebar hook aligns with best practices by centralizing navigation logic.

Comment on lines 144 to 145
href="#"
// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 26, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Restore proper href for accessibility

Using href="#" reduces accessibility and prevents users from:

  • Opening links in new tabs
  • Using right-click context menu options
  • Copying link addresses

Uncomment and use the proper URL:

-href="#"
-// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
+href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
📝 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
href="#"
// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai - There's an issue on this line, the href link is triggering on double click, onClick work at first click on this link(we are using Next Link comp), but when click again to restored or remove the filter, it then trigger the href link and cause the NextTopLoader to load for a long time. for context, i used e.stopPropagation() and at some point i used both e.stopPropagation() and e.preventDefault() together but still the same, we don;t want any full page reload to happen do you have any suggestion on this ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sheriffjimoh, I understand the issue you're encountering with the Link component causing unwanted page reloads on double-click, even after using e.stopPropagation() and e.preventDefault(). When using the Next.js Link component, the default behavior is to handle navigation, which can interfere when you're managing navigation programmatically.

Since you're handling navigation within the handleClickCategory function and want to prevent any full page reloads, I recommend replacing the Link component with a button element. This approach helps avoid the default link behavior while maintaining accessibility and semantics.

Here's how you can modify your code:

<div className={cn('flex flex-col mb-2')}>
  <button
    type="button"
    className={cn(
      'flex items-center p-2 cursor-pointer',
      isActive && 'bg-gray-200 dark:bg-mirage',
      page === 'profile' && 'pl-6'
    )}
    onClick={handleClickCategory}
  >
    {categoryContent}
  </button>
  {childrenContent}
</div>

By using a button, you eliminate the need for href and prevent the default navigation behavior that can cause the NextTopLoader to load indefinitely. The button element is inherently clickable and works well with event handlers like onClick.

If you prefer to keep the styling or semantics associated with anchor tags, you might consider using an <a> element without the Link component:

<div className={cn('flex flex-col mb-2')}>
  <a
    href="#"
    className={cn(
      'flex items-center p-2 cursor-pointer',
      isActive && 'bg-gray-200 dark:bg-mirage',
      page === 'profile' && 'pl-6'
    )}
    onClick={(e) => {
      e.preventDefault();
      handleClickCategory(e);
    }}
  >
    {categoryContent}
  </a>
  {childrenContent}
</div>

However, since you've already tried using e.preventDefault() without success, switching to a button element may be the more reliable solution.

Let me know if this helps or if you have any further questions.


✏️ Learnings added
Learnt from: sheriffjimoh
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx:150-151
Timestamp: 2024-11-28T18:54:45.687Z
Learning: When handling navigation programmatically in the application, prefer using `<button>` elements instead of `Link` components to prevent unintended page reloads caused by default link behavior.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai - Using <a> and <Link> both giving same experience but @AndlerRL do you think we should change this to button instead or leave it this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sheriffjimoh, if both <a> and <Link> are providing the same experience for your use case, and you're satisfied with how it's working, it's perfectly acceptable to keep it as it is. Let me know if there's anything else I can assist you with.

(🐰❓)

Comment on lines 52 to 66
if (newCategory) {
setActiveChatbot(null)
router.push( page === 'profile' ? `/u/${slug}/t/${toSlug(category.name.toLowerCase())}` :`/c/${toSlug(category.name.toLowerCase())}`)
}
navigateTo({
page,
slug: slug as string,
categoryName: toSlug(category.name.toLowerCase())
})

}else{
setActiveChatbot(null)
navigateTo({
page,
slug: slug as string
})
}
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

Fix type safety and optimize state updates

The implementation has several issues that need addressing:

  1. Unsafe type assertion for slug
  2. Duplicate setActiveChatbot(null) calls
  3. Missing dependencies in useCallback

Apply these changes:

 if (newCategory) {
   setActiveChatbot(null)
   navigateTo({
     page,
-    slug: slug as string,
+    slug: typeof slug === 'string' ? slug : undefined,
     categoryName: toSlug(category.name.toLowerCase())
   })
-}else{
-  setActiveChatbot(null)
-  navigateTo({
-    page,
-    slug: slug as string
-  })
+} else {
+  navigateTo({
+    page,
+    slug: typeof slug === 'string' ? slug : undefined
+  })
 }

Also update the dependencies array:

 }, [
   category.categoryId,
   category.name,
   setActiveCategory,
   setExpandedCategories,
   setActiveChatbot,
-  router,
   isFilterMode,
-  isBrowse,
+  navigateTo,
+  page,
+  slug
 ])
📝 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
if (newCategory) {
setActiveChatbot(null)
router.push( page === 'profile' ? `/u/${slug}/t/${toSlug(category.name.toLowerCase())}` :`/c/${toSlug(category.name.toLowerCase())}`)
}
navigateTo({
page,
slug: slug as string,
categoryName: toSlug(category.name.toLowerCase())
})
}else{
setActiveChatbot(null)
navigateTo({
page,
slug: slug as string
})
}
if (newCategory) {
setActiveChatbot(null)
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined,
categoryName: toSlug(category.name.toLowerCase())
})
} else {
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined
})
}

Comment on lines +218 to +227
const navigateTo = ({
page,
slug,
categoryName,
chatbotName,
isBrowse
}: NavigationParams): void => {
const url = buildNavigationUrl({ page, slug, categoryName, chatbotName, isBrowse })
window.history.pushState({}, '', url)
}
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 26, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add proper state management for navigation

The current implementation only updates the browser history but doesn't trigger React router updates or notify components about URL changes.

Consider this improvement:

 const navigateTo = ({
   page,
   slug,
   categoryName,
   chatbotName,
   isBrowse
 }: NavigationParams): void => {
   const url = buildNavigationUrl({ page, slug, categoryName, chatbotName, isBrowse })
   window.history.pushState({}, '', url)
+  // Dispatch a popstate event to notify components about the URL change
+  window.dispatchEvent(new PopStateEvent('popstate', { state: {} }))
 }

Also consider using Next.js's router for consistent client-side navigation:

import { useRouter } from 'next/navigation'

const router = useRouter()
// ...
const navigateTo = (params: NavigationParams): void => {
  const url = buildNavigationUrl(params)
  router.push(url)
}

Copy link
Member

Choose a reason for hiding this comment

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

@coderabbitai we have to consider doing shallow push state using next. We do shallow redirect whenever we navigate between categories and/or chatbots routes. When changing from one main page to another i.e. going from / to /c but do shallow with / and /category-name for example or /c/category-name.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndlerRL, understood. We'll consider using shallow push state with Next.js when navigating between categories and chatbots routes, and perform full redirects when changing between main pages (e.g., from / to /c). I've noted this for future reviews.


✏️ Learnings added
Learnt from: AndlerRL
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/lib/hooks/use-sidebar.tsx:218-227
Timestamp: 2024-11-28T07:00:07.661Z
Learning: When navigating between categories and chatbots routes, we should use shallow push state with Next.js. For transitions between main pages (e.g., from `/` to `/c`), we should perform full redirects.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Member

Choose a reason for hiding this comment

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

@coderabbitai thanks. please refactor code suggestion by following the routing standards.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndlerRL, thanks for the clarification. Here's the refactored navigateTo function following the routing standards, using Next.js router for navigation and implementing shallow routing where appropriate:

import { useRouter } from 'next/navigation';
// ...
// Inside the SidebarProvider component:
const router = useRouter();
// ...

const navigateTo = ({
  page,
  slug,
  categoryName,
  chatbotName,
  isBrowse
}: NavigationParams): void => {
  const url = buildNavigationUrl({ page, slug, categoryName, chatbotName, isBrowse });

  if (page === 'profile' || isBrowse) {
    // For full redirects between main pages
    router.push(url);
  } else {
    // Use shallow routing for category and chatbot routes
    router.push(url, { shallow: true });
  }
};

This update uses Next.js's router.push method to handle navigation:

  • Shallow routing: When navigating between categories and chatbots, the shallow option is set to true to update the URL without fully reloading the page.
  • Full redirects: When transitioning between main pages (e.g., from / to /c), it performs a full redirect without the shallow option.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndlerRL, thank you for the suggestion. Simplifying the if/else block indeed makes the code cleaner and more efficient. Here's the updated navigateTo function:

import { useRouter } from 'next/navigation';
// ...
// Inside the SidebarProvider component:
const router = useRouter();
// ...

const navigateTo = ({
  page,
  slug,
  categoryName,
  chatbotName,
  isBrowse
}: NavigationParams): void => {
  const url = buildNavigationUrl({ page, slug, categoryName, chatbotName, isBrowse });

  if (page === 'profile' && (categoryName || chatbotName)) {
    // Use shallow routing within the profile page for categories and chatbots
    router.push(url, { shallow: true });
  } else if (isBrowse || page === 'profile') {
    // Full redirect when navigating to the main profile page or browsing
    router.push(url);
  } else {
    // Use shallow routing for category and chatbot routes
    router.push(url, { shallow: true });
  }
};

This refactoring simplifies the conditionals, ensures that isBrowse is respected, and prioritizes the conditions appropriately.


✏️ Learnings added
Learnt from: AndlerRL
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/lib/hooks/use-sidebar.tsx:218-227
Timestamp: 2024-11-28T07:17:55.382Z
Learning: When simplifying navigation functions, prioritize conditions with more variables first in if/else blocks to improve code readability and maintain intended behavior.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Contributor Author

@sheriffjimoh sheriffjimoh Nov 28, 2024

Choose a reason for hiding this comment

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

@coderabbitai - Let's continue this conversation this way, first of, calling router from import { useRouter } from 'next/navigation'; does not work with shallow in next app router and you can't use import { useRouter } from 'next/router' in next app router, hence the reason why i used window.history.pushState({}, '', url), which seems to be the only alternative, correct me if there's any. also the idea on the useNavigation hook was solely for the shallow re directing, i have not used this anywhere that require full page load. cc @AndlerRL

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai response to my previous comment and make the necessary amendment

Copy link
Contributor

Choose a reason for hiding this comment

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

@sheriffjimoh, thank you for the clarification. You are correct that in Next.js App Router, using useRouter from next/navigation does not support shallow routing, and we cannot use useRouter from next/router. Therefore, using window.history.pushState is appropriate for implementing shallow navigation in this context. I apologize for any confusion earlier, and I appreciate you pointing this out.


✏️ Learnings added
Learnt from: sheriffjimoh
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/lib/hooks/use-sidebar.tsx:218-227
Timestamp: 2024-11-28T18:35:37.641Z
Learning: In Next.js App Router, shallow routing is not supported with `useRouter` from `next/navigation`, so `window.history.pushState` should be used for shallow navigation between routes.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 41c70ec and 523981b.

📒 Files selected for processing (1)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 188-188: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 188-188: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 188-188: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 188-188: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 188-188: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

38-38: LGTM! Good architectural improvement

The addition of navigateTo from useSidebar hook centralizes navigation logic, which aligns well with implementing shallow routing.


150-151: ⚠️ Potential issue

Restore proper href for accessibility

Using href="#" reduces accessibility and prevents users from:

  • Opening links in new tabs
  • Using right-click context menu options
  • Copying link addresses

Uncomment and use the proper URL:

-href="#"
-// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
+href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}

Likely invalid or redundant comment.

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: 3

🧹 Outside diff range and nitpick comments (1)
apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (1)

66-73: Enhance error handling in user slug resolution

While the implementation is good, consider adding error handling and loading states for better user experience.

Consider this enhancement:

 const userWithSlug = useAsync(async () => {
   if (!slug) return { user: null }
+  try {
     const result = await getUserBySlug({
       slug,
       isSameUser: session?.user?.slug === slug
     })
     return result
+  } catch (error) {
+    console.error('Failed to fetch user:', error)
+    return { user: null, error }
+  }
 }, [slug])
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 523981b and ab51e6b.

📒 Files selected for processing (3)
  • apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (4 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (6 hunks)
  • apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx (4 hunks)
🧰 Additional context used
📓 Learnings (2)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (2)
Learnt from: AndlerRL
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx:33-37
Timestamp: 2024-11-28T06:49:04.598Z
Learning: When updating the URL in Next.js, prefer using `router.push` or `router.replace` from the Next.js `useRouter` hook instead of directly manipulating `window.history` to maintain consistency and leverage Next.js features.
Learnt from: AndlerRL
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/lib/hooks/use-sidebar.tsx:218-227
Timestamp: 2024-11-28T07:00:08.096Z
Learning: When navigating between categories and chatbots routes, we should use shallow push state with Next.js. For transitions between main pages (e.g., from `/` to `/c`), we should perform full redirects.
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (2)
Learnt from: sheriffjimoh
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx:150-151
Timestamp: 2024-11-28T18:54:45.949Z
Learning: When handling navigation programmatically in the application, prefer using `<button>` elements instead of `Link` components to prevent unintended page reloads caused by default link behavior.
Learnt from: AndlerRL
PR: bitcashorg/masterbots#313
File: apps/masterbots.ai/lib/hooks/use-sidebar.tsx:218-227
Timestamp: 2024-11-28T07:00:08.096Z
Learning: When navigating between categories and chatbots routes, we should use shallow push state with Next.js. For transitions between main pages (e.g., from `/` to `/c`), we should perform full redirects.
🪛 Biome (1.9.4)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx

[error] 79-80: The elements with the following roles can be changed to the following elements:

For examples and more information, see WAI-ARIA Roles

(lint/a11y/useSemanticElements)

apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx

[error] 142-154: Use a button element instead of an a element.

Anchor elements should only be used for default sections or page navigation
Check this thorough explanation to better understand the context.

(lint/a11y/useValidAnchor)


[error] 184-184: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

[error] 119-119: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 120-120: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 187-187: This hook does not specify all of its dependencies: handleThreadsChange

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 187-187: This hook specifies more dependencies than necessary: activeCategory, activeChatbot, isOpenPopup

This dependency can be removed from the list.

This dependency can be removed from the list.

This dependency can be removed from the list.

(lint/correctness/useExhaustiveDependencies)

🔇 Additional comments (9)
apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx (3)

22-23: LGTM: Clean hook usage for centralized state management

The addition of setActiveCategory and setActiveChatbot from the useSidebar hook promotes centralized state management.


145-145: LGTM: Good accessibility enhancement

Adding id="threads-panel" properly associates the toggle button with its controlled content through aria-controls.


33-37: 🛠️ Refactor suggestion

Use Next.js router for navigation

Based on established patterns, we should use Next.js router for URL management instead of relying on direct state manipulation.

+ import { useRouter } from 'next/navigation';
  
  export const ProfileSidebar = ({ children }: any) => {
+   const router = useRouter();
    
    const handleToggleThreads = () => {
+     const newState = !isThreadsOpen;
+     router.push(`/u/${slug}${newState ? '/t' : ''}`);
      setIsThreadsOpen(!isThreadsOpen);
      setActiveCategory(null);
      setActiveChatbot(null);
    }
apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx (3)

52-65: 🛠️ Refactor suggestion

Simplify navigation logic and improve type safety

The navigation logic can be simplified by removing the duplicate navigateTo calls and improving type safety:

if (newCategory) {
  setActiveChatbot(null)
  navigateTo({
    page,
    slug: typeof slug === 'string' ? slug : undefined,
    categoryName: toSlug(category.name.toLowerCase())
  })
-} else {
-  navigateTo({
-    page,
-    slug: typeof slug === 'string' ? slug : undefined,
-  })
}

Likely invalid or redundant comment.


232-232: Verify the impact of navigation changes

The href construction looks correct, but let's verify that all chatbot navigation paths are consistent with the new navigation system.

✅ Verification successful

Let me gather more information about the navigation patterns to ensure completeness.


Navigation paths are consistent with the dual routing system

The verification shows that the navigation system correctly handles both user-specific (/u/) and category-specific (/c/) routes for chatbots. The implementation in sidebar-link.tsx is consistent with other navigation patterns found in the codebase, and no conflicting implementations were discovered.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of chatbot navigation paths

# Search for all chatbot navigation paths
rg -A 2 "toSlug\(category\.name\).*?chatbot\.name\.toLowerCase\(\)"

# Search for any other chatbot navigation patterns that might need updating
ast-grep --pattern 'href={$_}/t/${$_}/${$_}'

Length of output: 527


Script:

#!/bin/bash
# Search for all href patterns containing chatbot navigation
rg -A 2 'href=.*?/[cu]/.*?/.*?/'

# Search for any router.push or navigation related to chatbots
rg -A 2 'router\.push.*?/[cu]/.*?/'

# Look for Link components with chatbot navigation
ast-grep --pattern 'Link $_ href={`/c/${$_}/${$_}`}'

Length of output: 2482


184-194: ⚠️ Potential issue

Fix useCallback dependencies and improve type safety

The handleChatbotClick implementation has missing dependencies and unsafe type assertions.

const handleChatbotClick = useCallback((e: React.MouseEvent) => {
  e.preventDefault()
  setActiveChatbot(chatbot)
  if(chatbot){
+   if (typeof slug !== 'string') {
+     console.error('Invalid slug type:', slug)
+     return
+   }
    navigateTo({
      page,
-     slug: slug as string,
+     slug,
      categoryName: toSlug(category.name.toLowerCase()),
      chatbotName: chatbot.name.toLowerCase()
    })
  }
}, [
  chatbot,
  setActiveChatbot,
- isFilterMode,
+ navigateTo,
+ page,
+ slug,
+ category.name
])

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 184-184: This hook does not specify all of its dependencies: category.name.toLowerCase

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: page

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook specifies more dependencies than necessary: isFilterMode

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: navigateTo

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 184-184: This hook does not specify all of its dependencies: slug

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)

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

118-126: Replace unsafe non-null assertions with optional chaining

The thread loading logic contains unsafe non-null assertions that could lead to runtime errors.

Apply this fix to handle potential null values safely:

-    moreThreads = await getThreads({
-      jwt: session!.user?.hasuraJwt,
-      userId: session!.user.id,
+    moreThreads = await getThreads({
+      jwt: session?.user?.hasuraJwt,
+      userId: session?.user?.id,
       offset: threads.length,
       limit: PAGE_SIZE,
       categoryId: activeCategory,
       chatbotName: activeChatbot?.name
     })
🧰 Tools
🪛 Biome (1.9.4)

[error] 119-119: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


[error] 120-120: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)


92-108: 🛠️ Refactor suggestion

Prevent race conditions in fetchBrowseThreads

The fetchBrowseThreads function should implement the same race condition prevention as handleThreadsChange.

Apply this enhancement:

+ const fetchIdRef = useRef(0)

 const fetchBrowseThreads = async () => {
   try {
     if(!slug) return []
     const user = userWithSlug.value?.user
     if (!user) return []
+    const currentFetchId = Date.now()
+    fetchIdRef.current = currentFetchId

     const threads = await getBrowseThreads({ 
       userId: user.userId, 
       categoryId: activeCategory,
       chatbotName: activeChatbot?.name,
       limit: PAGE_SIZE,
     });
+    
+    // Only return results if this is still the most recent fetch
+    if (fetchIdRef.current === currentFetchId) {
+      return threads;
+    }
+    return [];
   } catch (error) {
     console.error('Failed to fetch threads:', error);
     return [];
   }
 };

Likely invalid or redundant comment.


186-191: ⚠️ Potential issue

Fix useEffect dependencies

The effect is missing handleThreadsChange in its dependency array, which could lead to stale closures.

Apply this fix:

 useEffect(() => {
   if (shouldFetchThreads()) {
     handleThreadsChange();
   }
- }, [activeCategory, activeChatbot, isOpenPopup, shouldFetchThreads]);
+ }, [shouldFetchThreads, handleThreadsChange]);

Also, consider wrapping handleThreadsChange with useCallback to prevent infinite loops:

const handleThreadsChange = useCallback(async () => {
  // existing implementation
}, [session, page, slug, activeCategory, activeChatbot]);
⛔ Skipped due to learnings
Learnt from: AndlerRL
PR: bitcashorg/masterbots#300
File: apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx:120-123
Timestamp: 2024-11-20T04:00:45.413Z
Learning: In React code, when reviewing `useEffect` dependencies, it's not always necessary to add functions like `handleThreadsChange` to the dependency array, as this may lead to unnecessary re-renders and performance issues. Only include dependencies that are essential and may change.
🧰 Tools
🪛 Biome (1.9.4)

[error] 187-187: This hook does not specify all of its dependencies: handleThreadsChange

This dependency is not specified in the hook dependency list.

(lint/correctness/useExhaustiveDependencies)


[error] 187-187: This hook specifies more dependencies than necessary: activeCategory, activeChatbot, isOpenPopup

This dependency can be removed from the list.

This dependency can be removed from the list.

This dependency can be removed from the list.

(lint/correctness/useExhaustiveDependencies)

Comment on lines +74 to +87
onClick={handleToggleThreads}
className={cn(
"flex w-full items-center justify-between px-4 py-3",
"hover:bg-gray-200 dark:hover:bg-mirage transition-colors duration-200",
isThreadsOpen || location.pathname?.includes('/t/') ? 'bg-gray-200 dark:bg-mirage' : ''
)}
role="button"
aria-expanded={isThreadsOpen}
aria-controls="threads-panel"
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === 'Space') {
handleToggleThreads();
}
}}
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

Use semantic button element instead of link

While the accessibility attributes are good, it's better to use a semantic button element since this interaction doesn't navigate to a new page but toggles state.

- <Link
-   href={`/u/${slug}/t`}
+ <button
+   type="button"
    onClick={handleToggleThreads}
    className={cn(
      "flex w-full items-center justify-between px-4 py-3",
      "hover:bg-gray-200 dark:hover:bg-mirage transition-colors duration-200",
      isThreadsOpen || location.pathname?.includes('/t/') ? 'bg-gray-200 dark:bg-mirage' : ''
    )}
    aria-expanded={isThreadsOpen}
    aria-controls="threads-panel"
    onKeyDown={(e) => {
      if (e.key === 'Enter' || e.key === 'Space') {
        handleToggleThreads();
      }
    }}
- >
+ >

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

🧰 Tools
🪛 Biome (1.9.4)

[error] 79-80: The elements with the following roles can be changed to the following elements:

For examples and more information, see WAI-ARIA Roles

(lint/a11y/useSemanticElements)

Copy link
Member

@AndlerRL AndlerRL left a comment

Choose a reason for hiding this comment

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

LGTM! I still see some details on the navigation in regards the UI/UX when focusing a thread. We can do this fix ASAP in another PR. Merging this version!

@AndlerRL AndlerRL merged commit a0ca3b8 into develop Nov 28, 2024
2 checks passed
@AndlerRL AndlerRL deleted the shallow-routing branch November 28, 2024 22:29
@sheriffjimoh
Copy link
Contributor Author

LGTM! I still see some details on the navigation in regards the UI/UX when focusing a thread. We can do this fix ASAP in another PR. Merging this version!

What is that ? can you mention it here #315

AndlerRL added a commit that referenced this pull request Dec 6, 2024
* devops: force deploy

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* impr(masterbots.ai): add return to browse on bot thread page view (#204)

* ✨ Added back button to thread details page

* ⚡️  changed char to svg

* feat: ai gen 404 image for custom 404 error page  (#210)

* ⚡️ added custom  error page

* ⚡️  clean up

* fix(masterbots.ai): terms page visibility and access

* feat(masterbots.ai): consistent og image style design and dynamic metadata  (#215)

* feat: added og api endpoint

* feat: design og image for dark mode

* fix: file formated

* fix: amend  og image to pick current theme color and adapt

* feat: added custom metadata to thread page

* feat: added custom metadata to bot page

* fix: clean up

* fix: move bg to a component

* fix: move og-image design  to a component

* fix: use variable for URL

* fix: to slug func

* ⚡️ Move and clean up UrlToSlug

* fix(masterbots.ai): zod dependecy

* fix: type error

* fix: type error for metadata

* fix: clean and build fix

---------

Co-authored-by: Roberto Lucas <[email protected]>

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* [masterbots.ai] fix: multi AI models guard (#235)

* fix-guards + dom warning

* fix-rename env var - vercel name

* chore(masterbots.ai): update payment terms & conditions (#233)

* fix: update terms

* fix:  building error

* fix: update terms content

* fix: rm the older part at the bottom

* feat(masterbots.ai): pro subscription payment + wizard (#226)

* feat: added free card

* feat: added animation to the plan card

* feat: added more plan card and referral code link

* fix: clean up

* wip: wizard

* feat: wizard & modal

* feat: plan Design theme and modal Header and Footer

* feat: plan clean up

* update

* clean up

* fix: rm plan comp on browse page

* fix: wizard clean up

* feat: succes & error modal

* feat: loading comp

* feat: added checkout comp

* feat: set up stripe and context

* wip: implementing subscription

* feat: implementing subscription

* feat: payment reciept

* fix: clean up receipt

* fix: modal not showing & shallow routing

* fix: small fix

* fix: receipt comp

* fix: clean up

* fix: shallow rerouting

* feat: check if user has an active subscription

* fix: coderabbit ob

* fix: coderabbit ob

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: clean up

* fix: clean up

* fix: page restructuring and status on the receipt

* fix: revamp receipt and structure

* fix: rm unused file

* fix: clean up

* fix: update & clean up

* fix: update

* fix: rm the svg

* fix: revamp formatSystemPrompts

* fix: revamp msg to formatSystemPrompts

* fix:  update

* fix:  refactor the receipt page

* fix: rm public key

* fix: update

* fix: update

* fix: update

* fix: code refactor for error and loading rendering

* ref: calling  secret keys from server

* ref: receipt page and small fix

* fix: rm file

* fix(impr): subs & flow ux + cleanup

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* feat: set up stripe and context

* wip: implementing subscription

* fix: rm the svg

* fix: replace secret with variable

* fix: chat restructure

* fix(update): chat restructure

* fix(deployment error): can't find an  icon or not exported

* fix: deployment issues

* fix: deployment issues

* fix: deployment issues

* fix: adjust design

* fix: clean up

* fix: clean up

* fix: color var updaye

* [coderabbitai] impr: update apps/masterbots.ai/components/stripe-element.tsx

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

* [coderabitai] impr: update apps/masterbots.ai/components/succes-content.tsx

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

* fix: success close button

* fix: bg image for yearly card

* fix: move func to util

* ref: receipt page function to use reac-use

* fix: move depencies to the app

* fix: clean up

* ref: wizard to use radix dialog components

* update

* fix: coderabitai update

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>

* [masterbots.ai] fix: llama3 models  (#236)

* fix-guards + dom warning

* fix-rename env var - vercel name

* fix-changed PERPLEXITY-LLama model

* [masterbots.ai] impr(fix): ui tweaks (#237)

* fix(UI):varius UI fixes

* fix(UI):varius UI fixes

* fix(UI): Tailwind class corrections, conflict resolution, text alignent to the left

* fix(UI):update

* fix(masterbots.ai): payment feedbacks (#240)

* fix: make the dialog content responsive

* fix: free plan card adjusted

* fix: update

* fix: update receipt styles

* fix: build error

* fix: build error

* fix: build error update

* fix: update

* fix: observation

* fix(masterbots.ai): update env variable (#244)

* feat: sitemap (#238)

* feat: add redirection rules

* fix: update all links with new shorten urls

* fix: update all links with new shorten urls

* feat: make folder structure according to sitemap

* [coderabbitai] impr(masterbots.ai): update app/c/page.tsx error handling

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

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* fix: build error

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* feat: add sitemap and metagraph

* fix: use original generateMetadata

* fix: update page links

* fix: show only filtered threads on page reload

* fix: build error

---------

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

* fix(masterbots.ai): show first question & answer in thread list (#246)

* feat: add 'disabled' state to ChatAccordion

* fix: show default question's answer in thread list

* fix: use braces and create explicit statement blocks

* fix: subscription mobile responsive tweaks (#245)

* update

* fix: update

* fix: responsiveness

* fix: update

* fix: few clean up

* fix: rm unused image

* fix: rm unused image

* fix(impr): models enum table migrations (#247)

* impr(hasura): db tables

* impr(hasura): db tables

* fix(hasura): user permissions

* impr(hasura): sql models enum migration

* fix(hasura): models_enum pk

* fix(hasura): ci/cd default regional log bucket

* docs: bun to requirements (#250)

Co-authored-by: b <b>

* feat: next auth, email/pw strategy (#249)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* docs: mb sytem diagram v1.0a

* feat(impr): next auth environment helper function (#251)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

* feat:protecting env

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* impr(masterbots.ai): sign up form + sign in session data

* docs: claude3 project knowledge docs

* fix(masterbots.ai): devMode conditional

* chore(masterbots.ai): rm console.log

* chore: upt default hardcoded gpt model

* fix: toSlug imports

* fix: typo

* fix(hasura): seeds

* chore(impr): MB seeds update and upgrade (#253)

* wip: upt seeds

* chore: rm alter and table creations

* chore(impr): MB seeds update and upgrade

* fix: set thread to private by default

* fix: prompt row typo

* chore(hasura): seeds update default thread publicity

* fix(masterbots.ai): adjust arrow direction in thread list (#255)

* feat(impr): Vercel AI SDK Update (#256)

* chore:ai version upt

* chore:ai version upt

* upt-ai delete

* upt-ai versions

* upt-sdk-actions

* upt-complete-sdk-3.3 + dev notes

* upt-@anthropic-ai/sdk + MessageParam

* Delete apps/masterbots.ai/apps/masterbots.ai/package.json

* Delete apps/masterbots.ai/apps/masterbots.ai/package-lock.json

* impr-convertToCoreMessages ternary

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* fix(masterbots): google signIn (#260)

* fix(masterbots.ai): fix thread-component loop (#261)

* fix:(masterbots.ai) add useScroll hook (#263)

* fix:introducing Two-phase scroll

* impr: new hook to handle scrolling

* impr: useScroll + respo

* feat(masterbots.ai): chat sidebar filtering (#264)

* sidebar refactor with ai

* fix: sidebar AI V - Prev Jun (#262)

* fix:semistable

* fix:stable v

* impr:delete nonused component

* fix: upt category filtering

* fix typo

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: sidebar state

* fix(masterbots.ai): logic typo

* fix(masterbots.ai): ts typo

---------

Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>

* fix(masterbots.ai): bot button redirect change (#265)

* wip(masterbots.ai): seo data impr (#267)

* wip: seo data impr

* impr(chore): ga tags

* feat: add chat publicity trigger (#258)

* update

* feat: design thread visibilty

* fix: added the backend

* fix: added the backend

* fix: rm files

* fix: few clean up

* fix(masterbots): google signIn (#260)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* fix: update

* fix: add permission

* fix: update query

* fix(masterbots.ai): fix thread-component loop (#261)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* update

* fix: update

* fix: publicity toggle

* fix: error catch in the functions

* fix: observations

* fix: design impr

* fix: thread pop-up height

* chore(masterbots.ai): log rm & app version upt

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* feat(masterbots.ai): user messages ai refactor (#266)

* feat:userMessages refactor + hooks and utils

* upt:rm console.log

* fix:rollback useAiChat hook

* fix:rollback - actions

* fix(masterbots.ai): sidebar trigger

* chore(hasura: s

---------

Co-authored-by: Roberto Lucas <[email protected]>

* wip: browse sidebar

* impr(masterbots.ai): browse sidebar (#270)

* fix: browse layout

* feat(masterbots.ai): browse sidebar

* fix: browse sidebar link condition

* chore: upt signup default profile pic

* chore: seeds upt (#269)

* wip: seeds upt

* chore(hasura): seeds review

* feat(hasura): add "is_approved" thread field + seeds

* chore: mb-genql upt

* fix(hasura): thread param permission

* fix(masterbots.ai): typo

* fix(masterbots.ai): allow svg content-type

* fix: chat + browse layout

* style: clean up

* Seo data (#273)

* fix: build error

* feat: Add SEO data to the chat page

* feat: add default image, if not found

* feat: Add SEO data to the browse page

* fix: generates the image with error, in api/og

* Update route.tsx

fix: generates the image with error, in api/og

* impr(masterbots.ai): title impr prompt

* impr(masterbots.ai): improve current features v2 (#274)

* add-impr-chat-prompt-footer-header-disclaimer

* add-impr-chat-prompt-footer-header-disclaimer

* add-UI-upt

* add-UI-upt

* add-action-prompt

* add-clickable-upt

* add-clickable-upt

* Masterbots/fix redirects (#275)

* fix:avatar-redirects

* fix:avatar-redirect

* fix(masterbots.ai): upt components/ui/button.tsx

Coderabbitai suggestion.

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

* fix:URL correction

---------

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

* [masterbots.ai] feat: wordware api (#276)

* feat: add wordware api + vercel sdk strategy

* feat: add wordware api + vercel sdk

* wordware describe feat

* wordware run + interface

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* fix(masterbots.ai): typo /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

---------

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

* doc: mb system diagram upt

* wip: icl calls integrations

* impr(masterbots.ai): permission for thread & user action mode (#281)

* update

* feat: added permissions & new column

* fix: rm unnessecary files

* fix: rm permission check

* feat(masterbots.ai): create password recovery (#282)

* feat:add-recovery-strategy

* chore:add nodeemailer

* upt:hasura

* upt:hasura

* upt:gmail service

* feat(hasura): otp, token table + junction w/user + mb-genql gen

* feat:add recovery password API

* fix:ai suggestion + UX

* feat:improve ux show password feat

* chore:env sample

* chore:useSetState

* chore:roles

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: WW API sanitize and keep alive (#284)

* keep-alive + API sanitize + timeOut guard

* impr streamAndValidateResponse fn

* wip(masterbots.ai): impr createImprovementPrompt

* style(masterbots.ai): chat loading states comments

* feat(masterbots.ai): add admin mode to approve thread (#283)

* feat:added mode toggle and approve btn

* feat: added migration for user role

* feat: user role flow implet

* fix: impr admin approve process

* fix: clean up

* fix: toggle CTA changed

* fix: update

* fix: update

* fix: observ

* fix: obs clean up

* fix: update

* fix: clean up

* impr(masterbots.ai): alpha metadata chatbot labels (#288)

* wip: metadata chatbot labels

* wip(masterbots.ai): chatbot metadata labels

* impr(masterbots.ai): gen chatMetadata

* impr: simplifying prompt defitions + biome.json base config

* impr(masterbots.ai): recursive improved text prompt

* style: code comments + eslint chk

* impr: biome.json config

* fix(masterbots.ai): conflicts typo fix

* style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup

* doc: map system (simplified)

* fix(masterbots.ai): sideBar updating URL (#286)

* fix:sideBar updating URL

* feat: coderabbit-ai suggestions

* fix: Implement auto-expanding sidebar categories and chatbot highlighting based on URL

* feat: optimize sidebar navigation with Link

* feat: thread options (#287)

* feat: added verified and label to the options

* usethreadvisibility as context

* feat: added option design  and functions

* fix: clean up

* fix: update

* fix: update

* fix: obsv

* fix: merge and update

* fix: update the delete popup

* fix: observ

* fix: update

* fix: delete thread flow

* update

* fix: update

* fix: types

* fix: chatbot not required

* fix: testing

* fix: rm bun.lock

* fix: clean up

* fix: update

* fix(masterbots.ai): temp freezing next version

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] feat: email verification (#289)

* feat: email verification

* feat: email verification

* feat: email verification

* upt:build

* feat: handle error redirection

* chore:cron task

* upt: cron blocking instead erasing

* feat(hasura): create social following table. (#292)

* feat(db): create social following table.

* create user following and followers relationships.

* fix(db): ensure users can only manage their own follow relationships.

* feat(db): social following and user table permissions improvements.

* feat(db): improving social following table with  timestamp and idx.

* impr(db): permissions and tracked object relationships.

* impr(db): avoid self follow.

* chore(masterbots.ai): guard WordWare for prod routing

* [masterbots.ai] fix: public/private tag bg on dark mode  (#294)

* fix: tag bg

* fix: text color

* fix: browse page error

* fix: debugging

* fix: debugging

* fix: debugging

* fix: added func to generate short link

* fix(hasura): upt user permissions (#296)

* update user permission

* fix: reverse the following table

* fix(hasura): build error (#297)

* fix: error build

* fix: reverse select perm

* [masterbots.ai] feat: thread list display + components comments for ai (#299)

* merged from develop

* feat:add new ui-thread-representation-browse

* feat:add comments for ai - C

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add app theme colors effects

* feat:add comments for ai - b/p

* [masterbots.ai] feat: chatbot search tool v0.1a (#295)

* wip: chatbot search tool

* wip(impr): ww api + chat ui tweaks

* fix: init sidebar load state

* fix: nesting layout

* fix: thread-popup ui header

* wip(impr): chatbot tooling

* impr: loading state + debug chatbot tools

* wip(fix): nodejs context

* fix(temp): rm edge runtime api config

* [masterbots.ai] feat: reorganize navigation menu for mobile view (#298)

* feat: reorganize navigation menu for mobile view

* UI: add sideBar style

* feat: add link profile and logout icon

* Update profile-sidebar.tsx

Tailwind class fix

* [masterbots.ai] feat: UI + Logic Improvements (#301)

* feat:impr responsive

* feat:impr password strenght checker

* feat:impr responsive

* upt-build

* feat:respomsive tweask

* feat:back arrow aria label

* fix:chat mobile layout

* fix:code section

* fix:chat pannel

* fix:chatBot redirection

* feat:restore appConfig header

* [masterbots.ai] fix: restore desktop navigation link - browse section (#303)

* fix:restore desktop navigation link - browse

* fix:formating

* feat:yellow combobox btn (JUN-REQUEST)

* glowing effect variant

* upt:removed /b navigation as original v

* feat:powerup mode + provider

* [masterbots.ai] fix(impr): browse and chat content search (#304)

* feat:browse title and content search

* feat:browse title and content search

* fix:typo

* impr:reusable non result component

* feat:skeletons

* feat:guard

* fix:skeletons

* fix:chat searching

* fix: add accent colour

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: seo sitemap (#306)

* chore: sitemap creation

* chore: add description based on category

* chore: update queries in services

* chore: truncate text

* impr: upt (browse)/[category]/[threadId]/sitemap.ts

coderabbitai code suggestion.

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

---------

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

* [masterbots.ai] impr: ai tools (#302)

* wip: ai tools

* fix: WW json regexp

* impr: simplifying main ai call

* wip(fix): chat component re-render + cleanup

* impr(refactor): chat hooks

* fix: ts build

* fix: ts build

* fix: ts typo

* fix: typo

* impr: ai feedbacks

* [masterbots.ai] wip(impr): web search (#309)

* impr: web search tool call

* fix: colour values

* fix: typo

* impr: code suggestions

* fix: class name typo

* wip(fix): web search false positive response + webSearch context

* fix: web search callback

* fix: typo

* feat: profile page (#300)

* feat: user card

* fix: update

* merge develop && update

* feat: user generate bio & favourite  topic

* fix: update user card

* feat: added profile sidebar

* fix: update

* update

* update

* update

* fix: fetch approved and public threads

* fix: fetch approved and public threads

* update

* fix: clean up and update

* update

* make fetch user work with bio

* update

* update

* design updating

* update

* update

* fix: few changes

* update

* fix: design update

* fix: footer in layout

* fix: update

* fix:  resercation

* update

* profile upload

* feat: move the cloudinary key to env

* fix: layout

* fix: layout update

* [masterbots.ai] fix: shallow routing for category & chatbots for  chat & profile page  (#313)

* update

* feat: added shallow link to the sidebar link

* update'

* fix: routing and content fetching

* fix:update on  routing

* fix:update

* update

* update

* update

* fix: clean up

* update

* update

* [masterbots.ai] feat: update ChatChatbotDetails (#314)

* feat: new bot profile - chat

* chore: dev comments

* chore: white bg bot avatar

* feat: add skeleton bot profile

* [masterbots.ai] feat: include custom settings options (#317)

* feat:relocation of theme switch(jun)

* feat: create font-size accessibility provider(jun)

* feat: r-sidebar theme switcher relocation + skeleton

* feat: impr add rem instead px

* [masterbots.ai] feat: integrate drizzle ORM (#320)

* feat: create mb-drizzle package initial structure

* feat:(masterbots.ai) add drizzle endpoint + service

* chore: include database url

* chore: upt mb-drizzle

* feat: refactor drizzle config + generations

* chore: impr migrate

* chore: add working drizzle connection + migrations

* feat: add centralized actions

* chore: add ai review recomendations

* chore: webSearch feature flag + use cloudinary upload preset

* fix: responsive sidebar fix

* fix: ts chk build

* fix: sidebar async call

* fix: ts build

* chore: typo

---------

Co-authored-by: Gabo Esquivel <[email protected]>
Co-authored-by: Jimoh sherifdeen <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Anouk Rímola <[email protected]>
Co-authored-by: Trivium <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Luis Carrión <[email protected]>
Co-authored-by: Marco Ledezma <[email protected]>
AndlerRL added a commit that referenced this pull request Dec 10, 2024
* devops: force deploy

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* impr(masterbots.ai): add return to browse on bot thread page view (#204)

* ✨ Added back button to thread details page

* ⚡️  changed char to svg

* feat: ai gen 404 image for custom 404 error page  (#210)

* ⚡️ added custom  error page

* ⚡️  clean up

* fix(masterbots.ai): terms page visibility and access

* feat(masterbots.ai): consistent og image style design and dynamic metadata  (#215)

* feat: added og api endpoint

* feat: design og image for dark mode

* fix: file formated

* fix: amend  og image to pick current theme color and adapt

* feat: added custom metadata to thread page

* feat: added custom metadata to bot page

* fix: clean up

* fix: move bg to a component

* fix: move og-image design  to a component

* fix: use variable for URL

* fix: to slug func

* ⚡️ Move and clean up UrlToSlug

* fix(masterbots.ai): zod dependecy

* fix: type error

* fix: type error for metadata

* fix: clean and build fix

---------

Co-authored-by: Roberto Lucas <[email protected]>

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* [masterbots.ai] fix: multi AI models guard (#235)

* fix-guards + dom warning

* fix-rename env var - vercel name

* chore(masterbots.ai): update payment terms & conditions (#233)

* fix: update terms

* fix:  building error

* fix: update terms content

* fix: rm the older part at the bottom

* feat(masterbots.ai): pro subscription payment + wizard (#226)

* feat: added free card

* feat: added animation to the plan card

* feat: added more plan card and referral code link

* fix: clean up

* wip: wizard

* feat: wizard & modal

* feat: plan Design theme and modal Header and Footer

* feat: plan clean up

* update

* clean up

* fix: rm plan comp on browse page

* fix: wizard clean up

* feat: succes & error modal

* feat: loading comp

* feat: added checkout comp

* feat: set up stripe and context

* wip: implementing subscription

* feat: implementing subscription

* feat: payment reciept

* fix: clean up receipt

* fix: modal not showing & shallow routing

* fix: small fix

* fix: receipt comp

* fix: clean up

* fix: shallow rerouting

* feat: check if user has an active subscription

* fix: coderabbit ob

* fix: coderabbit ob

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: clean up

* fix: clean up

* fix: page restructuring and status on the receipt

* fix: revamp receipt and structure

* fix: rm unused file

* fix: clean up

* fix: update & clean up

* fix: update

* fix: rm the svg

* fix: revamp formatSystemPrompts

* fix: revamp msg to formatSystemPrompts

* fix:  update

* fix:  refactor the receipt page

* fix: rm public key

* fix: update

* fix: update

* fix: update

* fix: code refactor for error and loading rendering

* ref: calling  secret keys from server

* ref: receipt page and small fix

* fix: rm file

* fix(impr): subs & flow ux + cleanup

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* feat: set up stripe and context

* wip: implementing subscription

* fix: rm the svg

* fix: replace secret with variable

* fix: chat restructure

* fix(update): chat restructure

* fix(deployment error): can't find an  icon or not exported

* fix: deployment issues

* fix: deployment issues

* fix: deployment issues

* fix: adjust design

* fix: clean up

* fix: clean up

* fix: color var updaye

* [coderabbitai] impr: update apps/masterbots.ai/components/stripe-element.tsx

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

* [coderabitai] impr: update apps/masterbots.ai/components/succes-content.tsx

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

* fix: success close button

* fix: bg image for yearly card

* fix: move func to util

* ref: receipt page function to use reac-use

* fix: move depencies to the app

* fix: clean up

* ref: wizard to use radix dialog components

* update

* fix: coderabitai update

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>

* [masterbots.ai] fix: llama3 models  (#236)

* fix-guards + dom warning

* fix-rename env var - vercel name

* fix-changed PERPLEXITY-LLama model

* [masterbots.ai] impr(fix): ui tweaks (#237)

* fix(UI):varius UI fixes

* fix(UI):varius UI fixes

* fix(UI): Tailwind class corrections, conflict resolution, text alignent to the left

* fix(UI):update

* fix(masterbots.ai): payment feedbacks (#240)

* fix: make the dialog content responsive

* fix: free plan card adjusted

* fix: update

* fix: update receipt styles

* fix: build error

* fix: build error

* fix: build error update

* fix: update

* fix: observation

* fix(masterbots.ai): update env variable (#244)

* feat: sitemap (#238)

* feat: add redirection rules

* fix: update all links with new shorten urls

* fix: update all links with new shorten urls

* feat: make folder structure according to sitemap

* [coderabbitai] impr(masterbots.ai): update app/c/page.tsx error handling

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

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* fix: build error

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* feat: add sitemap and metagraph

* fix: use original generateMetadata

* fix: update page links

* fix: show only filtered threads on page reload

* fix: build error

---------

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

* fix(masterbots.ai): show first question & answer in thread list (#246)

* feat: add 'disabled' state to ChatAccordion

* fix: show default question's answer in thread list

* fix: use braces and create explicit statement blocks

* fix: subscription mobile responsive tweaks (#245)

* update

* fix: update

* fix: responsiveness

* fix: update

* fix: few clean up

* fix: rm unused image

* fix: rm unused image

* fix(impr): models enum table migrations (#247)

* impr(hasura): db tables

* impr(hasura): db tables

* fix(hasura): user permissions

* impr(hasura): sql models enum migration

* fix(hasura): models_enum pk

* fix(hasura): ci/cd default regional log bucket

* docs: bun to requirements (#250)

Co-authored-by: b <b>

* feat: next auth, email/pw strategy (#249)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* docs: mb sytem diagram v1.0a

* feat(impr): next auth environment helper function (#251)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

* feat:protecting env

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* impr(masterbots.ai): sign up form + sign in session data

* docs: claude3 project knowledge docs

* fix(masterbots.ai): devMode conditional

* chore(masterbots.ai): rm console.log

* chore: upt default hardcoded gpt model

* fix: toSlug imports

* fix: typo

* fix(hasura): seeds

* chore(impr): MB seeds update and upgrade (#253)

* wip: upt seeds

* chore: rm alter and table creations

* chore(impr): MB seeds update and upgrade

* fix: set thread to private by default

* fix: prompt row typo

* chore(hasura): seeds update default thread publicity

* fix(masterbots.ai): adjust arrow direction in thread list (#255)

* feat(impr): Vercel AI SDK Update (#256)

* chore:ai version upt

* chore:ai version upt

* upt-ai delete

* upt-ai versions

* upt-sdk-actions

* upt-complete-sdk-3.3 + dev notes

* upt-@anthropic-ai/sdk + MessageParam

* Delete apps/masterbots.ai/apps/masterbots.ai/package.json

* Delete apps/masterbots.ai/apps/masterbots.ai/package-lock.json

* impr-convertToCoreMessages ternary

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* fix(masterbots): google signIn (#260)

* fix(masterbots.ai): fix thread-component loop (#261)

* fix:(masterbots.ai) add useScroll hook (#263)

* fix:introducing Two-phase scroll

* impr: new hook to handle scrolling

* impr: useScroll + respo

* feat(masterbots.ai): chat sidebar filtering (#264)

* sidebar refactor with ai

* fix: sidebar AI V - Prev Jun (#262)

* fix:semistable

* fix:stable v

* impr:delete nonused component

* fix: upt category filtering

* fix typo

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: sidebar state

* fix(masterbots.ai): logic typo

* fix(masterbots.ai): ts typo

---------

Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>

* fix(masterbots.ai): bot button redirect change (#265)

* wip(masterbots.ai): seo data impr (#267)

* wip: seo data impr

* impr(chore): ga tags

* feat: add chat publicity trigger (#258)

* update

* feat: design thread visibilty

* fix: added the backend

* fix: added the backend

* fix: rm files

* fix: few clean up

* fix(masterbots): google signIn (#260)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* fix: update

* fix: add permission

* fix: update query

* fix(masterbots.ai): fix thread-component loop (#261)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* update

* fix: update

* fix: publicity toggle

* fix: error catch in the functions

* fix: observations

* fix: design impr

* fix: thread pop-up height

* chore(masterbots.ai): log rm & app version upt

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* feat(masterbots.ai): user messages ai refactor (#266)

* feat:userMessages refactor + hooks and utils

* upt:rm console.log

* fix:rollback useAiChat hook

* fix:rollback - actions

* fix(masterbots.ai): sidebar trigger

* chore(hasura: s

---------

Co-authored-by: Roberto Lucas <[email protected]>

* wip: browse sidebar

* impr(masterbots.ai): browse sidebar (#270)

* fix: browse layout

* feat(masterbots.ai): browse sidebar

* fix: browse sidebar link condition

* chore: upt signup default profile pic

* chore: seeds upt (#269)

* wip: seeds upt

* chore(hasura): seeds review

* feat(hasura): add "is_approved" thread field + seeds

* chore: mb-genql upt

* fix(hasura): thread param permission

* fix(masterbots.ai): typo

* fix(masterbots.ai): allow svg content-type

* fix: chat + browse layout

* style: clean up

* Seo data (#273)

* fix: build error

* feat: Add SEO data to the chat page

* feat: add default image, if not found

* feat: Add SEO data to the browse page

* fix: generates the image with error, in api/og

* Update route.tsx

fix: generates the image with error, in api/og

* impr(masterbots.ai): title impr prompt

* impr(masterbots.ai): improve current features v2 (#274)

* add-impr-chat-prompt-footer-header-disclaimer

* add-impr-chat-prompt-footer-header-disclaimer

* add-UI-upt

* add-UI-upt

* add-action-prompt

* add-clickable-upt

* add-clickable-upt

* Masterbots/fix redirects (#275)

* fix:avatar-redirects

* fix:avatar-redirect

* fix(masterbots.ai): upt components/ui/button.tsx

Coderabbitai suggestion.

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

* fix:URL correction

---------

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

* [masterbots.ai] feat: wordware api (#276)

* feat: add wordware api + vercel sdk strategy

* feat: add wordware api + vercel sdk

* wordware describe feat

* wordware run + interface

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* fix(masterbots.ai): typo /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

---------

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

* doc: mb system diagram upt

* wip: icl calls integrations

* impr(masterbots.ai): permission for thread & user action mode (#281)

* update

* feat: added permissions & new column

* fix: rm unnessecary files

* fix: rm permission check

* feat(masterbots.ai): create password recovery (#282)

* feat:add-recovery-strategy

* chore:add nodeemailer

* upt:hasura

* upt:hasura

* upt:gmail service

* feat(hasura): otp, token table + junction w/user + mb-genql gen

* feat:add recovery password API

* fix:ai suggestion + UX

* feat:improve ux show password feat

* chore:env sample

* chore:useSetState

* chore:roles

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: WW API sanitize and keep alive (#284)

* keep-alive + API sanitize + timeOut guard

* impr streamAndValidateResponse fn

* wip(masterbots.ai): impr createImprovementPrompt

* style(masterbots.ai): chat loading states comments

* feat(masterbots.ai): add admin mode to approve thread (#283)

* feat:added mode toggle and approve btn

* feat: added migration for user role

* feat: user role flow implet

* fix: impr admin approve process

* fix: clean up

* fix: toggle CTA changed

* fix: update

* fix: update

* fix: observ

* fix: obs clean up

* fix: update

* fix: clean up

* impr(masterbots.ai): alpha metadata chatbot labels (#288)

* wip: metadata chatbot labels

* wip(masterbots.ai): chatbot metadata labels

* impr(masterbots.ai): gen chatMetadata

* impr: simplifying prompt defitions + biome.json base config

* impr(masterbots.ai): recursive improved text prompt

* style: code comments + eslint chk

* impr: biome.json config

* fix(masterbots.ai): conflicts typo fix

* style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup

* doc: map system (simplified)

* fix(masterbots.ai): sideBar updating URL (#286)

* fix:sideBar updating URL

* feat: coderabbit-ai suggestions

* fix: Implement auto-expanding sidebar categories and chatbot highlighting based on URL

* feat: optimize sidebar navigation with Link

* feat: thread options (#287)

* feat: added verified and label to the options

* usethreadvisibility as context

* feat: added option design  and functions

* fix: clean up

* fix: update

* fix: update

* fix: obsv

* fix: merge and update

* fix: update the delete popup

* fix: observ

* fix: update

* fix: delete thread flow

* update

* fix: update

* fix: types

* fix: chatbot not required

* fix: testing

* fix: rm bun.lock

* fix: clean up

* fix: update

* fix(masterbots.ai): temp freezing next version

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] feat: email verification (#289)

* feat: email verification

* feat: email verification

* feat: email verification

* upt:build

* feat: handle error redirection

* chore:cron task

* upt: cron blocking instead erasing

* feat(hasura): create social following table. (#292)

* feat(db): create social following table.

* create user following and followers relationships.

* fix(db): ensure users can only manage their own follow relationships.

* feat(db): social following and user table permissions improvements.

* feat(db): improving social following table with  timestamp and idx.

* impr(db): permissions and tracked object relationships.

* impr(db): avoid self follow.

* chore(masterbots.ai): guard WordWare for prod routing

* [masterbots.ai] fix: public/private tag bg on dark mode  (#294)

* fix: tag bg

* fix: text color

* fix: browse page error

* fix: debugging

* fix: debugging

* fix: debugging

* fix: added func to generate short link

* fix(hasura): upt user permissions (#296)

* update user permission

* fix: reverse the following table

* fix(hasura): build error (#297)

* fix: error build

* fix: reverse select perm

* [masterbots.ai] feat: thread list display + components comments for ai (#299)

* merged from develop

* feat:add new ui-thread-representation-browse

* feat:add comments for ai - C

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add app theme colors effects

* feat:add comments for ai - b/p

* [masterbots.ai] feat: chatbot search tool v0.1a (#295)

* wip: chatbot search tool

* wip(impr): ww api + chat ui tweaks

* fix: init sidebar load state

* fix: nesting layout

* fix: thread-popup ui header

* wip(impr): chatbot tooling

* impr: loading state + debug chatbot tools

* wip(fix): nodejs context

* fix(temp): rm edge runtime api config

* [masterbots.ai] feat: reorganize navigation menu for mobile view (#298)

* feat: reorganize navigation menu for mobile view

* UI: add sideBar style

* feat: add link profile and logout icon

* Update profile-sidebar.tsx

Tailwind class fix

* [masterbots.ai] feat: UI + Logic Improvements (#301)

* feat:impr responsive

* feat:impr password strenght checker

* feat:impr responsive

* upt-build

* feat:respomsive tweask

* feat:back arrow aria label

* fix:chat mobile layout

* fix:code section

* fix:chat pannel

* fix:chatBot redirection

* feat:restore appConfig header

* [masterbots.ai] fix: restore desktop navigation link - browse section (#303)

* fix:restore desktop navigation link - browse

* fix:formating

* feat:yellow combobox btn (JUN-REQUEST)

* glowing effect variant

* upt:removed /b navigation as original v

* feat:powerup mode + provider

* [masterbots.ai] fix(impr): browse and chat content search (#304)

* feat:browse title and content search

* feat:browse title and content search

* fix:typo

* impr:reusable non result component

* feat:skeletons

* feat:guard

* fix:skeletons

* fix:chat searching

* fix: add accent colour

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: seo sitemap (#306)

* chore: sitemap creation

* chore: add description based on category

* chore: update queries in services

* chore: truncate text

* impr: upt (browse)/[category]/[threadId]/sitemap.ts

coderabbitai code suggestion.

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

---------

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

* [masterbots.ai] impr: ai tools (#302)

* wip: ai tools

* fix: WW json regexp

* impr: simplifying main ai call

* wip(fix): chat component re-render + cleanup

* impr(refactor): chat hooks

* fix: ts build

* fix: ts build

* fix: ts typo

* fix: typo

* impr: ai feedbacks

* [masterbots.ai] wip(impr): web search (#309)

* impr: web search tool call

* fix: colour values

* fix: typo

* impr: code suggestions

* fix: class name typo

* wip(fix): web search false positive response + webSearch context

* fix: web search callback

* fix: typo

* feat: profile page (#300)

* feat: user card

* fix: update

* merge develop && update

* feat: user generate bio & favourite  topic

* fix: update user card

* feat: added profile sidebar

* fix: update

* update

* update

* update

* fix: fetch approved and public threads

* fix: fetch approved and public threads

* update

* fix: clean up and update

* update

* make fetch user work with bio

* update

* update

* design updating

* update

* update

* fix: few changes

* update

* fix: design update

* fix: footer in layout

* fix: update

* fix:  resercation

* update

* profile upload

* feat: move the cloudinary key to env

* fix: layout

* fix: layout update

* [masterbots.ai] fix: shallow routing for category & chatbots for  chat & profile page  (#313)

* update

* feat: added shallow link to the sidebar link

* update'

* fix: routing and content fetching

* fix:update on  routing

* fix:update

* update

* update

* update

* fix: clean up

* update

* update

* [masterbots.ai] feat: update ChatChatbotDetails (#314)

* feat: new bot profile - chat

* chore: dev comments

* chore: white bg bot avatar

* feat: add skeleton bot profile

* [masterbots.ai] feat: include custom settings options (#317)

* feat:relocation of theme switch(jun)

* feat: create font-size accessibility provider(jun)

* feat: r-sidebar theme switcher relocation + skeleton

* feat: impr add rem instead px

* [masterbots.ai] feat: integrate drizzle ORM (#320)

* feat: create mb-drizzle package initial structure

* feat:(masterbots.ai) add drizzle endpoint + service

* chore: include database url

* chore: upt mb-drizzle

* feat: refactor drizzle config + generations

* chore: impr migrate

* chore: add working drizzle connection + migrations

* feat: add centralized actions

* chore: add ai review recomendations

* chore: webSearch feature flag + use cloudinary upload preset

* fix: responsive sidebar fix

* fix: ts chk build

* fix: sidebar async call

* fix: ts build

* chore: typo

* [masterbots.ai] fix: browse category navigation (#316)

* update

* fix: rm category

* update

* fix: pop up on the user threads

* update

* update clean up

* update

* fix: clean up

* fix:  clean up and update

* fix: update

* fix: popup on navigation

* fix: update

* update

* update

* update

* clean up

* update

* merge

* fix: hasura thread delete + user dup permissions (#330)

---------

Co-authored-by: Gabo Esquivel <[email protected]>
Co-authored-by: Jimoh sherifdeen <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Anouk Rímola <[email protected]>
Co-authored-by: Trivium <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Luis Carrión <[email protected]>
Co-authored-by: Marco Ledezma <[email protected]>
AndlerRL added a commit that referenced this pull request Jan 22, 2025
* devops: force deploy

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* impr(masterbots.ai): add return to browse on bot thread page view (#204)

* ✨ Added back button to thread details page

* ⚡️  changed char to svg

* feat: ai gen 404 image for custom 404 error page  (#210)

* ⚡️ added custom  error page

* ⚡️  clean up

* fix(masterbots.ai): terms page visibility and access

* feat(masterbots.ai): consistent og image style design and dynamic metadata  (#215)

* feat: added og api endpoint

* feat: design og image for dark mode

* fix: file formated

* fix: amend  og image to pick current theme color and adapt

* feat: added custom metadata to thread page

* feat: added custom metadata to bot page

* fix: clean up

* fix: move bg to a component

* fix: move og-image design  to a component

* fix: use variable for URL

* fix: to slug func

* ⚡️ Move and clean up UrlToSlug

* fix(masterbots.ai): zod dependecy

* fix: type error

* fix: type error for metadata

* fix: clean and build fix

---------

Co-authored-by: Roberto Lucas <[email protected]>

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* [masterbots.ai] fix: multi AI models guard (#235)

* fix-guards + dom warning

* fix-rename env var - vercel name

* chore(masterbots.ai): update payment terms & conditions (#233)

* fix: update terms

* fix:  building error

* fix: update terms content

* fix: rm the older part at the bottom

* feat(masterbots.ai): pro subscription payment + wizard (#226)

* feat: added free card

* feat: added animation to the plan card

* feat: added more plan card and referral code link

* fix: clean up

* wip: wizard

* feat: wizard & modal

* feat: plan Design theme and modal Header and Footer

* feat: plan clean up

* update

* clean up

* fix: rm plan comp on browse page

* fix: wizard clean up

* feat: succes & error modal

* feat: loading comp

* feat: added checkout comp

* feat: set up stripe and context

* wip: implementing subscription

* feat: implementing subscription

* feat: payment reciept

* fix: clean up receipt

* fix: modal not showing & shallow routing

* fix: small fix

* fix: receipt comp

* fix: clean up

* fix: shallow rerouting

* feat: check if user has an active subscription

* fix: coderabbit ob

* fix: coderabbit ob

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: clean up

* fix: clean up

* fix: page restructuring and status on the receipt

* fix: revamp receipt and structure

* fix: rm unused file

* fix: clean up

* fix: update & clean up

* fix: update

* fix: rm the svg

* fix: revamp formatSystemPrompts

* fix: revamp msg to formatSystemPrompts

* fix:  update

* fix:  refactor the receipt page

* fix: rm public key

* fix: update

* fix: update

* fix: update

* fix: code refactor for error and loading rendering

* ref: calling  secret keys from server

* ref: receipt page and small fix

* fix: rm file

* fix(impr): subs & flow ux + cleanup

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* feat: set up stripe and context

* wip: implementing subscription

* fix: rm the svg

* fix: replace secret with variable

* fix: chat restructure

* fix(update): chat restructure

* fix(deployment error): can't find an  icon or not exported

* fix: deployment issues

* fix: deployment issues

* fix: deployment issues

* fix: adjust design

* fix: clean up

* fix: clean up

* fix: color var updaye

* [coderabbitai] impr: update apps/masterbots.ai/components/stripe-element.tsx

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

* [coderabitai] impr: update apps/masterbots.ai/components/succes-content.tsx

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

* fix: success close button

* fix: bg image for yearly card

* fix: move func to util

* ref: receipt page function to use reac-use

* fix: move depencies to the app

* fix: clean up

* ref: wizard to use radix dialog components

* update

* fix: coderabitai update

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>

* [masterbots.ai] fix: llama3 models  (#236)

* fix-guards + dom warning

* fix-rename env var - vercel name

* fix-changed PERPLEXITY-LLama model

* [masterbots.ai] impr(fix): ui tweaks (#237)

* fix(UI):varius UI fixes

* fix(UI):varius UI fixes

* fix(UI): Tailwind class corrections, conflict resolution, text alignent to the left

* fix(UI):update

* fix(masterbots.ai): payment feedbacks (#240)

* fix: make the dialog content responsive

* fix: free plan card adjusted

* fix: update

* fix: update receipt styles

* fix: build error

* fix: build error

* fix: build error update

* fix: update

* fix: observation

* fix(masterbots.ai): update env variable (#244)

* feat: sitemap (#238)

* feat: add redirection rules

* fix: update all links with new shorten urls

* fix: update all links with new shorten urls

* feat: make folder structure according to sitemap

* [coderabbitai] impr(masterbots.ai): update app/c/page.tsx error handling

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

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* fix: build error

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* feat: add sitemap and metagraph

* fix: use original generateMetadata

* fix: update page links

* fix: show only filtered threads on page reload

* fix: build error

---------

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

* fix(masterbots.ai): show first question & answer in thread list (#246)

* feat: add 'disabled' state to ChatAccordion

* fix: show default question's answer in thread list

* fix: use braces and create explicit statement blocks

* fix: subscription mobile responsive tweaks (#245)

* update

* fix: update

* fix: responsiveness

* fix: update

* fix: few clean up

* fix: rm unused image

* fix: rm unused image

* fix(impr): models enum table migrations (#247)

* impr(hasura): db tables

* impr(hasura): db tables

* fix(hasura): user permissions

* impr(hasura): sql models enum migration

* fix(hasura): models_enum pk

* fix(hasura): ci/cd default regional log bucket

* docs: bun to requirements (#250)

Co-authored-by: b <b>

* feat: next auth, email/pw strategy (#249)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* docs: mb sytem diagram v1.0a

* feat(impr): next auth environment helper function (#251)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

* feat:protecting env

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* impr(masterbots.ai): sign up form + sign in session data

* docs: claude3 project knowledge docs

* fix(masterbots.ai): devMode conditional

* chore(masterbots.ai): rm console.log

* chore: upt default hardcoded gpt model

* fix: toSlug imports

* fix: typo

* fix(hasura): seeds

* chore(impr): MB seeds update and upgrade (#253)

* wip: upt seeds

* chore: rm alter and table creations

* chore(impr): MB seeds update and upgrade

* fix: set thread to private by default

* fix: prompt row typo

* chore(hasura): seeds update default thread publicity

* fix(masterbots.ai): adjust arrow direction in thread list (#255)

* feat(impr): Vercel AI SDK Update (#256)

* chore:ai version upt

* chore:ai version upt

* upt-ai delete

* upt-ai versions

* upt-sdk-actions

* upt-complete-sdk-3.3 + dev notes

* upt-@anthropic-ai/sdk + MessageParam

* Delete apps/masterbots.ai/apps/masterbots.ai/package.json

* Delete apps/masterbots.ai/apps/masterbots.ai/package-lock.json

* impr-convertToCoreMessages ternary

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* fix(masterbots): google signIn (#260)

* fix(masterbots.ai): fix thread-component loop (#261)

* fix:(masterbots.ai) add useScroll hook (#263)

* fix:introducing Two-phase scroll

* impr: new hook to handle scrolling

* impr: useScroll + respo

* feat(masterbots.ai): chat sidebar filtering (#264)

* sidebar refactor with ai

* fix: sidebar AI V - Prev Jun (#262)

* fix:semistable

* fix:stable v

* impr:delete nonused component

* fix: upt category filtering

* fix typo

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: sidebar state

* fix(masterbots.ai): logic typo

* fix(masterbots.ai): ts typo

---------

Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>

* fix(masterbots.ai): bot button redirect change (#265)

* wip(masterbots.ai): seo data impr (#267)

* wip: seo data impr

* impr(chore): ga tags

* feat: add chat publicity trigger (#258)

* update

* feat: design thread visibilty

* fix: added the backend

* fix: added the backend

* fix: rm files

* fix: few clean up

* fix(masterbots): google signIn (#260)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* fix: update

* fix: add permission

* fix: update query

* fix(masterbots.ai): fix thread-component loop (#261)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* update

* fix: update

* fix: publicity toggle

* fix: error catch in the functions

* fix: observations

* fix: design impr

* fix: thread pop-up height

* chore(masterbots.ai): log rm & app version upt

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* feat(masterbots.ai): user messages ai refactor (#266)

* feat:userMessages refactor + hooks and utils

* upt:rm console.log

* fix:rollback useAiChat hook

* fix:rollback - actions

* fix(masterbots.ai): sidebar trigger

* chore(hasura: s

---------

Co-authored-by: Roberto Lucas <[email protected]>

* wip: browse sidebar

* impr(masterbots.ai): browse sidebar (#270)

* fix: browse layout

* feat(masterbots.ai): browse sidebar

* fix: browse sidebar link condition

* chore: upt signup default profile pic

* chore: seeds upt (#269)

* wip: seeds upt

* chore(hasura): seeds review

* feat(hasura): add "is_approved" thread field + seeds

* chore: mb-genql upt

* fix(hasura): thread param permission

* fix(masterbots.ai): typo

* fix(masterbots.ai): allow svg content-type

* fix: chat + browse layout

* style: clean up

* Seo data (#273)

* fix: build error

* feat: Add SEO data to the chat page

* feat: add default image, if not found

* feat: Add SEO data to the browse page

* fix: generates the image with error, in api/og

* Update route.tsx

fix: generates the image with error, in api/og

* impr(masterbots.ai): title impr prompt

* impr(masterbots.ai): improve current features v2 (#274)

* add-impr-chat-prompt-footer-header-disclaimer

* add-impr-chat-prompt-footer-header-disclaimer

* add-UI-upt

* add-UI-upt

* add-action-prompt

* add-clickable-upt

* add-clickable-upt

* Masterbots/fix redirects (#275)

* fix:avatar-redirects

* fix:avatar-redirect

* fix(masterbots.ai): upt components/ui/button.tsx

Coderabbitai suggestion.

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

* fix:URL correction

---------

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

* [masterbots.ai] feat: wordware api (#276)

* feat: add wordware api + vercel sdk strategy

* feat: add wordware api + vercel sdk

* wordware describe feat

* wordware run + interface

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* fix(masterbots.ai): typo /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

---------

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

* doc: mb system diagram upt

* wip: icl calls integrations

* impr(masterbots.ai): permission for thread & user action mode (#281)

* update

* feat: added permissions & new column

* fix: rm unnessecary files

* fix: rm permission check

* feat(masterbots.ai): create password recovery (#282)

* feat:add-recovery-strategy

* chore:add nodeemailer

* upt:hasura

* upt:hasura

* upt:gmail service

* feat(hasura): otp, token table + junction w/user + mb-genql gen

* feat:add recovery password API

* fix:ai suggestion + UX

* feat:improve ux show password feat

* chore:env sample

* chore:useSetState

* chore:roles

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: WW API sanitize and keep alive (#284)

* keep-alive + API sanitize + timeOut guard

* impr streamAndValidateResponse fn

* wip(masterbots.ai): impr createImprovementPrompt

* style(masterbots.ai): chat loading states comments

* feat(masterbots.ai): add admin mode to approve thread (#283)

* feat:added mode toggle and approve btn

* feat: added migration for user role

* feat: user role flow implet

* fix: impr admin approve process

* fix: clean up

* fix: toggle CTA changed

* fix: update

* fix: update

* fix: observ

* fix: obs clean up

* fix: update

* fix: clean up

* impr(masterbots.ai): alpha metadata chatbot labels (#288)

* wip: metadata chatbot labels

* wip(masterbots.ai): chatbot metadata labels

* impr(masterbots.ai): gen chatMetadata

* impr: simplifying prompt defitions + biome.json base config

* impr(masterbots.ai): recursive improved text prompt

* style: code comments + eslint chk

* impr: biome.json config

* fix(masterbots.ai): conflicts typo fix

* style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup

* doc: map system (simplified)

* fix(masterbots.ai): sideBar updating URL (#286)

* fix:sideBar updating URL

* feat: coderabbit-ai suggestions

* fix: Implement auto-expanding sidebar categories and chatbot highlighting based on URL

* feat: optimize sidebar navigation with Link

* feat: thread options (#287)

* feat: added verified and label to the options

* usethreadvisibility as context

* feat: added option design  and functions

* fix: clean up

* fix: update

* fix: update

* fix: obsv

* fix: merge and update

* fix: update the delete popup

* fix: observ

* fix: update

* fix: delete thread flow

* update

* fix: update

* fix: types

* fix: chatbot not required

* fix: testing

* fix: rm bun.lock

* fix: clean up

* fix: update

* fix(masterbots.ai): temp freezing next version

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] feat: email verification (#289)

* feat: email verification

* feat: email verification

* feat: email verification

* upt:build

* feat: handle error redirection

* chore:cron task

* upt: cron blocking instead erasing

* feat(hasura): create social following table. (#292)

* feat(db): create social following table.

* create user following and followers relationships.

* fix(db): ensure users can only manage their own follow relationships.

* feat(db): social following and user table permissions improvements.

* feat(db): improving social following table with  timestamp and idx.

* impr(db): permissions and tracked object relationships.

* impr(db): avoid self follow.

* chore(masterbots.ai): guard WordWare for prod routing

* [masterbots.ai] fix: public/private tag bg on dark mode  (#294)

* fix: tag bg

* fix: text color

* fix: browse page error

* fix: debugging

* fix: debugging

* fix: debugging

* fix: added func to generate short link

* fix(hasura): upt user permissions (#296)

* update user permission

* fix: reverse the following table

* fix(hasura): build error (#297)

* fix: error build

* fix: reverse select perm

* [masterbots.ai] feat: thread list display + components comments for ai (#299)

* merged from develop

* feat:add new ui-thread-representation-browse

* feat:add comments for ai - C

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add app theme colors effects

* feat:add comments for ai - b/p

* [masterbots.ai] feat: chatbot search tool v0.1a (#295)

* wip: chatbot search tool

* wip(impr): ww api + chat ui tweaks

* fix: init sidebar load state

* fix: nesting layout

* fix: thread-popup ui header

* wip(impr): chatbot tooling

* impr: loading state + debug chatbot tools

* wip(fix): nodejs context

* fix(temp): rm edge runtime api config

* [masterbots.ai] feat: reorganize navigation menu for mobile view (#298)

* feat: reorganize navigation menu for mobile view

* UI: add sideBar style

* feat: add link profile and logout icon

* Update profile-sidebar.tsx

Tailwind class fix

* [masterbots.ai] feat: UI + Logic Improvements (#301)

* feat:impr responsive

* feat:impr password strenght checker

* feat:impr responsive

* upt-build

* feat:respomsive tweask

* feat:back arrow aria label

* fix:chat mobile layout

* fix:code section

* fix:chat pannel

* fix:chatBot redirection

* feat:restore appConfig header

* [masterbots.ai] fix: restore desktop navigation link - browse section (#303)

* fix:restore desktop navigation link - browse

* fix:formating

* feat:yellow combobox btn (JUN-REQUEST)

* glowing effect variant

* upt:removed /b navigation as original v

* feat:powerup mode + provider

* [masterbots.ai] fix(impr): browse and chat content search (#304)

* feat:browse title and content search

* feat:browse title and content search

* fix:typo

* impr:reusable non result component

* feat:skeletons

* feat:guard

* fix:skeletons

* fix:chat searching

* fix: add accent colour

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: seo sitemap (#306)

* chore: sitemap creation

* chore: add description based on category

* chore: update queries in services

* chore: truncate text

* impr: upt (browse)/[category]/[threadId]/sitemap.ts

coderabbitai code suggestion.

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

---------

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

* [masterbots.ai] impr: ai tools (#302)

* wip: ai tools

* fix: WW json regexp

* impr: simplifying main ai call

* wip(fix): chat component re-render + cleanup

* impr(refactor): chat hooks

* fix: ts build

* fix: ts build

* fix: ts typo

* fix: typo

* impr: ai feedbacks

* [masterbots.ai] wip(impr): web search (#309)

* impr: web search tool call

* fix: colour values

* fix: typo

* impr: code suggestions

* fix: class name typo

* wip(fix): web search false positive response + webSearch context

* fix: web search callback

* fix: typo

* feat: profile page (#300)

* feat: user card

* fix: update

* merge develop && update

* feat: user generate bio & favourite  topic

* fix: update user card

* feat: added profile sidebar

* fix: update

* update

* update

* update

* fix: fetch approved and public threads

* fix: fetch approved and public threads

* update

* fix: clean up and update

* update

* make fetch user work with bio

* update

* update

* design updating

* update

* update

* fix: few changes

* update

* fix: design update

* fix: footer in layout

* fix: update

* fix:  resercation

* update

* profile upload

* feat: move the cloudinary key to env

* fix: layout

* fix: layout update

* [masterbots.ai] fix: shallow routing for category & chatbots for  chat & profile page  (#313)

* update

* feat: added shallow link to the sidebar link

* update'

* fix: routing and content fetching

* fix:update on  routing

* fix:update

* update

* update

* update

* fix: clean up

* update

* update

* [masterbots.ai] feat: update ChatChatbotDetails (#314)

* feat: new bot profile - chat

* chore: dev comments

* chore: white bg bot avatar

* feat: add skeleton bot profile

* [masterbots.ai] feat: include custom settings options (#317)

* feat:relocation of theme switch(jun)

* feat: create font-size accessibility provider(jun)

* feat: r-sidebar theme switcher relocation + skeleton

* feat: impr add rem instead px

* [masterbots.ai] feat: integrate drizzle ORM (#320)

* feat: create mb-drizzle package initial structure

* feat:(masterbots.ai) add drizzle endpoint + service

* chore: include database url

* chore: upt mb-drizzle

* feat: refactor drizzle config + generations

* chore: impr migrate

* chore: add working drizzle connection + migrations

* feat: add centralized actions

* chore: add ai review recomendations

* chore: webSearch feature flag + use cloudinary upload preset

* fix: responsive sidebar fix

* fix: ts chk build

* fix: sidebar async call

* fix: ts build

* chore: typo

* [masterbots.ai] fix: browse category navigation (#316)

* update

* fix: rm category

* update

* fix: pop up on the user threads

* update

* update clean up

* update

* fix: clean up

* fix:  clean up and update

* fix: update

* fix: popup on navigation

* fix: update

* update

* update

* update

* clean up

* update

* merge

* fix: hasura thread delete + user dup permissions (#330)

* [masterbots.ai] feat: onboarding bot profile variants  (#324)

* add chatbot-details and browse-details variants

* feat: add bio generation

* feat: chat profile bg

* chore: update bot profile designs

* chore: remove internal padding from cardHeader component

* impr: iconography + border thickness

* fix: numberShortener util fn

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: user following  (#319)

* update

* added follow user

* update

* fix: upt hasura metadata databases, public_social_following.yaml

coderabbitai code suggestion.

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

* fix: upt masterbots.ai lib, utils.ts

coderabbitai suggestion.

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

* fix: user card

* update

* fix: permission

* update

* fix: added more column for chatbot followee

* fix:foloow chatbot implementation

* update

* threads by following user/bots

* update

* update

* update

* update

* update

* update

* update

* update

---------

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

* [masterbots.ai] impr: new sonner (#334)

* chore: add new icons

* feat: Sonner custom hooks and setup

* feat: use useSonner hook throughout the app

* fix: overflow of the width of the sonner

* chore: add new icons

* feat: Sonner custom hooks and setup

* feat: use useSonner hook throughout the app

* chore: use hook sonner

* refactor: changes according to coderabbitai

* refactor: update use of sonner

* chore:remove icons and use lucide icons

* chore: Using Lucide Icons

* chore: bun pkg mngr upt

* Standardize url building using urlbuilders utility (#341)

* fix: update url

* fix: url update

* update

* [masterbots.ai] impr: og Image api dynamic to be useful without thread ID (#335)

* update

* fix: make OG image use default

* fix: update

* fix: update

* fix: obs

* fix: update

* fix: added og to browse and chat

* update

* update

* update

* fix: provider types error

* fix: updfate UUID

* fix: update UUID

* [masterbots.ai] docs: hook useSonner (#343)

* chore: document hook useSonner

* refactor: document hook useSonner, according coderabbit

* impr: web search response (#310)

* impr: web search response

* refactor: extracting clickable generation logic

* refactor: extracting clickable generation logic

* fix: webSearch clickable text + reference links

* chore: fix build

* feat:(impr) stable version link to references format step 1

* feat:(impr) stable version link to references format step 2

---------

Co-authored-by: Bran18 <[email protected]>

* [masterbots.ai] refactor: prelaunch ux/ui changes (#336)

* refactor: replicate tooltip effect in desktop bot chatbot details

* fix: add guard and removed re-render

* fix: refactor mobile bot chatbot details

* refactor: make chatPannel bigger

* chore:add new bot card design + sidebar hover color

* chore: delete public and private sw + icons

* chore: include public + delete extra actions

* chore: add sidebar bg

* add sidebar new styles + lib fn

* feat: add select bot

* chore: cleaning

* fix: build - removing BotMessageSquareIcon

* fix: types/node version + node min ver req

---------

Co-authored-by: sheriffjimoh <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

---------

Co-authored-by: Gabo Esquivel <[email protected]>
Co-authored-by: Jimoh sherifdeen <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Anouk Rímola <[email protected]>
Co-authored-by: Trivium <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Luis Carrión <[email protected]>
Co-authored-by: Marco Ledezma <[email protected]>
Co-authored-by: Bran18 <[email protected]>
Co-authored-by: sheriffjimoh <[email protected]>
This was referenced Feb 11, 2025
AndlerRL added a commit that referenced this pull request Feb 19, 2025
* devops: force deploy

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* devops: trigger automated build

* impr(masterbots.ai): add return to browse on bot thread page view (#204)

* ✨ Added back button to thread details page

* ⚡️  changed char to svg

* feat: ai gen 404 image for custom 404 error page  (#210)

* ⚡️ added custom  error page

* ⚡️  clean up

* fix(masterbots.ai): terms page visibility and access

* feat(masterbots.ai): consistent og image style design and dynamic metadata  (#215)

* feat: added og api endpoint

* feat: design og image for dark mode

* fix: file formated

* fix: amend  og image to pick current theme color and adapt

* feat: added custom metadata to thread page

* feat: added custom metadata to bot page

* fix: clean up

* fix: move bg to a component

* fix: move og-image design  to a component

* fix: use variable for URL

* fix: to slug func

* ⚡️ Move and clean up UrlToSlug

* fix(masterbots.ai): zod dependecy

* fix: type error

* fix: type error for metadata

* fix: clean and build fix

---------

Co-authored-by: Roberto Lucas <[email protected]>

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* [masterbots.ai] fix: multi AI models guard (#235)

* fix-guards + dom warning

* fix-rename env var - vercel name

* chore(masterbots.ai): update payment terms & conditions (#233)

* fix: update terms

* fix:  building error

* fix: update terms content

* fix: rm the older part at the bottom

* feat(masterbots.ai): pro subscription payment + wizard (#226)

* feat: added free card

* feat: added animation to the plan card

* feat: added more plan card and referral code link

* fix: clean up

* wip: wizard

* feat: wizard & modal

* feat: plan Design theme and modal Header and Footer

* feat: plan clean up

* update

* clean up

* fix: rm plan comp on browse page

* fix: wizard clean up

* feat: succes & error modal

* feat: loading comp

* feat: added checkout comp

* feat: set up stripe and context

* wip: implementing subscription

* feat: implementing subscription

* feat: payment reciept

* fix: clean up receipt

* fix: modal not showing & shallow routing

* fix: small fix

* fix: receipt comp

* fix: clean up

* fix: shallow rerouting

* feat: check if user has an active subscription

* fix: coderabbit ob

* fix: coderabbit ob

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: coderabbit clean up update

* fix: clean up

* fix: clean up

* fix: page restructuring and status on the receipt

* fix: revamp receipt and structure

* fix: rm unused file

* fix: clean up

* fix: update & clean up

* fix: update

* fix: rm the svg

* fix: revamp formatSystemPrompts

* fix: revamp msg to formatSystemPrompts

* fix:  update

* fix:  refactor the receipt page

* fix: rm public key

* fix: update

* fix: update

* fix: update

* fix: code refactor for error and loading rendering

* ref: calling  secret keys from server

* ref: receipt page and small fix

* fix: rm file

* fix(impr): subs & flow ux + cleanup

* fix(masterbots.ai): OG not redering   (#224)

* fix: og to render first letter of username if there's no avatar

* fix: clean up

* fix: clean up

* fix(masterbots.ai): share function (#225)

* feat: create action.ts

* fix: upt share button

* fix: add axios module

* fix: add resend module

* fix: update vercel env config

* fix: split share function

* fix: update share component

* [coderabbitai] style: upt thread-user-actions condition

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

---------

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

* feat(hasura): update user db schema for pro users (#227)

* feat: add get_free_month column to user table

* feat: create referral table

* feat: add is_blocked column to user table

* feat: add pro_user_subscription_id  column to user table

* fix: upt metadata

* fix: update relationship name

* feat(hasura): add Ai Model Tracker To Threads (#229)

* feat: create 'models' table AI models

* fix: add 'model' column to 'thread' table with foreign key constraint

* feat: add model_value into models

* [masterbots.ai] feat: multi AI models integration (#228)

* [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoader

* [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders

* [masterbots.ai]feat:(multimodels-integration)add new chat components

* [masterbots.ai]chore:next version

* [masterbots.ai]feat:(multimodels-integration)update use context

* [masterbots.ai]feat:(multimodels-integration)icons update

* [masterbots.ai]chore:command ui

* [masterbots.ai]refactor:moving chat componets to folder

* [masterbots.ai]feat:env checker

* [masterbots.ai]feat:env guard

* docs: site map diagram

* feat: set up stripe and context

* wip: implementing subscription

* fix: rm the svg

* fix: replace secret with variable

* fix: chat restructure

* fix(update): chat restructure

* fix(deployment error): can't find an  icon or not exported

* fix: deployment issues

* fix: deployment issues

* fix: deployment issues

* fix: adjust design

* fix: clean up

* fix: clean up

* fix: color var updaye

* [coderabbitai] impr: update apps/masterbots.ai/components/stripe-element.tsx

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

* [coderabitai] impr: update apps/masterbots.ai/components/succes-content.tsx

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

* fix: success close button

* fix: bg image for yearly card

* fix: move func to util

* ref: receipt page function to use reac-use

* fix: move depencies to the app

* fix: clean up

* ref: wizard to use radix dialog components

* update

* fix: coderabitai update

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>

* [masterbots.ai] fix: llama3 models  (#236)

* fix-guards + dom warning

* fix-rename env var - vercel name

* fix-changed PERPLEXITY-LLama model

* [masterbots.ai] impr(fix): ui tweaks (#237)

* fix(UI):varius UI fixes

* fix(UI):varius UI fixes

* fix(UI): Tailwind class corrections, conflict resolution, text alignent to the left

* fix(UI):update

* fix(masterbots.ai): payment feedbacks (#240)

* fix: make the dialog content responsive

* fix: free plan card adjusted

* fix: update

* fix: update receipt styles

* fix: build error

* fix: build error

* fix: build error update

* fix: update

* fix: observation

* fix(masterbots.ai): update env variable (#244)

* feat: sitemap (#238)

* feat: add redirection rules

* fix: update all links with new shorten urls

* fix: update all links with new shorten urls

* feat: make folder structure according to sitemap

* [coderabbitai] impr(masterbots.ai): update app/c/page.tsx error handling

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

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* fix: build error

* [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling

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

* feat: add sitemap and metagraph

* fix: use original generateMetadata

* fix: update page links

* fix: show only filtered threads on page reload

* fix: build error

---------

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

* fix(masterbots.ai): show first question & answer in thread list (#246)

* feat: add 'disabled' state to ChatAccordion

* fix: show default question's answer in thread list

* fix: use braces and create explicit statement blocks

* fix: subscription mobile responsive tweaks (#245)

* update

* fix: update

* fix: responsiveness

* fix: update

* fix: few clean up

* fix: rm unused image

* fix: rm unused image

* fix(impr): models enum table migrations (#247)

* impr(hasura): db tables

* impr(hasura): db tables

* fix(hasura): user permissions

* impr(hasura): sql models enum migration

* fix(hasura): models_enum pk

* fix(hasura): ci/cd default regional log bucket

* docs: bun to requirements (#250)

Co-authored-by: b <b>

* feat: next auth, email/pw strategy (#249)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* docs: mb sytem diagram v1.0a

* feat(impr): next auth environment helper function (#251)

* (masterbots.ia)-chore-auth-dependencies

* (masterbots.ia)-feat-webauth-nextauth

* wip(masterbots.ai): email/pw login + signup

* feat-login ui

* feat-login-component+page

* feat-login-component+page

* feat-auth-middleware.ts

* feat-auth-nextauth + googleauth

* feat-auth-coderabit-feedback

* feat-auth-callback + elements added

* wip(webapp): email/pw login+signup

* feat:add toke storage for webauth

* feat:updates webauth

* feat:updates webauth

* fix(masterbots.ai): blankBot fetch

* feat:protecting env

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Romero Lucas <[email protected]>

* impr(masterbots.ai): sign up form + sign in session data

* docs: claude3 project knowledge docs

* fix(masterbots.ai): devMode conditional

* chore(masterbots.ai): rm console.log

* chore: upt default hardcoded gpt model

* fix: toSlug imports

* fix: typo

* fix(hasura): seeds

* chore(impr): MB seeds update and upgrade (#253)

* wip: upt seeds

* chore: rm alter and table creations

* chore(impr): MB seeds update and upgrade

* fix: set thread to private by default

* fix: prompt row typo

* chore(hasura): seeds update default thread publicity

* fix(masterbots.ai): adjust arrow direction in thread list (#255)

* feat(impr): Vercel AI SDK Update (#256)

* chore:ai version upt

* chore:ai version upt

* upt-ai delete

* upt-ai versions

* upt-sdk-actions

* upt-complete-sdk-3.3 + dev notes

* upt-@anthropic-ai/sdk + MessageParam

* Delete apps/masterbots.ai/apps/masterbots.ai/package.json

* Delete apps/masterbots.ai/apps/masterbots.ai/package-lock.json

* impr-convertToCoreMessages ternary

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* fix(masterbots): google signIn (#260)

* fix(masterbots.ai): fix thread-component loop (#261)

* fix:(masterbots.ai) add useScroll hook (#263)

* fix:introducing Two-phase scroll

* impr: new hook to handle scrolling

* impr: useScroll + respo

* feat(masterbots.ai): chat sidebar filtering (#264)

* sidebar refactor with ai

* fix: sidebar AI V - Prev Jun (#262)

* fix:semistable

* fix:stable v

* impr:delete nonused component

* fix: upt category filtering

* fix typo

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: sidebar state

* fix(masterbots.ai): logic typo

* fix(masterbots.ai): ts typo

---------

Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>

* fix(masterbots.ai): bot button redirect change (#265)

* wip(masterbots.ai): seo data impr (#267)

* wip: seo data impr

* impr(chore): ga tags

* feat: add chat publicity trigger (#258)

* update

* feat: design thread visibilty

* fix: added the backend

* fix: added the backend

* fix: rm files

* fix: few clean up

* fix(masterbots): google signIn (#260)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* fix: update

* fix: add permission

* fix: update query

* fix(masterbots.ai): fix thread-component loop (#261)

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* Leandro/develop (#257)

* chore: create thread-component to avoid to become thread list into a client component

* refactor: remove unnecesary hooks from thread component

* refactor: remove unnecesary hooks on thread componen

* impr(masterbots): components folder structur (#259)

* impr:refactor components folders + names + imports

* hotfix:chat-list useEffect dependency removal

* feat: design thread visibilty

* fix: added the backend

* fix: few clean up

* update

* fix: update

* fix: publicity toggle

* fix: error catch in the functions

* fix: observations

* fix: design impr

* fix: thread pop-up height

* chore(masterbots.ai): log rm & app version upt

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* feat(masterbots.ai): user messages ai refactor (#266)

* feat:userMessages refactor + hooks and utils

* upt:rm console.log

* fix:rollback useAiChat hook

* fix:rollback - actions

* fix(masterbots.ai): sidebar trigger

* chore(hasura: s

---------

Co-authored-by: Roberto Lucas <[email protected]>

* wip: browse sidebar

* impr(masterbots.ai): browse sidebar (#270)

* fix: browse layout

* feat(masterbots.ai): browse sidebar

* fix: browse sidebar link condition

* chore: upt signup default profile pic

* chore: seeds upt (#269)

* wip: seeds upt

* chore(hasura): seeds review

* feat(hasura): add "is_approved" thread field + seeds

* chore: mb-genql upt

* fix(hasura): thread param permission

* fix(masterbots.ai): typo

* fix(masterbots.ai): allow svg content-type

* fix: chat + browse layout

* style: clean up

* Seo data (#273)

* fix: build error

* feat: Add SEO data to the chat page

* feat: add default image, if not found

* feat: Add SEO data to the browse page

* fix: generates the image with error, in api/og

* Update route.tsx

fix: generates the image with error, in api/og

* impr(masterbots.ai): title impr prompt

* impr(masterbots.ai): improve current features v2 (#274)

* add-impr-chat-prompt-footer-header-disclaimer

* add-impr-chat-prompt-footer-header-disclaimer

* add-UI-upt

* add-UI-upt

* add-action-prompt

* add-clickable-upt

* add-clickable-upt

* Masterbots/fix redirects (#275)

* fix:avatar-redirects

* fix:avatar-redirect

* fix(masterbots.ai): upt components/ui/button.tsx

Coderabbitai suggestion.

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

* fix:URL correction

---------

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

* [masterbots.ai] feat: wordware api (#276)

* feat: add wordware api + vercel sdk strategy

* feat: add wordware api + vercel sdk

* wordware describe feat

* wordware run + interface

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* impr(masterbots.ai): upt /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

* fix(masterbots.ai): typo /api/wordware/describe/route.ts

coderabbitai code suggestion.

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

---------

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

* doc: mb system diagram upt

* wip: icl calls integrations

* impr(masterbots.ai): permission for thread & user action mode (#281)

* update

* feat: added permissions & new column

* fix: rm unnessecary files

* fix: rm permission check

* feat(masterbots.ai): create password recovery (#282)

* feat:add-recovery-strategy

* chore:add nodeemailer

* upt:hasura

* upt:hasura

* upt:gmail service

* feat(hasura): otp, token table + junction w/user + mb-genql gen

* feat:add recovery password API

* fix:ai suggestion + UX

* feat:improve ux show password feat

* chore:env sample

* chore:useSetState

* chore:roles

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: WW API sanitize and keep alive (#284)

* keep-alive + API sanitize + timeOut guard

* impr streamAndValidateResponse fn

* wip(masterbots.ai): impr createImprovementPrompt

* style(masterbots.ai): chat loading states comments

* feat(masterbots.ai): add admin mode to approve thread (#283)

* feat:added mode toggle and approve btn

* feat: added migration for user role

* feat: user role flow implet

* fix: impr admin approve process

* fix: clean up

* fix: toggle CTA changed

* fix: update

* fix: update

* fix: observ

* fix: obs clean up

* fix: update

* fix: clean up

* impr(masterbots.ai): alpha metadata chatbot labels (#288)

* wip: metadata chatbot labels

* wip(masterbots.ai): chatbot metadata labels

* impr(masterbots.ai): gen chatMetadata

* impr: simplifying prompt defitions + biome.json base config

* impr(masterbots.ai): recursive improved text prompt

* style: code comments + eslint chk

* impr: biome.json config

* fix(masterbots.ai): conflicts typo fix

* style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup

* doc: map system (simplified)

* fix(masterbots.ai): sideBar updating URL (#286)

* fix:sideBar updating URL

* feat: coderabbit-ai suggestions

* fix: Implement auto-expanding sidebar categories and chatbot highlighting based on URL

* feat: optimize sidebar navigation with Link

* feat: thread options (#287)

* feat: added verified and label to the options

* usethreadvisibility as context

* feat: added option design  and functions

* fix: clean up

* fix: update

* fix: update

* fix: obsv

* fix: merge and update

* fix: update the delete popup

* fix: observ

* fix: update

* fix: delete thread flow

* update

* fix: update

* fix: types

* fix: chatbot not required

* fix: testing

* fix: rm bun.lock

* fix: clean up

* fix: update

* fix(masterbots.ai): temp freezing next version

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] feat: email verification (#289)

* feat: email verification

* feat: email verification

* feat: email verification

* upt:build

* feat: handle error redirection

* chore:cron task

* upt: cron blocking instead erasing

* feat(hasura): create social following table. (#292)

* feat(db): create social following table.

* create user following and followers relationships.

* fix(db): ensure users can only manage their own follow relationships.

* feat(db): social following and user table permissions improvements.

* feat(db): improving social following table with  timestamp and idx.

* impr(db): permissions and tracked object relationships.

* impr(db): avoid self follow.

* chore(masterbots.ai): guard WordWare for prod routing

* [masterbots.ai] fix: public/private tag bg on dark mode  (#294)

* fix: tag bg

* fix: text color

* fix: browse page error

* fix: debugging

* fix: debugging

* fix: debugging

* fix: added func to generate short link

* fix(hasura): upt user permissions (#296)

* update user permission

* fix: reverse the following table

* fix(hasura): build error (#297)

* fix: error build

* fix: reverse select perm

* [masterbots.ai] feat: thread list display + components comments for ai (#299)

* merged from develop

* feat:add new ui-thread-representation-browse

* feat:add comments for ai - C

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add comments for ai - b/p

* feat:add app theme colors effects

* feat:add comments for ai - b/p

* [masterbots.ai] feat: chatbot search tool v0.1a (#295)

* wip: chatbot search tool

* wip(impr): ww api + chat ui tweaks

* fix: init sidebar load state

* fix: nesting layout

* fix: thread-popup ui header

* wip(impr): chatbot tooling

* impr: loading state + debug chatbot tools

* wip(fix): nodejs context

* fix(temp): rm edge runtime api config

* [masterbots.ai] feat: reorganize navigation menu for mobile view (#298)

* feat: reorganize navigation menu for mobile view

* UI: add sideBar style

* feat: add link profile and logout icon

* Update profile-sidebar.tsx

Tailwind class fix

* [masterbots.ai] feat: UI + Logic Improvements (#301)

* feat:impr responsive

* feat:impr password strenght checker

* feat:impr responsive

* upt-build

* feat:respomsive tweask

* feat:back arrow aria label

* fix:chat mobile layout

* fix:code section

* fix:chat pannel

* fix:chatBot redirection

* feat:restore appConfig header

* [masterbots.ai] fix: restore desktop navigation link - browse section (#303)

* fix:restore desktop navigation link - browse

* fix:formating

* feat:yellow combobox btn (JUN-REQUEST)

* glowing effect variant

* upt:removed /b navigation as original v

* feat:powerup mode + provider

* [masterbots.ai] fix(impr): browse and chat content search (#304)

* feat:browse title and content search

* feat:browse title and content search

* fix:typo

* impr:reusable non result component

* feat:skeletons

* feat:guard

* fix:skeletons

* fix:chat searching

* fix: add accent colour

---------

Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] impr: seo sitemap (#306)

* chore: sitemap creation

* chore: add description based on category

* chore: update queries in services

* chore: truncate text

* impr: upt (browse)/[category]/[threadId]/sitemap.ts

coderabbitai code suggestion.

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

---------

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

* [masterbots.ai] impr: ai tools (#302)

* wip: ai tools

* fix: WW json regexp

* impr: simplifying main ai call

* wip(fix): chat component re-render + cleanup

* impr(refactor): chat hooks

* fix: ts build

* fix: ts build

* fix: ts typo

* fix: typo

* impr: ai feedbacks

* [masterbots.ai] wip(impr): web search (#309)

* impr: web search tool call

* fix: colour values

* fix: typo

* impr: code suggestions

* fix: class name typo

* wip(fix): web search false positive response + webSearch context

* fix: web search callback

* fix: typo

* feat: profile page (#300)

* feat: user card

* fix: update

* merge develop && update

* feat: user generate bio & favourite  topic

* fix: update user card

* feat: added profile sidebar

* fix: update

* update

* update

* update

* fix: fetch approved and public threads

* fix: fetch approved and public threads

* update

* fix: clean up and update

* update

* make fetch user work with bio

* update

* update

* design updating

* update

* update

* fix: few changes

* update

* fix: design update

* fix: footer in layout

* fix: update

* fix:  resercation

* update

* profile upload

* feat: move the cloudinary key to env

* fix: layout

* fix: layout update

* [masterbots.ai] fix: shallow routing for category & chatbots for  chat & profile page  (#313)

* update

* feat: added shallow link to the sidebar link

* update'

* fix: routing and content fetching

* fix:update on  routing

* fix:update

* update

* update

* update

* fix: clean up

* update

* update

* [masterbots.ai] feat: update ChatChatbotDetails (#314)

* feat: new bot profile - chat

* chore: dev comments

* chore: white bg bot avatar

* feat: add skeleton bot profile

* [masterbots.ai] feat: include custom settings options (#317)

* feat:relocation of theme switch(jun)

* feat: create font-size accessibility provider(jun)

* feat: r-sidebar theme switcher relocation + skeleton

* feat: impr add rem instead px

* [masterbots.ai] feat: integrate drizzle ORM (#320)

* feat: create mb-drizzle package initial structure

* feat:(masterbots.ai) add drizzle endpoint + service

* chore: include database url

* chore: upt mb-drizzle

* feat: refactor drizzle config + generations

* chore: impr migrate

* chore: add working drizzle connection + migrations

* feat: add centralized actions

* chore: add ai review recomendations

* chore: webSearch feature flag + use cloudinary upload preset

* fix: responsive sidebar fix

* fix: ts chk build

* fix: sidebar async call

* fix: ts build

* chore: typo

* [masterbots.ai] fix: browse category navigation (#316)

* update

* fix: rm category

* update

* fix: pop up on the user threads

* update

* update clean up

* update

* fix: clean up

* fix:  clean up and update

* fix: update

* fix: popup on navigation

* fix: update

* update

* update

* update

* clean up

* update

* merge

* fix: hasura thread delete + user dup permissions (#330)

* [masterbots.ai] feat: onboarding bot profile variants  (#324)

* add chatbot-details and browse-details variants

* feat: add bio generation

* feat: chat profile bg

* chore: update bot profile designs

* chore: remove internal padding from cardHeader component

* impr: iconography + border thickness

* fix: numberShortener util fn

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: user following  (#319)

* update

* added follow user

* update

* fix: upt hasura metadata databases, public_social_following.yaml

coderabbitai code suggestion.

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

* fix: upt masterbots.ai lib, utils.ts

coderabbitai suggestion.

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

* fix: user card

* update

* fix: permission

* update

* fix: added more column for chatbot followee

* fix:foloow chatbot implementation

* update

* threads by following user/bots

* update

* update

* update

* update

* update

* update

* update

* update

---------

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

* [masterbots.ai] impr: new sonner (#334)

* chore: add new icons

* feat: Sonner custom hooks and setup

* feat: use useSonner hook throughout the app

* fix: overflow of the width of the sonner

* chore: add new icons

* feat: Sonner custom hooks and setup

* feat: use useSonner hook throughout the app

* chore: use hook sonner

* refactor: changes according to coderabbitai

* refactor: update use of sonner

* chore:remove icons and use lucide icons

* chore: Using Lucide Icons

* chore: bun pkg mngr upt

* Standardize url building using urlbuilders utility (#341)

* fix: update url

* fix: url update

* update

* [masterbots.ai] impr: og Image api dynamic to be useful without thread ID (#335)

* update

* fix: make OG image use default

* fix: update

* fix: update

* fix: obs

* fix: update

* fix: added og to browse and chat

* update

* update

* update

* fix: provider types error

* fix: updfate UUID

* fix: update UUID

* [masterbots.ai] docs: hook useSonner (#343)

* chore: document hook useSonner

* refactor: document hook useSonner, according coderabbit

* impr: web search response (#310)

* impr: web search response

* refactor: extracting clickable generation logic

* refactor: extracting clickable generation logic

* fix: webSearch clickable text + reference links

* chore: fix build

* feat:(impr) stable version link to references format step 1

* feat:(impr) stable version link to references format step 2

---------

Co-authored-by: Bran18 <[email protected]>

* [masterbots.ai] refactor: prelaunch ux/ui changes (#336)

* refactor: replicate tooltip effect in desktop bot chatbot details

* fix: add guard and removed re-render

* fix: refactor mobile bot chatbot details

* refactor: make chatPannel bigger

* chore:add new bot card design + sidebar hover color

* chore: delete public and private sw + icons

* chore: include public + delete extra actions

* chore: add sidebar bg

* add sidebar new styles + lib fn

* feat: add select bot

* chore: cleaning

* fix: build - removing BotMessageSquareIcon

* fix: types/node version + node min ver req

---------

Co-authored-by: sheriffjimoh <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] feat: continuous thread ui functionality (#340)

* wip: continuos thread logic and functionality.

* feat: updating parent thread functionality.

* feat: continuous thread UI and finalize functionality.

* fix: lowering resolveThreadId logic complexity.

* Update apps/hasura/migrations/masterbots/1736934906237_set_fk_public_thread_parent_thread/down.sql

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

* Update apps/masterbots.ai/lib/hooks/use-mb-chat.ts

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

* fix: ts build

---------

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

* [masterbots.ai] fix: refactored components - pre icl v3 (#348)

* chore: add refactored components - pre icl v3

* chore: add navigation color + text-input color

* fix: type

* wip: header active state

* fix: them toggle

---------

Co-authored-by: Roberto Lucas <[email protected]>

* feat: icl v1a (#344)

* wip: vercel ai sdk upt

* wip: icl web feature

* chore: icl hasura migrations, metadata and seeds

* chore: genql gen

* impr: chat opt separator render

* impr: accordion chevron pos

* impr: chat-list space

* Fix observations from Jun (#353)

* update

* fix: update

* fix: added empty state

* fix: rm favourt and added card empty state

* fix: hide sibe category without threads on user profile

* fix: update

* fix: update

* [masterbots.ai] fix: reduce prompt input validation

* fix: hasura moderator augmentedFrom msg prop

* impr: ai prompt examples flow

* fix: hasura moderator role thread upt permissions

* [masterbots.ai] feat: chatbot following + thread highlight + bot thread page to blog  (#337)

* update

* feat: added chatbot follow function to other component

* update profile thread

* thread highligh

* thread highligh update

* update

* fix: thread blog

* fix: follow chat bot

* update

* fix: observations

* fix provider types issue

* fix provider update

* feat: update blog template

* fix: rm p tag from list items

* fix: merge

* fix: rm parentid and continiue reading

* update

* update

* merge

* fix: generated types

* update

* updatd

* update code

* impr: profile page layout

* fix: mg-genql gen ts

---------

Co-authored-by: Roberto Lucas <[email protected]>
Co-authored-by: Roberto Lucas <[email protected]>

* [masterbots.ai] fix: init threads render + icl init cleanup (#354)

* wip: fix init threads render + icl cleanup

This fixes the following issues:

1. Reduced the amount of re-renders when sending the new data.
2. Clean up the ICL functions and types.
3. State management for the user-thread-panel.
4. Debug the re-rendering uissue that is replacing the main thread content.
5. Debug opening a new thread with the new ICL system. They show in the list but not returning the messages when opening it up.
6. Few code clean ups.

* impr: thread list re-render in chat page

* fix: initialMessages in useChat

* fix: hasura moderator role thread upt permissions

* impr: thread list re-render

* fix: markdown pkg ts

* fix: markdown pkg ts

* fix: downgrade react-markdown (#358)

* fix: downgrade react-markdown

* fix: downgrade react-markdown

* fix: markdown dep version + layout thread list ui

* impr: gray-ish overlay bg rm

* chore: console log rm

---------

Co-authored-by: Roberto Lucas <[email protected]>

* refactor: icl seeds v2 (#357)

* chore: upt hasura icl seeds

* chore: chat legacy table rm

* chore(wip): icl seeds curation

* chore: upt icl init seed pt2

* chore: upt icl init seed pt3

* chore: upt icl init seed pt3

* chore: upt icl init seed pt4

* fix: cat + chatbot seeds revision

* chore: tag seeds note upt

* fix: drop and create chatbot_domain table (#360)

* fix: drop and create chatbot_domain table

* fix: chatbot_domain permissions

* fix: SQL typo

* [masterbots.ai] feat: improve common components and features (#356)

* fix: sidebar

* feat: add DeepSeek integration

* chore: wip accordions

* fix: include popup accordion

* chore: add shared accordion to thread list

* fix: extra space

* fix: extra space

* chore: add tabs effect

* chore: add colors based on routes

* chore: add colors based on routes

---------

Co-authored-by: Roberto Lucas <[email protected]>

* fix: useRouter import

* [masterbots.ai] fix: sidebar category render (#362)

* fix: sidebar category render

* docs: toggleChatbotSelection

* [hasura] chore: label + label_chatbot_category_domain dropping tables migration (#361)

* fix: fetch chatbotDomain

* [hasura] chore: rm wip example seed part

* chore: rm legacy tables  + fix getChatbotMetadata props (#363)

* chore: rm legacy tables

* fix: getChatbotMetadata

* fix: chatbotMetadata ts

* wip(refactor): icl init tags & categories fetch

* chore: bun.lockb upt

* fix: hotfix build error

* impr: icl metadata requests v1 (#365)

* wip: icl fetch + meta prompt impr

* impr: sidebar paddings

* wip: icl fetch + meta prompt impr

* wip: icl fetch + meta prompt impr

* impr: icl metadata request v2 (#366)

* wip: icl fetch + meta prompt impr

* fix: icl fetch + meta prompt impr

* impr: icl output + prompts

* chore: console.log rm

* chore: console.log icl metadata devMode

* [masterbots.ai] test: sytem prompt as user role

* fix: show sidebar in profile (#364)

* chore: clickable responses update

* [masterbots.ai] refactor: use chat hook context + state management perf (#369)

* chore: system prompt as system role

* refactor: use-mb-chat to context

* fix: mbchat provider location

* impr: profile page scroll & footer position (#367)

* update

* fix: update

* update

* update

* fix: profile page scroll and footer positioning

* fix: profile sidebar

* update

* update

* Revert "update"

This reverts commit ef7ee8c.

* Revert "Revert "update""

This reverts commit 553f82f.

* Revert "Revert "Revert "update"""

This reverts commit c645eca.

* fix: profile page  footer positioning

* fix: visitor should be  able to scroll through the categories

* fix: profile page side bar

* fix: rm loading when user not logged in

* fix: update

* [masterbots.ai] fix: clickable text feature (#372)

* fix: accordion arrow

* fix: clickable text formating

* wip: fix thread load (#373)

* wip: fix thread-list load

* fix: continuous system prompt context

* fix: render flickr + followup question logic impr

* impr: prompt tags segmentation

* chore: impr following question prompt

* feat: public continue thread (#375)

* refactor: integrating chatPannelHeader into chatPannel

* chore: update browse-chat-message with shared accordion

* chore: continue conversation + full conversations fix

* fix: left align text

* [masterbots.ai] fix: show appropriate bot cards in the user thread list (#368)

* update

* fix: update

* update

* update

* fix: filter category & chatbot by userId on profile page

* fix: hide empty chatbots

* fix: followee permission error as moderator to follow and unfollow (#374)

* update

* fix: update

* update

* update

* fix: permission issue for moderator when following other user

* fix: shift on user card when loading or empty

* update

* [masterbots.ai] fix: isNewChat guard + continuous thread messages + power up prompts (#377)

* fix: thread render at pop-up close

* impr: getRouteType + chat layout

* wip: isNewChat state

* impr: prompt tags segmentation

* fix: chat messages list render + open last according by default on new responses

* impr: thread list render guard

* feat(wip): isPowerUp mode

* impr: memoizing getChatbotMetadata

* fix: grabbing previous messages, continous chat

* chore: add todo comment

* impr: previous thread ui + coderabbitai observations

* fix: previous conversation re-render

* doc: useEffect biome-ignore

* impr: deep obj compare for msg pairs

* fix: ts build

* fix: ts build

* [masterbots.ai] refactor: useScroll hook (#376)

* chore: refactor useScroll

* chore: refactor useScroll

* chore: refactor useScroll

* Delete apps/masterbots.ai/lib/context/thread-context.tsx

* chore: test commit

* fix: import type

* chore: add clearTimeout

* chore: add destructuring

* feat: update use-mb-scroll

* feat: update thread component

---------

Co-authored-by: Brandon fernandez <[email protected]>

* [masterbots.ai] fix: chat stream render (#380)

* fix: chat stream render

* fix: typo

* chore: chatbot prompts init config + active thread hotfixes (#378)

* wip: chatbot prompts init config

* wip: upt init config seeds, adding prompt configs

* chore: upt init config seeds

* fix: resetActiveThread guard

* impr(wip): masterbot config prompt

* chore: icl data curation, domain + category + sub-category

* chore: init domain seeds curation

* fix: moderator + user role table selection

* impr: web prompt config + fix thread list render + code comments

* fix: coderabbitai observations

* [hasura] chore: upt user insert rows seed

* fix: conflict fix

---------

Co-authored-by: Gabo Esquivel <[email protected]>
Co-authored-by: Jimoh sherifdeen <[email protected]>
Co-authored-by: Nathanael Liu <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Brandon Fernández <[email protected]>
Co-authored-by: Anouk Rímola <[email protected]>
Co-authored-by: Trivium <[email protected]>
Co-authored-by: Leandro Gavidia Santamaria <[email protected]>
Co-authored-by: Jun Dam <[email protected]>
Co-authored-by: Luis Carrión <[email protected]>
Co-authored-by: Marco Ledezma <[email protected]>
Co-authored-by: Bran18 <[email protected]>
Co-authored-by: sheriffjimoh <[email protected]>
Co-authored-by: Brandon fernandez <[email protected]>
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.

Profile Page: Implement Shallow Routing to Fix Navigation and UI/UX Issues
2 participants