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

New sonner #334

Merged
merged 13 commits into from
Jan 14, 2025
Merged

New sonner #334

merged 13 commits into from
Jan 14, 2025

Conversation

luighis
Copy link
Contributor

@luighis luighis commented Dec 24, 2024

Summary by Sourcery

Replace toast notifications with Sonner

New Features:

  • Introduce a custom Sonner hook to display different types of toast notifications with icons.

Tests:

  • Update tests to accommodate the changes from toast to Sonner.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a custom notification system using Sonner library
    • Enhanced error and success message handling across the application
  • Improvements

    • Replaced react-hot-toast with a more flexible notification mechanism
    • Updated notification styling and configuration
    • Improved code readability and consistency in various components
  • Dependency Updates

    • Upgraded next-themes to version 0.4.4
    • Added sonner library version 1.7.1
    • Removed react-hot-toast dependency
  • Technical Enhancements

    • Updated Tailwind CSS configuration to include lib directory
    • Standardized error handling across multiple components

@luighis luighis requested a review from AndlerRL December 24, 2024 04:42
Copy link

sourcery-ai bot commented Dec 24, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new toast notification system using the sonner library, replacing the previous react-hot-toast implementation. It also includes minor UI updates and code cleanup.

Sequence diagram for the new toast notification flow

sequenceDiagram
    participant U as User
    participant C as Component
    participant S as useSonner Hook
    participant T as Sonner Toast

    U->>C: Triggers action
    C->>S: customSonner({ type, text })
    S->>S: Configure toast based on type
    S->>T: toast.custom()
    T-->>U: Display notification
    U->>T: Click dismiss button
    T-->>U: Remove notification
Loading

Class diagram for the new sonner implementation

classDiagram
    class useSonner {
        +customSonner(props: customSonnerProps)
    }

    class customSonnerProps {
        +type: 'success'|'error'|'info'
        +text: string|null
    }

    class Toaster {
        +theme: string
        +className: string
        +toastOptions: object
    }

    class Icons {
        +SuccessIcon
        +InfoIcon
        +ErrorIcon
        +CloseIcon
    }

    useSonner ..> customSonnerProps
    useSonner ..> Icons
    Toaster ..> useSonner
Loading

File-Level Changes

Change Details Files
Replaced react-hot-toast with sonner for toast notifications.
  • Imported useSonner hook and replaced toast calls with customSonner function.
  • Implemented a custom useSonner hook to handle different toast types and styling.
  • Added sonner to the project dependencies.
  • Added a Toaster component to the main layout.
  • Updated styling for toast notifications in globals.css and sonner.tsx.
  • Added new icons for toast notifications: SuccessIcon, InfoIcon, ErrorIcon, CloseIcon.
apps/masterbots.ai/components/routes/profile/user-card.tsx
apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx
apps/masterbots.ai/components/auth/signup-form.tsx
apps/masterbots.ai/components/auth/reset-password-form.tsx
apps/masterbots.ai/components/auth/forgot-password-form.tsx
apps/masterbots.ai/components/routes/chat/chat-options.tsx
apps/masterbots.ai/components/routes/chat/new-chat.tsx
apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx
apps/masterbots.ai/lib/hooks/use-mb-chat.ts
Minor UI updates and code cleanup.
  • Improved code readability and formatting.
  • Removed unnecessary code and comments.
  • Updated component styling for better UI consistency.
  • Simplified logic in some components.
apps/masterbots.ai/components/routes/profile/user-card.tsx
apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx
apps/masterbots.ai/components/auth/signup-form.tsx
apps/masterbots.ai/components/layout/sidebar/sidebar-actions.tsx
apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx
apps/masterbots.ai/lib/hooks/use-profile.tsx

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

Copy link

vercel bot commented Dec 24, 2024

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

Name Status Preview Comments Updated (UTC)
masterbots ❌ Failed (Inspect) Jan 14, 2025 5:13am

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

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/lib/hooks/useSonner.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.

Walkthrough

This pull request introduces a comprehensive migration from react-hot-toast to a custom notification system using the sonner library. The changes span multiple files across the MasterBots.ai application, replacing toast notifications with a new customSonner method. Additionally, the PR includes minor CSS modifications, package dependency updates, and code formatting improvements. The primary focus is on enhancing the notification handling mechanism while maintaining the existing application functionality.

Changes

File Change Summary
apps/masterbots.ai/app/globals.css Added CSS rules to modify color and display properties for .p-FieldLabel.Label, .Tab, .Label, and .input classes
apps/masterbots.ai/app/layout.tsx Updated Toaster import and simplified its usage
apps/masterbots.ai/components/auth/* Replaced toast notifications with customSonner in forgot-password, reset-password, and signup forms
apps/masterbots.ai/components/routes/* Migrated notification handling to customSonner in chat, profile, and browse components
apps/masterbots.ai/lib/hooks/* Added useSonner hook and updated error handling in various hooks
apps/masterbots.ai/package.json Updated dependencies, removing react-hot-toast and adding sonner
apps/masterbots.ai/tailwind.config.js Added ./lib/**/*.{ts,tsx} to content scanning paths

Sequence Diagram

sequenceDiagram
    participant Component
    participant useSonner
    participant Sonner
    
    Component->>useSonner: Call customSonner
    useSonner->>Sonner: Prepare toast configuration
    Sonner-->>Component: Display notification
