Files
Raminder SinghandSaxon Fletcher 5a41d0155e chore: integration UI refinement (#45507)
This PR:

* Refactors integrations page implementation to make it simpler and
easier to understand.
* Integration category pages from marketplace db show category name and
description.
* Shows featured integrations coming from the marketplace db at the top
of the page.
* Hides empty categories:
https://linear.app/supabase/issue/INT-113/hide-empty-categories-on-dashboard-integrations-page

Below design related fixes will be done in a separate PR:
https://github.com/supabase/supabase/pull/45856. So this PR is ready to
merge with current fixes.

<details>

~~Design fixes needed after consulting with the design team:~~

- [ ] ~~Do not use inverted colors on images for featured integrations.
This leads to inconsistent images for the featured marketplace listings.
E.g. Grafana listing shown in the featured listings:~~
<img width="463" height="260" alt="image"
src="https://github.com/user-attachments/assets/76816807-667f-44b0-b68c-5e1ca342be1f"
/>

~~vs shown on it's own page:~~

<img width="909" height="667" alt="image"
src="https://github.com/user-attachments/assets/00efda48-3e4e-4b05-87ad-cbbce9047c94"
/>

- [ ] ~~The images on featured marketplace integrations should not be
truncated as seen in the first image above.~~
- [ ] ~~The **Install integration** button feels floating far out on the
right.~~
- [ ] ~~The description under the title is too long and truncated.
Requested by Doppler here:
https://supabase.slack.com/archives/C0AL11JG5MG/p1778009104728819?thread_ts=1777654129.027269&cid=C0AL11JG5MG~~
- [ ] ~~The content section doesn't render bulleted lists correctly.~~
</details>


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

* **New Features**
  * Dedicated "Featured Integrations" section on the integrations page.
* Integrations can be marked as featured to appear in the featured
section.

* **Improvements**
  * Sidebar shows only categories that contain integrations.
  * Integration image handling improved for featured cards.
* Updated loading placeholders for integrations to provide a smoother
loading experience.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45507)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
2026-05-14 02:36:28 +05:30

138 lines
5.2 KiB
TypeScript

import { Search } from 'lucide-react'
import { parseAsString, useQueryState } from 'nuqs'
import { buttonVariants, cn, Tabs_Shadcn_, TabsList_Shadcn_, TabsTrigger_Shadcn_ } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { Input } from 'ui-patterns/DataInputs/Input'
import { IntegrationCard, IntegrationLoadingCard } from './IntegrationCard'
import { useAvailableIntegrations } from './useAvailableIntegrations'
import { useInstalledIntegrations } from './useInstalledIntegrations'
import AlertError from '@/components/ui/AlertError'
import { NoSearchResults } from '@/components/ui/NoSearchResults'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
type IntegrationCategory = 'all' | 'wrapper' | 'postgres_extensions' | 'custom'
const CATEGORIES = [
{ key: 'all', label: 'All Integrations' },
{ key: 'wrapper', label: 'Wrappers' },
{ key: 'postgres_extension', label: 'Postgres Modules' },
] as const
export const AvailableIntegrations = () => {
const { integrationsWrappers } = useIsFeatureEnabled(['integrations:wrappers'])
const [selectedCategory, setSelectedCategory] = useQueryState(
'category',
parseAsString.withDefault('all').withOptions({ clearOnDefault: true })
)
const [search, setSearch] = useQueryState(
'search',
parseAsString.withDefault('').withOptions({ clearOnDefault: true })
)
const { data: allIntegrations = [] } = useAvailableIntegrations()
const { installedIntegrations, error, isError, isLoading, isSuccess } = useInstalledIntegrations()
const installedIds = installedIntegrations.map((i) => i.id)
// available integrations for install
const availableIntegrations = integrationsWrappers
? allIntegrations
: allIntegrations.filter((x) => !x.id.endsWith('_wrapper'))
const integrationsByCategory =
selectedCategory === 'all'
? availableIntegrations
: availableIntegrations.filter((i) => i.type === selectedCategory)
const filteredIntegrations = (
search.length > 0
? integrationsByCategory.filter((i) => i.name.toLowerCase().includes(search.toLowerCase()))
: integrationsByCategory
).sort((a, b) => a.name.localeCompare(b.name))
return (
<>
<Tabs_Shadcn_
className="mt-4"
value={selectedCategory}
onValueChange={(value) => setSelectedCategory(value as IntegrationCategory)}
>
<TabsList_Shadcn_ className="px-4 md:px-10 gap-2 border-b-0 border-t pt-5">
{CATEGORIES.map((category) => (
<TabsTrigger_Shadcn_
key={category.key}
value={category.key}
onClick={() => setSelectedCategory(category.key as IntegrationCategory)}
className={cn(
buttonVariants({
size: 'tiny',
type: selectedCategory === category.key ? 'default' : 'outline',
}),
selectedCategory === category.key ? 'text-foreground' : 'text-foreground-lighter',
'rounded-full! px-3'
)}
>
{category.label}
</TabsTrigger_Shadcn_>
))}
<Input
value={search}
onChange={(e) => {
setSearch(e.target.value)
setSelectedCategory('all')
}}
containerClassName="group w-40 ml-5"
icon={
<Search
size={14}
className="transition text-foreground-lighter group-hover:text-foreground"
/>
}
iconContainerClassName="p-0"
className="pl-7 rounded-none border-0! border-transparent bg-transparent shadow-none! ring-0! ring-offset-0!"
placeholder="Search..."
/>
</TabsList_Shadcn_>
</Tabs_Shadcn_>
<div className="p-4 md:p-10 md:py-8 flex flex-col gap-y-5">
<div className="grid xl:grid-cols-3 2xl:grid-cols-4 gap-x-4 gap-y-3">
{isLoading &&
Array.from({ length: 3 }).map((_, idx) => (
<IntegrationLoadingCard key={`integration-loading-${idx}`} />
))}
{isError && (
<AlertError
className="xl:col-span-3 2xl:col-span-4"
subject="Failed to retrieve available integrations"
error={error}
/>
)}
{isSuccess &&
filteredIntegrations.map((i) => (
<IntegrationCard key={i.id} {...i} isInstalled={installedIds.includes(i.id)} />
))}
{isSuccess && search.length > 0 && filteredIntegrations.length === 0 && (
<NoSearchResults
className="xl:col-span-3 2xl:col-span-4"
searchString={search}
onResetFilter={() => setSearch('')}
/>
)}
{isSuccess &&
selectedCategory !== 'all' &&
search.length === 0 &&
filteredIntegrations.length === 0 && (
<Admonition
showIcon={false}
className="xl:col-span-3 2xl:col-span-4"
type="default"
title="All integrations in this category are currently in use"
description="Manage your installed integrations in the section above"
/>
)}
</div>
</div>
</>
)
}