mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { useParams } from 'common'
|
|
import Link from 'next/link'
|
|
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns'
|
|
|
|
import { IntegrationOverviewTab } from '../Integration/IntegrationOverviewTab'
|
|
import { RequiredExtensionsSection } from '../Integration/RequiredExtensionsSection'
|
|
import { useIsMarketplaceEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import { useDatabaseExtensionsQuery } from '@/data/database-extensions/database-extensions-query'
|
|
import { useQueuesExposePostgrestStatusQuery } from '@/data/database-queues/database-queues-expose-postgrest-status-query'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
|
|
const QueuesContent = () => {
|
|
const { ref } = useParams()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { data: isExposed } = useQueuesExposePostgrestStatusQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
|
|
const { data: extensions = [] } = useDatabaseExtensionsQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
const isQueuesInstalled = !!extensions.find((x) => x.name === 'pgmq')?.installed_version
|
|
|
|
if (isExposed) return null
|
|
|
|
return (
|
|
<Admonition
|
|
type="default"
|
|
title="Queues can be managed via any Supabase client library or PostgREST endpoints"
|
|
>
|
|
<p>
|
|
You may choose to toggle the exposure of Queues through Data APIs via the queues settings
|
|
</p>
|
|
|
|
{isQueuesInstalled && (
|
|
<Button asChild variant="default" className="mt-2">
|
|
<Link href={`/project/${ref}/integrations/queues/settings`}>Manage queues settings</Link>
|
|
</Button>
|
|
)}
|
|
</Admonition>
|
|
)
|
|
}
|
|
|
|
export const QueuesOverviewTab = () => {
|
|
const isMarketplaceEnabled = useIsMarketplaceEnabled()
|
|
|
|
if (isMarketplaceEnabled) return <RequiredExtensionsSection />
|
|
return <IntegrationOverviewTab actions={<QueuesContent />} />
|
|
}
|