Skip to content

Move Warehouse Native to top navigation bar #2896

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 82 commits into from
May 8, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 18, 2025

Move Warehouse Native to top navigation bar and implement dynamic search filtering

This PR:

  • Moves the Warehouse Native docs to its own top-level section in the navigation bar
  • Cleans up the categories for the SDK/API section to force subsections expanded like the main sidebar
  • Ensures proper styling for both sections
  • Implements dynamic search filtering based on the active navigation section

Dynamic Search Filtering

Added a custom JavaScript solution to dynamically scope Algolia search results based on the active navigation section:

  • When in "SDKs & APIs" section, search is scoped to Client SDKs, Server SDKs, Console API, and HTTP API content
  • When in "Warehouse Native" section, search is scoped to Warehouse Native content only
  • When in main "Product Docs" section, search includes all content (default behavior)

The implementation:

  1. Intercepts Algolia search requests using both XMLHttpRequest and fetch API interception
  2. Detects the current section based on URL path and active navigation items
  3. Adds appropriate path-based filters to Algolia search parameters
  4. Provides a visual indicator in the search modal showing which section is being searched

Cross-section links

The following links from Warehouse Native docs point to sections outside of Warehouse Native:

  • Links to experimentation sections (e.g., experiments-plus/differential-impact-detection)
  • Links to stats-engine sections (e.g., stats-engine/metric-deltas, stats-engine/variance)
  • Links to pulse sections (e.g., pulse/read-pulse, pulse/drill-down)

Testing

  • Tested locally and verified the navigation works correctly
  • Verified both SDK/API and Warehouse Native sections have proper nesting and styling
  • Tested search functionality to verify section-specific filtering works correctly:
    • When in Warehouse Native section, searching for "sdk" only shows Warehouse Native results
    • When in SDKs & APIs section, searching for terms only shows SDK/API results
    • When in Product Docs section, searching shows general documentation results

Link to Devin run: https://app.devin.ai/sessions/9d8c8e8e999947b0b292f4ecad6a956f
Requested by: tore@statsig.com

Co-Authored-By: tore@statsig.com <tore@statsig.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sorry, something went wrong.

@jasonwzm
Copy link
Member

jasonwzm commented Apr 18, 2025

🚀 Deployed on https://681bfefe0e8ec842a568ff5c--cozy-fox-0defec.netlify.app

@jasonwzm jasonwzm temporarily deployed to pull request April 18, 2025 00:09 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:21 Inactive
devin-ai-integration bot and others added 2 commits April 21, 2025 22:22
Co-Authored-By: tore@statsig.com <tore@statsig.com>
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:27 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:37 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:41 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:47 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:50 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 22:56 Inactive
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 23:03 Inactive
devin-ai-integration bot and others added 2 commits April 21, 2025 23:04
Co-Authored-By: tore@statsig.com <tore@statsig.com>
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 23:09 Inactive
…tch interception

Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 23:22 Inactive
devin-ai-integration bot and others added 3 commits April 21, 2025 23:22
Co-Authored-By: tore@statsig.com <tore@statsig.com>
Co-Authored-By: tore@statsig.com <tore@statsig.com>
Co-Authored-By: tore@statsig.com <tore@statsig.com>
@jasonwzm jasonwzm temporarily deployed to pull request April 21, 2025 23:29 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 5, 2025 23:27 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 5, 2025 23:32 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 5, 2025 23:53 Inactive
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@jasonwzm jasonwzm temporarily deployed to pull request May 6, 2025 00:11 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 6, 2025 19:58 Inactive
Comment on lines +15 to +19
function getCurrentSection() {
const currentPageLink = document.querySelector('nav a[aria-current="page"]').id || "docs";
console.log('[Statsig Search] Current section:', currentPageLink);
return currentPageLink;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The getCurrentSection() function may throw an error on pages where no element with aria-current="page" exists (such as 404 pages). Consider using optional chaining to safely access the id property:

const currentPageLink = document.querySelector('nav a[aria-current="page"]')?.id || "docs";

This ensures the function gracefully handles cases where the selector doesn't match any elements.

Suggested change
function getCurrentSection() {
const currentPageLink = document.querySelector('nav a[aria-current="page"]').id || "docs";
console.log('[Statsig Search] Current section:', currentPageLink);
return currentPageLink;
}
function getCurrentSection() {
const currentPageLink = document.querySelector('nav a[aria-current="page"]')?.id || "docs";
console.log('[Statsig Search] Current section:', currentPageLink);
return currentPageLink;
}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@jasonwzm jasonwzm temporarily deployed to pull request May 7, 2025 17:19 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 7, 2025 17:51 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 7, 2025 18:19 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 7, 2025 18:31 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 7, 2025 18:44 Inactive
@jasonwzm jasonwzm temporarily deployed to pull request May 8, 2025 00:47 Inactive
@brock-statsig brock-statsig merged commit 54e941a into main May 8, 2025
4 checks passed
@brock-statsig brock-statsig deleted the devin/1744934342-warehouse-native-topbar branch May 8, 2025 01:25
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.

None yet

3 participants