Loading

Possibly related PRs

Suggested Labels

enhancement, feature

Suggested Reviewers

  • AndlerRL

Poem

🐰 Hop, hop, toast goodbye!
Sonner's here to make notifications fly
No more hot toasts, just clean and bright
Custom messages dancing with delight
A rabbit's code, smooth and light! 🎉


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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

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

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 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.

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

🧹 Nitpick comments (17)
apps/masterbots.ai/lib/hooks/use-profile.tsx (1)

Line range hint 1-1: Avoid using 'any' return type in getuserInfo.
Static analysis flags the “Promise” usage. Consider returning a more explicit type (e.g., Promise or a user-defined interface) to leverage TypeScript’s validation and clarify the shape of the returned data.

-getuserInfo: (username: string) => Promise<any>
+interface UserInfo {
+  user: User;
+  // add other fields needed from the backend
+}
+
-getuserInfo: (username: string) => Promise<any>
+getuserInfo: (username: string) => Promise<UserInfo>
🧰 Tools
🪛 Biome (1.9.4)

[error] 10-10: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)


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

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

(lint/style/useImportType)

apps/masterbots.ai/lib/hooks/use-mb-chat.ts (5)

59-59: Check the destructuring name for clarity.
Using { customSonner } is fine, but consider a more descriptive, standardized name or re-exporting it as a default to keep your imports consistent and easily identifiable across the codebase.


121-121: Validate potential missing statusText.
When the server responds with an error condition but no “statusText,” this could lead to unhelpful or empty messages. Add a fallback if statusText is missing or empty.

- customSonner({ type: 'error', text: response.statusText })
+ customSonner({ 
+   type: 'error', 
+   text: response.statusText || 'Something went wrong. Please try again.' 
+ })

157-157: Increase debugging visibility with tool calls.
Consider including more context in the tool call notification for debugging, such as parameters or user ID, to streamline tracing issues.


162-163: Enhance user feedback for message send failures.
Consider logging the actual error to the user or to a monitoring service if the cause is known (e.g., network or server error). Shortening the message might not give enough context for users.

- customSonner({ type: 'error', text: 'Failed to send message. Please try again.' })
+ customSonner({ 
+   type: 'error', 
+   text: error.message || 'Failed to send message. Please try again.' 
+ })

346-346: Provide more context when loading messages fails.
Including the error message from the catch block could assist both developers and users in troubleshooting.

