mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 02:27:21 +08:00
## Context Related to marketplace related work, just moves the Queues integration to the new UI (Changes are feature flagged) <img width="1145" height="584" alt="image" src="https://github.com/user-attachments/assets/d3245889-597d-44e2-9850-f20907e42056" /> Installation is now in a side panel with the intention that it'll just be a single click to install integrations that involve multiple parts <img width="400" height="955" alt="image" src="https://github.com/user-attachments/assets/71903b61-6bd2-486c-903e-b48ae2133887" /> ## To test - Verify that you can install the integration and everything else should be status quo - Verify that everything should be status quo if the flag is off
101 lines
3.2 KiB
TypeScript
101 lines
3.2 KiB
TypeScript
import { useParams } from 'common'
|
|
import { Markdown } from 'components/interfaces/Markdown'
|
|
import { PropsWithChildren } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
import { useAvailableIntegrations } from '../../Landing/useAvailableIntegrations'
|
|
import { FilesViewer } from './FilesViewer'
|
|
import { MarkdownContent } from './MarkdownContent'
|
|
import { InlineLinkClassName } from '@/components/ui/InlineLink'
|
|
|
|
const getSiteUrlLabel = (url: string | undefined | null) => {
|
|
if (!url) return undefined
|
|
|
|
try {
|
|
return new URL(url).origin
|
|
} catch (error) {
|
|
return undefined
|
|
}
|
|
}
|
|
|
|
const isGithubHost = (url: string | undefined | null) => {
|
|
if (!url) return false
|
|
try {
|
|
const hostname = new URL(url).hostname.toLowerCase()
|
|
return hostname === 'github.com' || hostname.endsWith('.github.com')
|
|
} catch (error) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
/**
|
|
* [Joshen] This will serve as the overview tab for remotely fetched integrations
|
|
*/
|
|
export const IntegrationOverviewTabV2 = ({ children }: PropsWithChildren) => {
|
|
const { id } = useParams()
|
|
|
|
const { data: allIntegrations } = useAvailableIntegrations()
|
|
const integration = allIntegrations.find((i) => i.id === id)
|
|
|
|
if (!integration) {
|
|
return <div>Unsupported integration type</div>
|
|
}
|
|
|
|
const { type, content, docsUrl, siteUrl, files = [] } = integration
|
|
|
|
const docsUrlLabel = docsUrl?.includes('supabase.com/docs')
|
|
? 'Supabase Docs'
|
|
: isGithubHost(docsUrl)
|
|
? 'GitHub Docs'
|
|
: 'Documentation'
|
|
const siteUrlLabel = getSiteUrlLabel(siteUrl)
|
|
|
|
return (
|
|
<div className="grid grid-cols-3 gap-x-8 px-10 py-8">
|
|
<div className="col-span-2 flex flex-col gap-y-8">
|
|
{files.length > 0 && <FilesViewer files={files} />}
|
|
<MarkdownContent integrationId={id} content={content} />
|
|
{children}
|
|
</div>
|
|
|
|
<div className="text-sm col-span-1 flex flex-col gap-y-8">
|
|
<div className="flex flex-col gap-y-4">
|
|
<p>Details</p>
|
|
|
|
<div className="flex flex-col gap-y-1">
|
|
<p className="font-mono uppercase text-foreground-light">Type</p>
|
|
<p className="capitalize">{type === 'oauth' ? 'OAuth' : type.replaceAll('_', ' ')}</p>
|
|
</div>
|
|
|
|
<div className="flex flex-col gap-y-1">
|
|
<p className="font-mono uppercase text-foreground-light">Built by</p>
|
|
<p className={cn(!integration.author.name && 'text-foreground-lighter')}>
|
|
{integration.author.name || 'Unknown Author'}
|
|
</p>
|
|
</div>
|
|
|
|
{docsUrl && (
|
|
<div className="flex flex-col gap-y-1">
|
|
<p className="font-mono uppercase text-foreground-light">Docs</p>
|
|
<a target="_blank" rel="noreferrer" href={docsUrl} className={InlineLinkClassName}>
|
|
{docsUrlLabel}
|
|
</a>
|
|
</div>
|
|
)}
|
|
|
|
{siteUrl && (
|
|
<div className="flex flex-col gap-y-1">
|
|
<p className="font-mono uppercase text-foreground-light">Website</p>
|
|
<a target="_blank" rel="noreferrer" href={siteUrl} className={InlineLinkClassName}>
|
|
{siteUrlLabel}
|
|
</a>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Subsequent other actions here */}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|