mirror of
https://github.com/supabase/supabase.git
synced 2026-06-18 05:33:50 +08:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? feature ## Additional context Needs API deployment, adds a toggle to allow roles to only be available on branch projects <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a "Branches only" option for JIT database access grants; included when grants are submitted. * **UI** * Configuration UI shows an informational notice and hides temporary-access controls when preview branches are managed from the main branch. * Feature preview label changed to "Temporary access"; badge text now reads "Preview". * **Tests** * Unit test updated to cover branches-only serialization. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45411?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
34 lines
930 B
TypeScript
34 lines
930 B
TypeScript
import { FlaskConical } from 'lucide-react'
|
|
import { Badge, cn } from 'ui'
|
|
|
|
import { useFeaturePreviewModal } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
|
|
interface FeaturePreviewBadgeProps {
|
|
featureKey: string
|
|
className?: string
|
|
}
|
|
|
|
export const FeaturePreviewBadge = ({ featureKey, className }: FeaturePreviewBadgeProps) => {
|
|
const { selectFeaturePreview } = useFeaturePreviewModal()
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={() => selectFeaturePreview(featureKey)}
|
|
className="group flex items-center"
|
|
title="Feature preview — click to manage"
|
|
>
|
|
<Badge
|
|
variant="default"
|
|
className={cn(
|
|
'cursor-pointer group-hover:border-foreground-light group-hover:text-foreground transition-colors',
|
|
className
|
|
)}
|
|
>
|
|
<FlaskConical size={8} strokeWidth={1.5} />
|
|
Preview
|
|
</Badge>
|
|
</button>
|
|
)
|
|
}
|