mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +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>
167 lines
5.4 KiB
TypeScript
167 lines
5.4 KiB
TypeScript
import { ChevronDownIcon, RefreshCwIcon, UnlinkIcon } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
import { toast } from 'sonner'
|
|
import {
|
|
Badge,
|
|
Button,
|
|
Card,
|
|
CardContent,
|
|
cn,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from 'ui'
|
|
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionDescription,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import { useGitHubAuthorizationDeleteMutation } from '@/data/integrations/github-authorization-delete-mutation'
|
|
import { useGitHubAuthorizationQuery } from '@/data/integrations/github-authorization-query'
|
|
import { BASE_PATH } from '@/lib/constants'
|
|
import { openInstallGitHubIntegrationWindow } from '@/lib/github'
|
|
|
|
export const AccountConnections = () => {
|
|
const {
|
|
data: gitHubAuthorization,
|
|
isPending: isLoading,
|
|
isSuccess,
|
|
isError,
|
|
error,
|
|
} = useGitHubAuthorizationQuery()
|
|
|
|
const [isRemoveModalOpen, setIsRemoveModalOpen] = useState(false)
|
|
|
|
const isConnected = gitHubAuthorization !== null
|
|
|
|
const { mutate: removeAuthorization, isPending: isRemoving } =
|
|
useGitHubAuthorizationDeleteMutation({
|
|
onSuccess: () => {
|
|
toast.success('GitHub authorization removed successfully')
|
|
setIsRemoveModalOpen(false)
|
|
},
|
|
})
|
|
|
|
const handleConnect = () => {
|
|
openInstallGitHubIntegrationWindow('authorize')
|
|
}
|
|
|
|
const handleReauthenticate = () => {
|
|
openInstallGitHubIntegrationWindow('authorize')
|
|
}
|
|
|
|
const handleRemove = () => {
|
|
removeAuthorization()
|
|
}
|
|
|
|
return (
|
|
<PageSection>
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Connections</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
Connect your Supabase account with other services.
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
<Card>
|
|
{isLoading && (
|
|
<CardContent>
|
|
<ShimmeringLoader />
|
|
</CardContent>
|
|
)}
|
|
{isError && (
|
|
<CardContent>
|
|
<p className="text-sm text-destructive">
|
|
Failed to load GitHub connection status: {error?.message}
|
|
</p>
|
|
</CardContent>
|
|
)}
|
|
{isSuccess && (
|
|
<CardContent className="flex justify-between items-center">
|
|
<div className="flex gap-x-4 items-center">
|
|
<img
|
|
className={cn('dark:invert')}
|
|
src={`${BASE_PATH}/img/icons/github-icon.svg`}
|
|
width={30}
|
|
height={30}
|
|
alt=""
|
|
aria-hidden="true"
|
|
/>
|
|
<div>
|
|
<div className="flex items-center gap-x-2">
|
|
<p className="text-sm">GitHub</p>
|
|
{isConnected && <Badge variant="success">Connected</Badge>}
|
|
</div>
|
|
<p className="text-sm text-foreground-lighter">
|
|
Sync repos to Supabase projects for automatic branch creation and merging
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div className="flex items-center gap-x-2 ml-2">
|
|
{isConnected ? (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button iconRight={<ChevronDownIcon size={14} />}>
|
|
<span>Manage</span>
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent side="bottom" align="end" className="w-44">
|
|
<DropdownMenuItem
|
|
className="space-x-2"
|
|
onSelect={(event) => {
|
|
event.preventDefault()
|
|
handleReauthenticate()
|
|
}}
|
|
>
|
|
<RefreshCwIcon size={14} />
|
|
<p>Re-authenticate</p>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem
|
|
className="space-x-2"
|
|
onSelect={() => setIsRemoveModalOpen(true)}
|
|
>
|
|
<UnlinkIcon size={14} />
|
|
<p>Remove connection</p>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
) : (
|
|
<Button variant="primary" onClick={handleConnect}>
|
|
Connect
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
)}
|
|
</Card>
|
|
<ConfirmationModal
|
|
variant="destructive"
|
|
size="small"
|
|
visible={isRemoveModalOpen}
|
|
title="Confirm to remove GitHub authorization"
|
|
confirmLabel="Remove connection"
|
|
onCancel={() => setIsRemoveModalOpen(false)}
|
|
onConfirm={handleRemove}
|
|
loading={isRemoving}
|
|
>
|
|
<p className="text-sm text-foreground-light">
|
|
Removing this authorization will disconnect your GitHub account from Supabase. You can
|
|
reconnect at any time.
|
|
</p>
|
|
</ConfirmationModal>
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
)
|
|
}
|