Skip to content

feat(ask_sb): Add onboarding tutorial #408

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

Merged
merged 5 commits into from
Jul 29, 2025
Merged

Conversation

brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Jul 29, 2025

Adds a tutorial modal/useful information about Ask Sourcebot. It will only appear when the user first switches the search mode to Ask && the modal has previously been dismissed.

image image image image image

Summary by CodeRabbit

  • New Features

    • Introduced a multi-step tutorial dialog for the "Ask Sourcebot" feature, guiding users through search scopes, mentions, inline citations, and more.
    • Added a GitHub star button in the tutorial, displaying the current star count for the Sourcebot repository.
    • The tutorial dialog appears for new users and can be dismissed; dismissal is remembered for future visits via a cookie.
  • Enhancements

    • Updated various prompts and descriptions to clarify search scope functionality and improve user guidance.
    • Improved placeholder text in the chat box to better communicate how to refine queries.
  • UI Improvements

    • Updated repository icons in search scope cards to a consistent bookmark icon.
    • Added optional styling for dialog close buttons for better customization.

@brendan-kellam brendan-kellam requested a review from msukkari July 29, 2025 06:25
Copy link

coderabbitai bot commented Jul 29, 2025

Warning

Rate limit exceeded

@brendan-kellam has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1fbb371 and fb8f6f4.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • packages/web/src/app/[domain]/components/homepage/agenticSearchTutorialDialog.tsx (1 hunks)

Walkthrough

A multi-step tutorial dialog for the "Agentic Search" feature was introduced, including a new React component, cookie-based dismissal tracking, and related UI enhancements. Supporting constants, actions, and prop interfaces were added or updated across several files to manage tutorial state and dialog presentation. Minor UI and import path adjustments were also made.

Changes

Cohort / File(s) Change Summary
Agentic Search Tutorial Dialog Feature
packages/web/src/app/[domain]/components/homepage/agenticSearchTutorialDialog.tsx
Added a new multi-step tutorial dialog React component with navigation, visuals, and a GitHub star button.
Tutorial State Management & Prop Wiring
packages/web/src/app/[domain]/components/homepage/agenticSearch.tsx, packages/web/src/app/[domain]/components/homepage/index.tsx, packages/web/src/app/[domain]/page.tsx
Added and forwarded props to track tutorial dismissal, integrated tutorial dialog, and read/write dismissal cookie.
Cookie Actions & Constants
packages/web/src/actions.ts, packages/web/src/lib/constants.ts
Added a new constant for the tutorial dismissal cookie and an action to set it.
Dialog UI Enhancement
packages/web/src/components/ui/dialog.tsx
Extended dialog content props to allow custom close button styling.
ChatBox UI & Info Card Adjustments
packages/web/src/features/chat/components/chatBox/chatBox.tsx, packages/web/src/features/chat/components/chatBox/searchScopeInfoCard.tsx
Updated placeholder text in chat box and simplified info card icon logic and description.
Import Path Updates
packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx, packages/web/src/features/chat/components/chatBox/chatBoxToolbar.tsx
Changed import paths for info card components to use feature-scoped directories.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Homepage
    participant AgenticSearch
    participant AgenticSearchTutorialDialog
    participant CookieStore

    User->>Homepage: Visit page
    Homepage->>CookieStore: Read AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME
    CookieStore-->>Homepage: Return dismissal state
    Homepage->>AgenticSearch: Pass isTutorialDismissed prop
    AgenticSearch->>AgenticSearchTutorialDialog: Show dialog if not dismissed
    User->>AgenticSearchTutorialDialog: Dismiss tutorial
    AgenticSearchTutorialDialog->>AgenticSearch: Call onTutorialDismissed
    AgenticSearch->>CookieStore: setAgenticSearchTutorialDismissedCookie(true)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A bunny hopped through lines of code,
With cookies set and dialogs showed.
A tutorial bright, with stars in sight,
Guides users through the search delight.
From placeholders tweaked to icons anew,
This patch brings features fresh and true!
🐰✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bkellam/ask_sb_tutorial

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

This comment has been minimized.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/web/src/actions.ts (1)

2011-2016: Avoid unnecessary await cookies() and return a value for parity with the other dismiss action

cookies() is synchronous; awaiting it is a no-op that TypeScript won’t flag but adds cognitive noise.
dismissMobileUnsupportedSplashScreen returns true, while this new helper returns void, which is inconsistent when both mutate a cookie for UI state.

