Files
supabase/apps/docs/features/SearchV2/AskAiTrigger.tsx
Anthony Lio b28c6fa822 feat(docs): ai layout top bar + breadcrumbs (#52975)
## Problem

- docs top bar holds the global nav menus, so it repeats what the new
sidebar shows
- redesign needs a top bar with a breadcrumb for the current page and
room for the page actions

## Solution

- replaces the top bar with a logo cell, a breadcrumb, the page actions
and an account cell
- adds a sections menu under the logo, so a reader moves between docs,
reference and the knowledge base
- adds a breadcrumb slot for the current heading, which the right rail
fills in #PR5, and a reference version dropdown
- replaces the search field with an icon button, and shows ⌘K and ⌘I in
the search and ask ai tooltips
- adds a legacy copy of the current top bar, so the flag can show it

merge the stack together, because the new top bar shows for every reader
until #PR5 adds the flag switch

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/docs/guides/database/overview](https://docs-git-antlio-docs-v2-4-top-bar-supabase.vercel.app/docs/guides/database/overview)
2. make sure that the breadcrumb shows Database and the page
3. open
[/docs/reference/javascript/introduction](https://docs-git-antlio-docs-v2-4-top-bar-supabase.vercel.app/docs/reference/javascript/introduction),
and make sure that the breadcrumb has a version dropdown after
JavaScript

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-11 16:31:33 +02:00

36 lines
999 B
TypeScript

'use client'
import { Button, cn, KeyboardShortcut, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { ASK_AI_SHORTCUT_KEY } from './constants'
import { useSearchV2 } from './SearchV2Provider'
interface AskAiTriggerProps {
className?: string
}
export function AskAiTrigger({ className }: AskAiTriggerProps) {
const { isAskAiOpen, showAskAi } = useSearchV2()
const handleClick = () => showAskAi({ triggerType: 'ask_ai_button' })
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
aria-haspopup="dialog"
aria-expanded={isAskAiOpen}
aria-keyshortcuts={`Meta+${ASK_AI_SHORTCUT_KEY} Control+${ASK_AI_SHORTCUT_KEY}`}
onClick={handleClick}
className={cn('h-[30px]', className)}
>
Ask AI
</Button>
</TooltipTrigger>
<TooltipContent side="bottom">
<KeyboardShortcut keys={['Meta', ASK_AI_SHORTCUT_KEY]} variant="keycaps" />
</TooltipContent>
</Tooltip>
)
}