Files
Saxon FletcherandJoshen Lim 0e60c5f341 Chore/connect sheet/button (#42367)
This is the first smaller PR in the broader change of updating our
Connect dialog (see
[here](https://github.com/supabase/supabase/pull/42276)).

This PR focuses on decoupling the ConnectButton our of the Connect
dialog and into its own component . The button includes a flag to render
the new sheet. The new sheet is empty for the time being as the flag is
at 0%.

To test:
- Enable flag and click button, see new Sheet
- Disable and see old dialog
- Create a new project -> in getting started section see "connect to
app" step -> Click connect button and make sure it works


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

* **New Features**
  - Added a Connect button component and an alternative Connect sheet.
  - Added curl syntax highlighting for code blocks.

* **Changes**
- Connection dialog moved to a controlled open-state pattern; Connect
replaced legacy entry points across the UI and can be feature-flagged.
- Connection actions simplified and no longer depend on framework
selection.

* **Removals**
- Removed legacy framework selector, default framework constant, and
related tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-04 11:53:32 +11:00

40 lines
1.2 KiB
TypeScript

import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { Plug } from 'lucide-react'
import { parseAsBoolean, useQueryState } from 'nuqs'
import { ComponentProps } from 'react'
import { Button } from 'ui'
import { PROJECT_STATUS } from '@/lib/constants'
interface ConnectButtonProps {
buttonType?: ComponentProps<typeof Button>['type']
}
export const ConnectButton = ({ buttonType = 'default' }: ConnectButtonProps) => {
const { data: selectedProject } = useSelectedProjectQuery()
const isActiveHealthy = selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHY
const [_, setShowConnect] = useQueryState('showConnect', parseAsBoolean.withDefault(false))
return (
<ButtonTooltip
type={buttonType}
disabled={!isActiveHealthy}
className="rounded-full"
icon={<Plug className="rotate-90" />}
onClick={() => setShowConnect(true)}
tooltip={{
content: {
side: 'bottom',
text: !isActiveHealthy
? 'Project is currently not active and cannot be connected'
: undefined,
},
}}
>
<span>Connect</span>
</ButtonTooltip>
)
}