mirror of
https://github.com/supabase/supabase.git
synced 2026-07-24 08:30:05 -04:00
4df3c86e93
Add link to Admin Studio in top bar for internal use only. Resolves FE-3864 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a conditional Admin Studio shortcut to the desktop project header. * The shortcut opens the relevant project in Admin Studio and is available only when configured and enabled. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
38 lines
995 B
TypeScript
38 lines
995 B
TypeScript
import { useFlag, useParams } from 'common'
|
|
import { Wrench } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import { ADMIN_STUDIO_URL, IS_PLATFORM } from '@/lib/constants'
|
|
|
|
export const AdminStudioButton = () => {
|
|
const params = useParams()
|
|
const adminStudioLinkEnabled = useFlag('adminStudioLink')
|
|
|
|
const isVisible = IS_PLATFORM ? adminStudioLinkEnabled : false
|
|
|
|
if (!isVisible || !ADMIN_STUDIO_URL || !params.ref) return null
|
|
|
|
return (
|
|
<ButtonTooltip
|
|
asChild
|
|
variant="default"
|
|
className="rounded-full w-[26px] h-[26px]"
|
|
icon={<Wrench size={16} strokeWidth={1.5} />}
|
|
tooltip={{
|
|
content: {
|
|
text: 'Open in Admin Studio',
|
|
side: 'bottom',
|
|
align: 'center',
|
|
},
|
|
}}
|
|
>
|
|
<Link
|
|
href={`${ADMIN_STUDIO_URL}?identifier=${params.ref}`}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
/>
|
|
</ButtonTooltip>
|
|
)
|
|
}
|