Files
supabase/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx
Ali Waseem 0278672102 feat(studio): add Auth sub-page navigation chords (#45696)
## Summary
- Adds contextual `A + <letter>` chord shortcuts for jumping between
Authentication sub-pages while `AuthLayout` is mounted, mirroring the
existing database-nav chord pattern.
- Wires the shared `LIST_PAGE_*` shortcuts (focus search, create new,
reset filters, schema selector) onto the Auth list pages so they behave
like the Database list pages.
- Fills in the previously-missing `A + U` chord for the **Users** page
so every entry in the Auth menu has a chord.

Resolves
[FE-3187](https://linear.app/supabase/issue/FE-3187/add-a-u-keyboard-shortcut-for-auth-users-page).

## Auth navigation chords

Active anywhere under `/project/<ref>/auth/*`. Press `A` then the listed
letter.

| Page | Chord |
| --- | --- |
| Overview | `A` `O` |
| Users | `A` `U` |
| OAuth Apps | `A` `A` |
| Email | `A` `E` |
| Policies | `A` `P` |
| Sign In / Providers | `A` `I` |
| Passkeys | `A` `K` |
| OAuth Server | `A` `V` |
| Sessions | `A` `S` |
| Rate Limits | `A` `R` |
| Multi-Factor | `A` `M` |
| URL Configuration | `A` `L` |
| Attack Protection | `A` `T` |
| Auth Hooks | `A` `H` |
| Audit Logs | `A` `G` |
| Performance | `A` `F` |

## Auth list-page shortcuts

Each Auth list page opts into the shared `LIST_PAGE_*` registry — same
chords as the Database list pages (`Shift+F`, `Shift+N`, `F` `C`, `O`
`S`). Coverage matches the controls each page actually exposes:

| List page | Search (`Shift+F`) | New (`Shift+N`) | Reset filters (`F`
`C`) | Schema selector (`O` `S`) |
| --- | :---: | :---: | :---: | :---: |
| Custom Auth Providers | ✓ | ✓ | ✓ | — |
| OAuth Apps | ✓ | ✓ | ✓ | — |
| Policies | ✓ | — | ✓ | ✓ |
| Auth Hooks | — | ✓ | — | — |
| Redirect URLs | — | ✓ | — | — |
| Third-Party Auth | — | ✓ | — | — |

## Test plan
- [x] While anywhere under `/project/<ref>/auth/*`, every chord in the
navigation table jumps to the corresponding page.
- [x] On each list page in the second table, the marked shortcuts focus
the search input / open the create flow / reset filters / open the
schema picker as expected.
- [x] Chords are not active outside of `/project/<ref>/auth/*` and do
not trigger while typing in inputs (where `ignoreInputs` applies).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Global keyboard shortcuts for Auth pages: navigate auth sections,
focus/search inputs, reset filters, and open "Add" flows (providers,
OAuth apps, hooks, URLs, policies).
* "Add" controls in lists respond to shortcuts and show appropriate
disabled/tooltip states when unavailable.
* Product menu and shortcuts reference now include an "Auth Navigation"
section and per-item shortcut hints.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-05-08 07:13:25 -06:00

77 lines
2.2 KiB
TypeScript

import { ChevronDown } from 'lucide-react'
import Image from 'next/image'
import {
Button,
cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from 'ui'
import {
getIntegrationTypeIcon,
getIntegrationTypeLabel,
INTEGRATION_TYPES,
} from './ThirdPartyAuthForm.utils'
interface AddIntegrationDropdownProps {
buttonText?: string
align?: 'end' | 'center'
type?: 'primary' | 'default'
open?: boolean
onOpenChange?: (open: boolean) => void
onSelectIntegrationType: (type: INTEGRATION_TYPES) => void
}
const ProviderDropdownItem = ({
disabled,
type,
onSelectIntegrationType,
}: {
disabled?: boolean
type: INTEGRATION_TYPES
onSelectIntegrationType: (type: INTEGRATION_TYPES) => void
}) => {
return (
<DropdownMenuItem
key={type}
onClick={() => onSelectIntegrationType(type)}
className={cn('flex items-center gap-x-2 p-2', disabled && 'cursor-not-allowed')}
disabled={disabled}
>
<Image src={getIntegrationTypeIcon(type)} width={16} height={16} alt={`${type} icon`} />
<span>{getIntegrationTypeLabel(type)}</span>
</DropdownMenuItem>
)
}
export const AddIntegrationDropdown = ({
type = 'primary',
align = 'end',
open,
onOpenChange,
onSelectIntegrationType,
}: AddIntegrationDropdownProps) => {
return (
<DropdownMenu open={open} onOpenChange={onOpenChange}>
<DropdownMenuTrigger asChild>
<Button type={type} iconRight={<ChevronDown />}>
Add provider
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align={align} className="w-56">
<DropdownMenuLabel>Select provider</DropdownMenuLabel>
<DropdownMenuSeparator />
<ProviderDropdownItem type="firebase" onSelectIntegrationType={onSelectIntegrationType} />
<ProviderDropdownItem type="clerk" onSelectIntegrationType={onSelectIntegrationType} />
<ProviderDropdownItem type="workos" onSelectIntegrationType={onSelectIntegrationType} />
<ProviderDropdownItem type="auth0" onSelectIntegrationType={onSelectIntegrationType} />
<ProviderDropdownItem type="awsCognito" onSelectIntegrationType={onSelectIntegrationType} />
</DropdownMenuContent>
</DropdownMenu>
)
}