mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
Replaces all remaining `next/image` and `next/legacy/image` imports in `apps/studio` with plain `<img>` elements and deletes both compat shims and their Vite aliases (following #53906, which removed the last `next/image` import from `packages/ui-patterns`). **Changed:** - Replaced 26 `next/image` and 3 `next/legacy/image` call sites across `apps/studio` with plain `<img>` elements (every local `src` already prepends `BASE_PATH` / `router.basePath`, and none used `loader`, `priority`, `placeholder`, `quality`, or `onLoadingComplete`) - Converted `fill` / `layout="fill"` usages in `IntegrationCard`, `MarketplaceFeaturedHeroGrid`, `Integrations.constants`, `useAvailableIntegrations`, and `IntegrationPanels` to Tailwind sizing classes, and dropped no-op `layout="fixed"` props in `FormContents` and `HookList` - Replaced invalid `layout="fill" objectFit="cover"` props passed to `next/image` in `HelpPanel` with `absolute inset-0 h-full w-full object-cover` - Cleaned up image accessibility across the touched call sites (accurate alt text on feature preview screenshots and `HookList`, `alt=""` + `aria-hidden="true"` on decorative icons/illustrations next to visible labels) **Removed:** - `apps/studio/compat/next/image.tsx` - `apps/studio/compat/next/legacy/image.tsx` - `'next/image'` and `'next/legacy/image'` aliases from `apps/studio/vite.config.ts` ## To test - Confirm `git grep -E "next/(legacy/)?image" apps/studio/` has no remaining imports - Check images render as expected across the updated surfaces: - **Integrations marketplace** (`/project/_/integrations`): featured hero covers (`MarketplaceFeaturedHeroGrid`), integration icons in cards, sidebar, and wrapper rows (`Integrations.constants`, `useAvailableIntegrations`) - **Help panel**: Discord card background illustration - **Account & settings**: Account Connections GitHub icon, Add-ons cards (IPv4 / PITR / Custom Domain), Spend Cap card & side panel, user profile avatars (`ProfileImage`), and Feature Previews modal images - **Database Webhooks** (`FormContents`, `HookList`) and Third-Party Auth provider dropdown/cards --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { useTheme } from 'next-themes'
|
|
import { cn } from 'ui'
|
|
|
|
import { BASE_PATH } from '@/lib/constants'
|
|
|
|
interface ConnectionIconProps {
|
|
icon: string
|
|
iconFolder?: string
|
|
supportsDarkMode?: boolean
|
|
size?: number
|
|
className?: string
|
|
}
|
|
|
|
export const ConnectionIcon = ({
|
|
icon,
|
|
iconFolder,
|
|
supportsDarkMode,
|
|
size = 14,
|
|
className,
|
|
}: ConnectionIconProps) => {
|
|
const { resolvedTheme } = useTheme()
|
|
|
|
const imageFolder =
|
|
iconFolder || (['ionic-angular'].includes(icon) ? 'icons/frameworks' : 'libraries')
|
|
|
|
const imageExtension = imageFolder === 'icons/frameworks' ? '' : '-icon'
|
|
|
|
const shouldUseDarkMode =
|
|
supportsDarkMode ||
|
|
['expo', 'nextjs', 'prisma', 'drizzle', 'astro', 'remix', 'refine'].includes(icon.toLowerCase())
|
|
|
|
const iconImgSrc = icon.startsWith('http')
|
|
? icon
|
|
: `${BASE_PATH}/img/${imageFolder}/${icon.toLowerCase()}${
|
|
shouldUseDarkMode && resolvedTheme?.includes('dark') ? '-dark' : ''
|
|
}${imageExtension}.svg`
|
|
|
|
return (
|
|
<img
|
|
className={cn('transition-all group-hover:scale-110', className)}
|
|
src={iconImgSrc}
|
|
alt={`${icon} logo`}
|
|
width={size}
|
|
height={size}
|
|
/>
|
|
)
|
|
}
|