- customSonner({ type: 'error', text: 'Failed to load messages. Please try again.' })
+ customSonner({ 
+   type: 'error', 
+   text: \`Failed to load messages. Reason: \${error.message}\` 
+ })
apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx (3)

1-2: Avoid mixing default and named imports from React.
In the monorepo, based on prior learnings, consider removing the default React import in favor of named imports (e.g., import { useEffect, useState } from 'react'), or vice versa, to maintain consistency.

- import React, { useEffect, useState } from 'react'
+ import { useEffect, useState } from 'react'

21-25: Interfaces are consistent but could benefit from additional in-code documentation.
Consider adding docstrings or JSDoc/TSDoc comments to clarify each function’s expected arguments and return values.


66-70: Consider user-facing error notifications.
In the catch block, console.error is helpful for debugging but consider also using customSonner to inform users that visibility update failed.

} catch (error) {
  console.error('Failed to update thread visibility:', error)
+ customSonner({ type: 'error', text: 'Failed to update thread visibility.' })
}
apps/masterbots.ai/components/icons/successIcon.tsx (1)

2-2: Add accessible title or aria-label to the SVG.
Per the static analysis hint, please include an accessible name for this SVG.

You can address this by adding a <title> or using aria-label:

<svg
  width="14"
  height="10"
  viewBox="0 0 14 10"
  fill="none"
+ role="img"
+ aria-label="Success icon"
  {...props}
>
🧰 Tools
🪛 Biome (1.9.4)

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

apps/masterbots.ai/components/auth/forgot-password-form.tsx (1)

15-15: Validate or neutralize sensitive error info
Be sure not to leak sensitive error messages in production. Consider redacting or adjusting error text.

apps/masterbots.ai/lib/hooks/useSonner.tsx (1)

67-70: Specify button type.
By default, a button in a form is type "submit". This may cause unexpected form submissions.

<button
  className="..."
- onClick={() => toast.dismiss(t)}
+ type="button"
+ onClick={() => toast.dismiss(t)}
>
🧰 Tools
🪛 Biome (1.9.4)

[error] 67-70: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx (2)

65-65: UI consistency for chat details.

Displaying the number of messages is useful contextual information for users. Ensure the style remains consistent across the app’s design language.


72-72: Unresolved inline comment.

There is an inline “@ts-ignore” comment. Try removing it if not strictly necessary, or add an explanation if it cannot be avoided, so other devs understand the reason.

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

56-56: Order of hook usage.

“customSonner” is referenced in “onResponse” before its declaration on line 63. Although React function scope allows it, consider moving the “useSonner” initialization above to keep the code flow more intuitive.

-    onResponse(response) {
-      if (response.status === 401) {
-        customSonner({ type: 'error', text: response.statusText })
-      }
-    },
...
+  const { customSonner } = useSonner()

  const { messages, reload, stop, input, setInput, append } = useChat({
    onResponse(response) {
      if (response.status === 401) {
        customSonner({ type: 'error', text: response.statusText })
      }
    },

63-63: Consistent naming.

“customSonner” is a sufficiently descriptive name, though it might be shortened for clarity if used often. No functional concerns.

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

69-69: Potential undefined error message.
If result.error is undefined or null, consider a fallback to avoid an empty notification.

- customSonner({ type: 'error', text: result.error })
+ customSonner({ type: 'error', text: result.error ?? 'Unknown error occurred' })
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed5de7 and 87b8514.

📒 Files selected for processing (22)
  • apps/masterbots.ai/app/globals.css (1 hunks)
  • apps/masterbots.ai/app/layout.tsx (3 hunks)
  • apps/masterbots.ai/components/auth/forgot-password-form.tsx (2 hunks)
  • apps/masterbots.ai/components/auth/reset-password-form.tsx (4 hunks)
  • apps/masterbots.ai/components/auth/signup-form.tsx (9 hunks)
  • apps/masterbots.ai/components/icons/closeIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/errorIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/index.ts (1 hunks)
  • apps/masterbots.ai/components/icons/infoIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/successIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/layout/sidebar/sidebar-actions.tsx (5 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-options.tsx (3 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx (4 hunks)
  • apps/masterbots.ai/components/routes/chat/new-chat.tsx (2 hunks)
  • apps/masterbots.ai/components/routes/profile/user-card.tsx (5 hunks)
  • apps/masterbots.ai/components/ui/sonner.tsx (1 hunks)
  • apps/masterbots.ai/lib/hooks/use-mb-chat.ts (6 hunks)
  • apps/masterbots.ai/lib/hooks/use-profile.tsx (3 hunks)
  • apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx (1 hunks)
  • apps/masterbots.ai/lib/hooks/useSonner.tsx (1 hunks)
  • apps/masterbots.ai/package.json (2 hunks)
  • apps/masterbots.ai/tailwind.config.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/masterbots.ai/components/icons/index.ts
🧰 Additional context used
📓 Learnings (1)
apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx (1)
Learnt from: AndlerRL
PR: bitcashorg/masterbots#287
File: apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx:3-3
Timestamp: 2024-11-12T03:32:08.432Z
Learning: Always use explicit imports for React hooks to maintain consistency across the monorepo, and avoid using both named and default imports simultaneously.
🪛 Biome (1.9.4)
apps/masterbots.ai/components/icons/successIcon.tsx

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

apps/masterbots.ai/components/icons/infoIcon.tsx

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

apps/masterbots.ai/components/icons/closeIcon.tsx

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx

[error] 36-36: This hook does not specify all of its dependencies: customSonner

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/components/icons/errorIcon.tsx

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx

[error] 60-60: This hook specifies more dependencies than necessary: jwt

This dependency can be removed from the list.

(lint/correctness/useExhaustiveDependencies)

apps/masterbots.ai/components/routes/profile/user-card.tsx

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

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

(lint/style/useImportType)


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

This import is only used as a type.

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

(lint/style/useImportType)

apps/masterbots.ai/lib/hooks/useSonner.tsx

[error] 15-15: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)


[error] 11-11: This let declares a variable that is only assigned once.

'config' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 67-70: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

apps/masterbots.ai/lib/hooks/use-profile.tsx

[error] 10-10: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)


[error] 43-43: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)

🔇 Additional comments (83)
apps/masterbots.ai/lib/hooks/use-profile.tsx (8)

7-7: UseSonner import is appropriate.
The new import aligns with the PR’s goal of transitioning from react-hot-toast to Sonner-based notifications, improving consistency and reducing dependency on multiple notification packages.


12-16: Good refactoring for readability.
The multi-line signature for updateUserInfo is more readable and maintainable.


41-41: Great usage of customSonner.
The extraction of customSonner from useSonner centralizes notification logic. This enhancement is consistent with the new Sonner-based notification system.


48-50: Minor readability improvement.
Refactoring the sessionSlug assignment logic to a more streamlined format enhances clarity when comparing user slugs.


73-77: Improved interface-based function signature.
The multi-line function signature is consistent with the interface changes above and improves maintainability by clearly listing parameters.


79-79: Verify authentication logic.
The check for the JWT token and user id is critical for secure updates. Ensure that upstream code handles missing or invalid tokens gracefully.

Would you like me to generate a script to scan for all places where updateUserInfo is invoked without verifying authentication first?

Also applies to: 81-81


88-88: Error notifications now handled via customSonner.
Switching from toast-based notifications to Sonner-based notifications is consistent with the project's new notification strategy.

Also applies to: 91-92


98-104: Sensible context value placement.
This clearer multi-line format within the context provider clarifies what is exposed and reduces the chance of mixing up properties.

apps/masterbots.ai/lib/hooks/use-mb-chat.ts (2)

286-286: Check for logged-in state before triggering.
You are already testing if session?.user is missing. If that fails, consider halting execution before calling customSonner.


31-31: Ensure that './useSonner' is valid and exported.
Confirm that the "useSonner" hook is properly defined and exported from './useSonner'.

✅ Verification successful

The import './useSonner' is valid and properly exported

The verification confirms that:

  • The file exists at apps/masterbots.ai/lib/hooks/useSonner.tsx
  • The useSonner hook is properly exported as shown in the search results: export function useSonner()
  • The hook is actively used across multiple components in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Checks if "useSonner" is declared and exported.
ast-grep --pattern $'export function useSonner($_) { $$$ }'

Length of output: 60


Script:

#!/bin/bash
# Let's check for any file named useSonner
fd useSonner

# Let's also check for any exports containing "useSonner" with different export patterns
ast-grep --pattern 'export const useSonner = $_'

# Let's also search for any definition of useSonner
rg "useSonner" -A 2

Length of output: 8984

apps/masterbots.ai/tailwind.config.js (1)

7-8: Add verification for .js/.jsx usage in the lib directory.

Currently, Tailwind only scans TypeScript files in ./lib. If there are UI or component files in .js or .jsx format, they will not be included in the Tailwind content build. Consider adding them if your project uses JavaScript in that directory.

Below is a script that will look for any .js or .jsx files in your lib directory:

apps/masterbots.ai/components/icons/errorIcon.tsx (3)

1-2: Great introduction of the ErrorIcon component!

This functional component's signature is concise, and using React.ComponentPropsWithoutRef<'svg'> is a good pattern to allow standard SVG attributes.

🧰 Tools
🪛 Biome (1.9.4)

[error] 2-2: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)


3-9: SVG path styling is consistent with an error color.

The stroke color (#F93333) is a standard approach for error or warning icons, and the path instructions look properly defined.


13-13: Export structure looks good.

Default export is properly defined, making the component easily usable throughout the codebase.

apps/masterbots.ai/lib/hooks/use-thread-visibility.tsx (12)

12-12: Sonner import looks good.
The new custom notification system import is consistent with the PR’s objectives.


15-17: Updated interface for delete thread response.
The properties are clear, and removing semicolons aligns with the chosen code style.


31-33: Context declaration is clear and readable.
Refactoring the context creation across multiple lines improves clarity.


38-40: Helpful error message for missing context.
Throwing a descriptive error ensures correct usage of the hook.


49-51: Provider signature readability.
Splitting props definition on multiple lines is consistent with the file’s style.


52-55: State hooks and useSonner integration.
The customSonner usage is seamlessly introduced to handle notifications.


57-58: Session usage.
The extraction of the JWT from the session is straightforward. Verify the session remains valid to reduce the chance of stale credentials.


139-141: Authentication checks.
Good job notifying the user with customSonner if JWT is missing. This prevents silent failures.


149-156: Admin mode toggling.
The logic is clear; toggling admin mode triggers fetching the appropriate threads. No concurrency issues or race conditions are apparent.


161-173: Error handling for admin approvals.
Using customSonner for both success and error scenarios is consistent. The user receives prompt feedback on each action.


178-193: Return statement structure.
The final provider return is cleanly formatted. Exported context values are well structured.


60-60: Exhaustive dependency check.
Static analysis notes that you might not need to list “jwt” in the dependency array. If you only want this effect to run once after mount (or solely after login), consider removing “jwt” from the dependencies.

 useEffect(() => {
   getThreadForUser()
-}, [jwt])
+}, [])
🧰 Tools
🪛 Biome (1.9.4)

[error] 60-60: This hook specifies more dependencies than necessary: jwt

This dependency can be removed from the list.

(lint/correctness/useExhaustiveDependencies)

apps/masterbots.ai/components/ui/sonner.tsx (1)

8-30: Looks good overall.
The Toaster component is well-structured, and the theme-based styles are neatly integrated.

apps/masterbots.ai/components/auth/forgot-password-form.tsx (2)

6-6: Good transition to customSonner.
Replacing react-hot-toast with customSonner ensures consistent app-wide notifications.


38-38: Ensure consistent error messaging.
You are returning different error messages in different paths. Confirm these variations meet user expectations.

Also applies to: 41-41, 45-45

apps/masterbots.ai/lib/hooks/useSonner.tsx (1)

43-47: Overall design looks great!
The customSonner approach is flexible and cleanly structured, and the styles are easy to maintain.

Also applies to: 80-84

apps/masterbots.ai/app/layout.tsx (3)

11-11: Transition to new notification system looks good.

Switching from “react-hot-toast” to the new custom notification system is consistent with the PR objectives. This line successfully references the updated import from “@/components/ui/sonner”.


23-24: Initialization of NextTopLoader and Toaster are correct.

The updated initialPosition value from 0.20 to 0.2 is purely a cosmetic change. The Toaster might consider top or bottom positioning per your use case, but this usage looks fine.


33-35: General readability improvement.

This reformat places {children} on its own line for clarity, which aligns with typical React style guidelines. No issues.

apps/masterbots.ai/components/routes/chat/chat-share-dialog.tsx (4)

19-19: Import statement is aligned with the new notification system.

Using “useSonner” is consistent with the PR’s transition from “react-hot-toast.”


34-34: Avoid partial dependencies in React hooks.

Consider verifying if "customSonner" should be included in the useCallback dependencies. If that is a stable reference from a custom hook, it might be safe to omit. Otherwise, add customSonner to the dependency array to avoid stale references.


39-42: Clear error-handling strategy.

Using “customSonner” for error notifications is more unified with your new approach. Looks good.


49-49: Consistent success feedback.

Replacing previous “toast.success” calls with “customSonner” ensures consistent notification styling and behavior.

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

35-35: Approved import of the custom notification hook.

Swapping in “useSonner” lines up well with the project’s shift away from “react-hot-toast.”

apps/masterbots.ai/components/auth/reset-password-form.tsx (3)

12-12: Smooth import for new notification system.

This ensures the file no longer depends on “react-hot-toast.”


32-32: customSonner helps unify notifications.

Having a single reference to the hook in this component streamlines the approach to success/error messages.


Line range hint 52-80: Well-structured error handling.

Swapping out “toast.error” with “customSonner({ type: 'error' })” and “toast.success” with “customSonner({ type: 'success' })” is consistent with the revised notifications strategy.

apps/masterbots.ai/components/layout/sidebar/sidebar-actions.tsx (7)

15-20: No issues found with icon imports.
These updated icon imports appear fine and maintain clarity in the code.


27-27: New custom notification hook.
Good adoption of the custom Sonner hook for managing notifications.


47-49: State destructuring from useSidebar.
Looks good. The destructuring is both concise and clear.


52-53: Refined filter check and selection logic.
The check for filtering by chat title and updating the selected state is consistent with the rest of the code. No issues identified.

Also applies to: 57-57


76-76: Success notification message.
Displays a concise success message upon deletion. Looks good.


102-104: Screen reader accessibility.
Using “sr-only” here is an excellent practice for accessible labeling.


107-109: Tooltip content clarity.
The tooltips provide a clear distinction between selecting and deselecting.

apps/masterbots.ai/components/auth/signup-form.tsx (11)

8-8: Custom notification hook import.
The new import for Sonner integration is consistent with the rest of the PR.


46-46: Consistent use of customSonner.
The destructuring is in line with the new notification approach across the app.


54-54: Inline error notification for mismatched passwords.
Concise and user-friendly messaging.


60-60: Strong password enforcement.
Clear error message prompting users for a stronger password.


80-83: Success notification on account creation.
The success message is straightforward and directs the user to verify their email.


85-85: Error feedback on signup failure.
Good fallback messaging in case data.error is absent.


89-89: Unexpected error handling.
Proactively catching unexpected errors is a robust practice.


100-102: Toggle password visibility function.
The inline reference to fields is clear and maintains code simplicity.


114-115: Email verification notice flow.
The flow for prompting verification is well-organized and user-friendly.

Also applies to: 118-118


140-142: Required field labels.
The usage of variant="required" clarifies essential fields for the user.

Also applies to: 154-156, 179-181


199-203: Eye vs. EyeOff icons.
Providing a visual cue for password visibility is user-friendly.

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

28-28: New Sonner import.
This import is consistent with the switchover from toast to the new hook.


46-46: Destructured customSonner usage.
Matches the updated pattern used across the app for notifications.


55-55: Success message upon thread deletion.
The user receives clear confirmation when a thread is successfully deleted.


57-57: Error message on deletion failure.
The fallback error handling is consistent with the rest of the new notifications approach.

apps/masterbots.ai/components/routes/profile/user-card.tsx (18)

7-7: Transition to customSonner.
Great job replacing toast with the new Sonner-based notification approach.


9-17: Importing types from 'ai/react'.
Using “import { type Message, useChat }” is beneficial for tree-shaking.


28-28: isOwner variable correctness.
Good clarity for checking user ownership.


31-38: State initialization.
Initializing states for user info at once keeps them clearly organized.


40-42: Cloudinary upload hook usage.
A consistent approach for image uploads.


44-56: userQuestions mapping logic.
Efficiently filters out threads with no messages. No issues noted.


65-65: Error and success handling with Sonner.
Properly distinguishing server errors, unauthorized cases, and general failures.

Also applies to: 69-69, 71-71, 76-76, 81-81


83-114: Profile picture upload and updates.
Robust error handling and success feedback when uploading images.


127-127: User information update failure.
A clear error message helps the user understand what went wrong.


146-147: Generating content from thread history.
Informative error messages ensure user clarity when no thread history is present or an error occurs.

Also applies to: 158-160


166-168: Cleanup on component unmount.
Setting states to null or false helps avoid stale data.


175-175: User-based reactivity.
Synchronizing local states with the user data ensures consistency upon user changes.


182-201: Conditional loading & user checks.
Properly handles the loading state while the user data is being fetched.


203-207: Bio generation button.
Clear CTA with a visual icon indicating generation or refresh.


254-255: Display user’s total threads.
Using consistent text coloring and icons for quick stats.


263-274: Topic generation & user feedback.
Allows a user to quickly discover their favorite topic with concise messaging.

Also applies to: 278-297, 299-301


333-375: Profile picture overlay with Cloudinary upload.
Related button logic is well-placed and clearly labeled.


379-380: Final checks after user fetch.
No issues: references are clear, and the conditionals are in place.

apps/masterbots.ai/package.json (1)

62-62: Verify the next-themes upgrade impact

The next-themes package has been upgraded from ^0.2.1 to ^0.4.4. Please ensure this upgrade doesn't introduce any breaking changes to the theme functionality.

✅ Verification successful

Let me analyze the usage of next-themes in the codebase to verify the impact of the upgrade.


Based on the analysis of the codebase, I can now provide a final response about the next-themes upgrade impact.

The next-themes upgrade appears safe to proceed

The codebase uses standard next-themes APIs that are stable across versions:

  • Basic theme provider setup in providers.tsx
  • Standard useTheme hook usage for:
    • Theme toggle functionality
    • Theme-aware toast notifications
    • User menu theming

The upgrade from ^0.2.1 to ^0.4.4 introduces no breaking changes to these core APIs based on the package's changelog and the simple usage patterns in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in next-themes upgrade

# Check git history for theme-related files
rg -l "next-themes" | xargs git log -p

# Check for theme-related imports and usage
rg "next-themes"

Length of output: 66120


Script:

#!/bin/bash
# Check the actual usage of next-themes in the components
rg -A 5 "useTheme|ThemeProvider" apps/masterbots.ai/components/

Length of output: 3720

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

5-9: Consider adding light mode styles for consistency

While the dark mode styles are implemented, consider adding a corresponding light mode style for consistency and to ensure proper icon visibility in all themes.

 @layer components {
   .icon-sonner-dark path {
     stroke: white;
   }
+  .icon-sonner-light path {
+    stroke: black;
+  }
 }

Also, verify that these styles are being properly applied when the theme changes.

apps/masterbots.ai/components/icons/infoIcon.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/components/icons/closeIcon.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/components/icons/errorIcon.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/lib/hooks/useSonner.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/lib/hooks/useSonner.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/package.json Show resolved Hide resolved
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: 1

🧹 Nitpick comments (4)
apps/masterbots.ai/lib/hooks/useSonner.tsx (4)

5-8: Follow TypeScript naming conventions for type definitions.

Rename customSonnerProps to CustomSonnerProps to follow the PascalCase convention for type definitions in TypeScript.

-export type customSonnerProps = {
+export type CustomSonnerProps = {
   type?: 'success' | 'error' | 'info'
   text?: string | null
}

15-15: Fix grammatical errors in default messages.

There are grammatical errors in the default text messages:

  • "Changes and been applied" should be "Changes have been applied"
  • "Your changes has been applied" should be "Your changes have been applied"
-        text: text ?? 'Changes and been applied successfully',
+        text: text ?? 'Changes have been applied successfully',
-        text: text ?? 'Your changes has been applied 5 minutes ago.',
+        text: text ?? 'Your changes have been applied 5 minutes ago.',

Also applies to: 27-27


11-31: Optimize performance by moving configuration outside the hook.

The toastConfigs object is recreated on every render. Consider moving it outside the hook to prevent unnecessary object recreation.

+const toastConfigs = {
+  success: {
+    title: 'Success',
+    text: 'Changes have been applied successfully',
+    button: <CloseIcon className="dark:icon-sonner-dark" />,
+    icon: <SuccessIcon />
+  },
+  error: {
+    title: 'Error',
+    text: 'Failed to update the information. Please try again',
+    button: 'Retry',
+    icon: <ErrorIcon />
+  },
+  info: {
+    title: 'Changes applied',
+    text: 'Your changes have been applied 5 minutes ago.',
+    button: 'Undo',
+    icon: <InfoIcon />
+  }
+}

 export function useSonner() {
-  const customSonner = ({ type = 'success', text }: customSonnerProps) => {
-    const toastConfigs = {
-      // ... current config
-    }
+  const customSonner = ({ type = 'success', text }: CustomSonnerProps) => {
     const config = text ? { ...toastConfigs[type], text } : toastConfigs[type]

67-71: Move styles constant up with other configurations.

For better code organization, consider moving the styles constant up with other configurations, near the toastConfigs.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 87b8514 and 6116e4c.

📒 Files selected for processing (4)
  • apps/masterbots.ai/app/globals.css (1 hunks)
  • apps/masterbots.ai/components/routes/profile/user-card.tsx (13 hunks)
  • apps/masterbots.ai/lib/hooks/useSonner.tsx (1 hunks)
  • apps/masterbots.ai/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/masterbots.ai/app/globals.css
  • apps/masterbots.ai/package.json
  • apps/masterbots.ai/components/routes/profile/user-card.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
apps/masterbots.ai/lib/hooks/useSonner.tsx

[error] 53-56: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

🔇 Additional comments (1)
apps/masterbots.ai/lib/hooks/useSonner.tsx (1)

1-71: Overall implementation looks good!

The custom hook implementation is well-structured with:

  • Clean separation of concerns
  • Proper dark mode support
  • Good error handling
  • Consistent styling

The suggested improvements are minor and don't impact the core functionality.

🧰 Tools
🪛 Biome (1.9.4)

[error] 53-56: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

apps/masterbots.ai/lib/hooks/useSonner.tsx Outdated Show resolved Hide resolved
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: 1

🧹 Nitpick comments (6)
apps/masterbots.ai/components/icons/infoIcon.tsx (1)

12-25: Consider removing unnecessary clipPath

The current clipPath implementation:

  1. Uses a non-unique ID which could cause conflicts with multiple instances
  2. Clips to the exact SVG dimensions (18x18) which matches the viewBox, making it redundant

Consider simplifying by removing the clipPath:

-    <g clipPath="url(#clip0_2431_25609)">
      <path
        d="M9 12V9M9 6H9.0075M16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9Z"
        stroke="#388DE2"
        strokeWidth="1.125"
        strokeLinecap="round"
        strokeLinejoin="round"
      />
-    </g>
-    <defs>
-      <clipPath id="clip0_2431_25609">
-        <rect width="18" height="18" fill="white" />
-      </clipPath>
-    </defs>
apps/masterbots.ai/lib/hooks/useSonner.tsx (5)

5-8: Rename type to follow PascalCase convention.

Type definitions should follow PascalCase naming convention.

-export type customSonnerProps = {
+export type CustomSonnerProps = {

15-15: Fix grammatical errors in default messages.

There are grammatical errors in the default text messages:

  • "Changes and been applied" should be "Changes have been applied"
  • "Your changes has been applied" should be "Your changes have been applied"
-        text: text ?? 'Changes and been applied successfully',
+        text: text ?? 'Changes have been applied successfully',
-        text: text ?? 'Your changes has been applied 5 minutes ago.',
+        text: text ?? 'Your changes have been applied 5 minutes ago.',

Also applies to: 27-27


12-31: Move toast configurations outside the function.

The toastConfigs object is recreated on every render. Consider moving it outside the function for better performance.

const TOAST_CONFIGS = {
  success: {
    title: 'Success',
    text: 'Changes have been applied successfully',
    button: <CloseIcon className="dark:icon-sonner-dark" />,
    icon: <SuccessIcon />
  },
  // ... rest of the configs
}

export function useSonner() {
  const customSonner = ({ type = 'success', text }: CustomSonnerProps) => {
    return toast.custom(t => {
      const config = {
        ...TOAST_CONFIGS[type],
        text: text ?? TOAST_CONFIGS[type].text
      }
      // ... rest of the implementation
    })
  }
  return { customSonner }
}

16-16: Consider consistent button styling across notification types.

The button implementation is inconsistent across notification types:

  • Success uses an icon
  • Error and Info use text
    Consider using either all icons or all text for better UX consistency.

Also applies to: 22-22, 28-28


68-72: Consider moving styles to a constants file.

If these notification colors are used elsewhere in the application, consider moving them to a shared constants file for better reusability and maintainability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6116e4c and 4fc7aaa.

📒 Files selected for processing (6)
  • apps/masterbots.ai/components/icons/closeIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/errorIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/infoIcon.tsx (1 hunks)
  • apps/masterbots.ai/components/icons/successIcon.tsx (1 hunks)
  • apps/masterbots.ai/lib/hooks/useSonner.tsx (1 hunks)
  • apps/masterbots.ai/package.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/masterbots.ai/components/icons/errorIcon.tsx
  • apps/masterbots.ai/components/icons/closeIcon.tsx
  • apps/masterbots.ai/components/icons/successIcon.tsx
  • apps/masterbots.ai/package.json
🔇 Additional comments (2)
apps/masterbots.ai/components/icons/infoIcon.tsx (2)

1-1: LGTM: Well-typed component declaration

The component is correctly typed using React.ComponentPropsWithoutRef<'svg'> which allows proper type checking for SVG element props.


2-26: LGTM: Accessible SVG implementation

The SVG implementation follows accessibility best practices with:

  • Proper role and ARIA attributes
  • Descriptive title element
  • Preserved props spreading for customization

Note: The previous accessibility concerns have been properly addressed in this implementation.

apps/masterbots.ai/lib/hooks/useSonner.tsx Outdated Show resolved Hide resolved
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: 0

🧹 Nitpick comments (6)
apps/masterbots.ai/components/routes/browse/browse-chatbot-details.tsx (2)

35-35: Consistent error messaging.
Returning a short, readable message for users is good. Ensure that logs capture the underlying cause to facilitate debugging.


73-73: Leverage contextual error details if possible.
Currently, the user sees a generic error. If relevant, consider capturing specific error messages for more detailed feedback.

apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx (4)

25-25: Destructuring the customSonner object seems consistent with the new approach.

Ensure the naming conventions match existing project patterns, as customSonner might be more intuitively named sonner or something similarly concise across the codebase.


30-30: Clear and concise error messaging.

When prompting the user to sign in, consider linking directly to the sign-in flow for smoother UX (e.g. a direct link or auto-navigating).


50-50: Fallback error handling is correct.

Consider generating a more user-friendly error message for the fallback scenario to avoid confusion.


71-71: Effective success messaging but consider standardizing the format.

Collapsing the logic into a single statement is fine; however, you may want to maintain a consistent style for success notifications across multiple components.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4fc7aaa and 1796fc5.

📒 Files selected for processing (2)
  • apps/masterbots.ai/components/routes/browse/browse-chatbot-details.tsx (4 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx (4 hunks)
🔇 Additional comments (8)
apps/masterbots.ai/components/routes/browse/browse-chatbot-details.tsx (4)

12-12: New hook import looks good.
This line correctly imports the new Sonner hook, aligning with the PR objective of replacing the old toast solution.


23-23: Properly destructuring the notification method.
Extracting customSonner from the hook is straightforward and maintains clarity by utilizing named destructuring.


33-33: Ensure response status text is user-friendly.
Using response.statusText is beneficial for debugging, but consider verifying that it conveys helpful information for end users.


40-40: Uniform error handling.
All errors are now routed through customSonner. This promotes consistency in notification handling.

apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx (4)

12-12: Good addition of the new import statement.

The useSonner import is aligned with the PR objective to replace the old toast system. Nice job!


39-39: Error handling message is good.

Ensure underlying data validation is also in place to guarantee user data integrity before calling the toast.


44-44: Graceful error message for chatbot validation.

Similarly, it would be wise to confirm upstream logic ensures a chatbot is selected before the user reaches this step.


74-74: Overall error handling block is consistent with the new toast approach.

Double-check that external dependencies (e.g., router.push) are always called after the toast if needed, ensuring user instructions are displayed before redirection.

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

🧹 Nitpick comments (4)
apps/masterbots.ai/lib/hooks/useSonner.tsx (4)

5-8: Follow TypeScript naming conventions for type definitions.

The type customSonnerProps should be in PascalCase as per TypeScript conventions.

-export type customSonnerProps = {
+export type CustomSonnerProps = {

15-15: Fix grammatical error in success message.

There's a typo in the success message.

-        text: text ?? 'Changes and been applied successfully',
+        text: text ?? 'Changes have been applied successfully',

12-31: Optimize toast configurations.

Move the toastConfigs object outside the customSonner function to prevent unnecessary recreation on each call.

const TOAST_CONFIGS = {
  success: {
    title: 'Success',
    text: 'Changes have been applied successfully',
    button: <X />,
    icon: <Check color="#83E56A" size={18} />
  },
  error: {
    title: 'Error',
    text: 'Failed to update the information. Please try again',
    button: 'Retry',
    icon: <AlertTriangle color="#F93333" size={18} />
  },
  info: {
    title: 'Changes applied',
    text: 'Your changes has been applied 5 minutes ago.',
    button: 'Undo',
    icon: <Info color="#388DE2" size={18} />
  }
} as const;

export function useSonner() {
  const customSonner = ({ type = 'success', text }: CustomSonnerProps) => {
    return toast.custom(t => {
      const config = TOAST_CONFIGS[type];
      // Use text ?? config.text for the fallback
      const message = text ?? config.text;
      // Rest of the implementation...
    });
  };
  return { customSonner };
}

68-72: Extract color constants for better maintainability.

The color values are repeated in both icon colors and border styles. Consider extracting them into constants.

const TOAST_COLORS = {
  success: '#83E56A',
  error: '#F93333',
  info: '#388DE2'
} as const;

const styles = Object.fromEntries(
  Object.entries(TOAST_COLORS).map(([key, color]) => [
    key,
    `border-[${color}]`
  ])
);

// Update icon colors to use the constants:
// <Check color={TOAST_COLORS.success} size={18} />
// <AlertTriangle color={TOAST_COLORS.error} size={18} />
// <Info color={TOAST_COLORS.info} size={18} />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1796fc5 and 5ac4c3b.

📒 Files selected for processing (2)
  • apps/masterbots.ai/app/globals.css (0 hunks)
  • apps/masterbots.ai/lib/hooks/useSonner.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/masterbots.ai/app/globals.css
🔇 Additional comments (1)
apps/masterbots.ai/lib/hooks/useSonner.tsx (1)

1-72: Track remaining react-hot-toast migration.

While this Sonner implementation is solid, there are still unmigrated react-hot-toast usages in other files that need to be updated:

  • apps/masterbots.ai/components/routes/chat/chat-chatbot-details.tsx
  • apps/masterbots.ai/components/routes/browse/browse-chatbot-details.tsx

@AndlerRL
Copy link
Member

@coderabbitai create an issue to update documentation (JSDocs) for the new hook and the usage for future reference. Assign @luighis to it. Add the labels related to the task.

Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Tip

For best results, initiate chat on the files or code changes.

@AndlerRL I've created issue #338 to track the documentation requirements for the useSonner hook. The issue has been assigned to @luighis and labeled with "documentation" and "enhancement". You can find it here: #338

🔗 Analysis chain

@AndlerRL I'll create an issue for documenting the useSonner hook.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Get available labels in the repository
gh label list

Length of output: 802


Script:

#!/bin/bash
# Create a new issue
gh issue create --title "Add JSDoc documentation for useSonner hook" --body "## Overview
Document the new \`useSonner\` hook to improve code maintainability and developer experience.

## Requirements
1. Add JSDoc documentation for:
   - \`useSonner\` hook
   - \`customSonnerProps\` type
   - \`customSonner\` function and its parameters

2. Include usage examples:
   - Success notifications
   - Error notifications
   - Info notifications
   - Custom configurations

3. Add component integration examples showing:
   - Basic usage
   - Error handling patterns
   - Best practices

## Related PR
#334

/cc @AndlerRL" --assignee luighis --label "documentation,enhancement"

Length of output: 717

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! Thanks for reviewing the use case for the toasters across all the webapp. I added a new issue regarding the documentation related with this update. I initially assigned it to you. Merging!

@AndlerRL AndlerRL added enhancement New feature or request feature labels Jan 14, 2025
@AndlerRL AndlerRL merged commit 882e6b7 into develop Jan 14, 2025
1 of 2 checks passed
@AndlerRL AndlerRL deleted the new-sonner branch January 14, 2025 05:13
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]>
@AndlerRL AndlerRL restored the new-sonner branch January 22, 2025 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants