Files
supabase/apps/studio/components/interfaces/App/FeaturePreview/AdvisorRulesPreview.tsx
Alaister YoungandAlaister Young 87b9d0562e [FE-5111] refactor(studio): replace next/image shims with plain img (#54011)
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>
2026-11-26 16:23:41 +08:00

44 lines
1.8 KiB
TypeScript

import { useFlag, useParams } from 'common'
import { useIsAdvisorRulesEnabled } from './FeaturePreviewContext'
import { InlineLink } from '@/components/ui/InlineLink'
import { BASE_PATH } from '@/lib/constants'
export const AdvisorRulesPreview = () => {
const { ref } = useParams()
const isIssuesInboxEnabled = useFlag('issuesInbox')
const isAdvisorRulesEnabled = useIsAdvisorRulesEnabled()
const overviewHref = isIssuesInboxEnabled
? `/project/${ref}/issues?category=security`
: `/project/${ref}/advisors/security`
const href = isAdvisorRulesEnabled ? `/project/${ref}/advisors/rules/security` : overviewHref
return (
<div>
<p className="text-sm text-foreground-light mb-4">
{isIssuesInboxEnabled
? 'Turn off specific checks or categories to stop them showing up in Issues or email notifications. This could be useful for checks that might not apply to your project.'
: 'Disable specific Advisor categories or rules to prevent them from showing up in Advisor reports or email notifications. This could be useful for rules that might not be applicable to your project.'}
</p>
<img
src={`${BASE_PATH}/img/previews/advisor-rule-preview.png`}
width={1296}
height={900}
alt="Advisor rules list showing a toggle to disable a lint for the project"
className="rounded-sm border mb-4"
/>
<div className="space-y-2 mt-4!">
<p className="text-sm">Enabling this preview will:</p>
<ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">
<li>
Allow you to disable advisor rules for your project from the{' '}
<InlineLink href={href}>
{isIssuesInboxEnabled ? 'Issues section.' : 'Advisors section.'}
</InlineLink>
</li>
</ul>
</div>
</div>
)
}