Diff proposal (only touches newly-added lines):

-export async function setAgenticSearchTutorialDismissedCookie(dismissed: boolean) {
-    const cookieStore = await cookies();
-    cookieStore.set(AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME, dismissed ? "true" : "false", {
-        httpOnly: false, // Allow client-side access
-    });
+export async function setAgenticSearchTutorialDismissedCookie(dismissed: boolean): Promise<boolean> {
+    const cookieStore = cookies();
+    cookieStore.set(
+        AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME,
+        dismissed ? "true" : "false",
+        {
+            httpOnly: false,          // Client-side access needed
+            // sameSite, secure, path, etc. could be set later if required
+        },
+    );
+    return true;
 }

Also applies to: 2018-2023

🧹 Nitpick comments (1)
packages/web/src/actions.ts (1)

28-28: Import block is getting large — consider grouping feature-specific constants

You now import three “UI dismissal” cookie constants in one very long list. Pulling those three into their own import line keeps the diff smaller next time a cookie is added and improves scan-ability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 50dc598 and 1fd6005.

⛔ Files ignored due to path filters (3)
  • packages/web/public/ask_sb_tutorial_at_mentions.png is excluded by !**/*.png
  • packages/web/public/ask_sb_tutorial_citations.png is excluded by !**/*.png
  • packages/web/public/ask_sb_tutorial_search_scope.png is excluded by !**/*.png
📒 Files selected for processing (11)
  • packages/web/src/actions.ts (2 hunks)
  • packages/web/src/app/[domain]/components/homepage/agenticSearch.tsx (4 hunks)
  • packages/web/src/app/[domain]/components/homepage/agenticSearchTutorialDialog.tsx (1 hunks)
  • packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx (1 hunks)
  • packages/web/src/app/[domain]/components/homepage/index.tsx (3 hunks)
  • packages/web/src/app/[domain]/page.tsx (3 hunks)
  • packages/web/src/components/ui/dialog.tsx (2 hunks)
  • packages/web/src/features/chat/components/chatBox/chatBox.tsx (1 hunks)
  • packages/web/src/features/chat/components/chatBox/chatBoxToolbar.tsx (1 hunks)
  • packages/web/src/features/chat/components/chatBox/searchScopeInfoCard.tsx (2 hunks)
  • packages/web/src/lib/constants.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

📄 CodeRabbit Inference Engine (.cursor/rules/style.mdc)

Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.

Files:

  • packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx
  • packages/web/src/app/[domain]/page.tsx
  • packages/web/src/features/chat/components/chatBox/chatBox.tsx
  • packages/web/src/app/[domain]/components/homepage/agenticSearch.tsx
  • packages/web/src/lib/constants.ts
  • packages/web/src/features/chat/components/chatBox/searchScopeInfoCard.tsx
  • packages/web/src/app/[domain]/components/homepage/index.tsx
  • packages/web/src/features/chat/components/chatBox/chatBoxToolbar.tsx
  • packages/web/src/components/ui/dialog.tsx
  • packages/web/src/app/[domain]/components/homepage/agenticSearchTutorialDialog.tsx
  • packages/web/src/actions.ts
🔇 Additional comments (24)
packages/web/src/lib/constants.ts (1)

27-27: Constant addition looks good

Clearly-named key for the tutorial dismissal cookie – matches existing naming style and avoids collisions.

packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx (1)

12-13: Import path update is sensible

Path now reflects the new feature-scoped location; avoids future circular-import headaches.

packages/web/src/features/chat/components/chatBox/chatBoxToolbar.tsx (1)

14-16: Consistent relocation of shared cards

Both info-card imports now point to the colocated chatBox directory, keeping feature boundaries tidy.

packages/web/src/features/chat/components/chatBox/chatBox.tsx (1)

284-287: Placeholder copy change approved

The new text better describes the dual refinement mechanisms (scopes & @mentions).

packages/web/src/app/[domain]/page.tsx (3)

13-13: LGTM! Clean import addition.

The import follows the existing pattern and groups logically with other constants.


54-54: LGTM! Proper cookie handling.

The cookie value comparison with "true" is correct since cookie values are always strings. The boolean conversion is appropriate for the component prop.


79-79: LGTM! Consistent prop passing.

The new prop is properly integrated into the existing Homepage component call structure.

packages/web/src/app/[domain]/components/homepage/index.tsx (2)

26-26: LGTM! Proper interface extension.

The new boolean prop is correctly typed and follows the existing interface pattern.


37-37: LGTM! Clean prop drilling with appropriate renaming.

The prop is properly destructured and forwarded to the AgenticSearch component. The renaming from isAgenticSearchTutorialDismissed to isTutorialDismissed is good as it's more concise within the AgenticSearch context.

Also applies to: 95-95

packages/web/src/features/chat/components/chatBox/searchScopeInfoCard.tsx (3)

1-1: LGTM! Clean import optimization.

Removing unused imports and keeping only the necessary icons improves bundle size and code clarity.


11-11: LGTM! Better user-friendly terminology.

Changing "constrain" to "focus" is more positive and user-friendly while conveying the same meaning.


15-15: LGTM! Simplified icon implementation.

Using a static BookMarkedIcon is simpler than dynamic repository icon rendering and maintains consistency with the design.

packages/web/src/components/ui/dialog.tsx (2)

34-36: LGTM! Proper prop type extension.

The optional closeButtonClassName prop is correctly typed and extends the existing props interface cleanly.


37-37: LGTM! Clean implementation of customizable close button styling.

The prop is properly destructured and applied using the cn utility for class combination. This maintains the base styling while allowing customization.

Also applies to: 50-50

packages/web/src/app/[domain]/components/homepage/agenticSearch.tsx (4)

9-9: LGTM! Clean imports for tutorial functionality.

The new imports are properly organized and necessary for the tutorial feature implementation.

Also applies to: 14-15


28-28: LGTM! Proper prop integration.

The new isTutorialDismissed prop is correctly typed and integrated into the component interface and parameters.

Also applies to: 37-37


43-47: LGTM! Well-implemented tutorial state management.

The state initialization using !isTutorialDismissed correctly shows the tutorial when it hasn't been dismissed. The callback properly handles both closing the dialog and persisting the dismissal state via cookie.


89-93: LGTM! Clean conditional rendering.

The tutorial dialog is properly conditionally rendered and receives the appropriate close handler. The component integration follows React best practices.

packages/web/src/app/[domain]/components/homepage/agenticSearchTutorialDialog.tsx (6)

1-30: LGTM: Well-organized imports.

The imports are properly structured with good separation between UI components, utilities, assets, and external dependencies. All imports appear to be used within the component.


31-33: LGTM: Clean interface definition.

The interface is well-defined with appropriate typing for the callback prop.


36-76: Good implementation with minor suggestions.

The GitHubStarButton component is well-implemented with proper error handling, caching, and retry logic. A few observations:

  1. External API dependency: The component relies on GitHub's API which could fail or be rate-limited
  2. Security: Using window.open is acceptable here since it's opening a known safe URL
  3. User experience: Consider showing a loading indicator or skeleton while fetching

Consider adding a loading indicator for better UX:

 <span className="font-medium">
     {
+        isLoading ? 'Loading...' :
         !isLoading && !isError && starCount ? `Star (${formatStarCount(starCount)})` : 'Star'
     }
 </span>

251-268: LGTM: Clean state management and navigation logic.

The component properly manages the current step state with appropriate bounds checking in the navigation functions.


270-337: Excellent dialog implementation with great UX.

The dialog component is well-implemented with:

  • Proper open/close state management
  • Intuitive two-column layout
  • Clear navigation with progress indicators
  • Appropriate button states for edge cases
  • Good use of conditional styling

The fixed height (h-[525px]) works well for a modal, but consider making it responsive for smaller screens if needed.


79-249: Well-structured tutorial content (external URLs verified)

The tutorial steps are well-organized with good use of React components, proper accessibility attributes, and clear, informative content. All external links and the hero video asset have been verified and return HTTP 200.

• All external URLs in the tutorial (docs.sourcebot.dev, github.com/sourcebot-dev, sourcebot.dev, and the Google Storage asset) are accessible.
• Consider extracting repeated hardcoded URLs (and the video asset path) into constants or a small configuration module to improve maintainability.

msukkari
msukkari previously approved these changes Jul 29, 2025
@brendan-kellam brendan-kellam merged commit 4343b3c into main Jul 29, 2025
6 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/ask_sb_tutorial branch July 29, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants