Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

new UI for vercel integration marketplace flow

Jonathan Summers-Muiraf5433acbecc
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index 30d9ad7d52e..f5009a16d8d 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -63,6 +63,7 @@ export * from './src/components/Form'
export * from './src/components/Command'
// layout
+export * from './src/components/LoadingLine'
// banners
export * from './src/layout/banners'
diff --git a/packages/ui/src/components/Command/Command.utils.tsx b/packages/ui/src/components/Command/Command.utils.tsx
index ee020395eb9..a7a44b0cc8b 100644
--- a/packages/ui/src/components/Command/Command.utils.tsx
+++ b/packages/ui/src/components/Command/Command.utils.tsx
@@ -7,7 +7,7 @@ import { DetailedHTMLProps, HTMLAttributes, KeyboardEventHandler } from 'react'
import { Modal } from '../Modal'
import { ModalProps } from '../Modal/Modal'
import { useCommandMenu } from './CommandMenuProvider'
-import { LoadingLine } from './LoadingLine'
+import { LoadingLine } from '../LoadingLine/LoadingLine'
type CommandPrimitiveElement = React.ElementRef<typeof CommandPrimitive>
type CommandPrimitiveProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive>
diff --git a/packages/ui/src/components/Command/LoadingLine.tsx b/packages/ui/src/components/LoadingLine/LoadingLine.tsx
similarity index 93%
rename from packages/ui/src/components/Command/LoadingLine.tsx
rename to packages/ui/src/components/LoadingLine/LoadingLine.tsx
index 1e590e092b1..afb8522b653 100644
--- a/packages/ui/src/components/Command/LoadingLine.tsx
+++ b/packages/ui/src/components/LoadingLine/LoadingLine.tsx
@@ -1,5 +1,5 @@
import React from 'react'
-import { cn } from './../../lib/utils'
+import { cn } from '../../lib/utils'
export const LoadingLine = ({ loading }: { loading: boolean }) => {
return (
diff --git a/packages/ui/src/components/LoadingLine/index.tsx b/packages/ui/src/components/LoadingLine/index.tsx
new file mode 100644
index 00000000000..16a23c1edfe
--- /dev/null
+++ b/packages/ui/src/components/LoadingLine/index.tsx
@@ -0,0 +1 @@
+export * from './LoadingLine'
diff --git a/studio/components/interfaces/Integrations/IntegrationPanels.tsx b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
index 6817050500b..9cf53225dfa 100644
--- a/studio/components/interfaces/Integrations/IntegrationPanels.tsx
+++ b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
@@ -6,8 +6,7 @@ import Image from 'next/image'
import React from 'react'
-import { Badge, Button, IconArrowRight, IconGitHub, IconSquare } from 'ui'
-import { cn } from 'ui/src/utils/cn'
+import { Badge, Button, IconArrowRight, IconGitHub, IconSquare, cn } from 'ui'
const ICON_STROKE_WIDTH = 2
const ICON_SIZE = 14
@@ -50,6 +49,7 @@ const HandleIcon = ({ type }: { type: HandleIconType }) => {
}
const Avatar = ({ src }: { src: string }) => {
+ console.log('src of avatar', src)
return (
<div className="relative border shadow-lg w-8 h-8 rounded-full overflow-hidden">
<Image src={src} width={30} height={30} layout="fill" alt="avatar" className="relative" />
@@ -80,7 +80,7 @@ const IntegrationInstallation = React.forwardRef<HTMLLIElement, IntegrationInsta
</span> */}
<div className="flex -space-x-1">
<IntegrationIconBlock />
- <Avatar src={connection.metadata.account.avatar} />
+ <Avatar src={connection?.metadata?.account?.avatar} />
</div>
</div>
<div className="flex flex-col gap-0">
diff --git a/studio/components/interfaces/Integrations/Integrations-Vercel.constants.ts b/studio/components/interfaces/Integrations/Integrations-Vercel.constants.ts
new file mode 100644
index 00000000000..4513c7a4aed
--- /dev/null
+++ b/studio/components/interfaces/Integrations/Integrations-Vercel.constants.ts
@@ -0,0 +1,52 @@
+export const ENV_VAR_KEYS = {
+ POSTGRES_URL: {
+ key: 'POSTGRES_URL',
+ type: 'encrypted',
+ },
+ POSTGRES_PRISMA_URL: {
+ key: 'POSTGRES_PRISMA_URL',
+ type: 'encrypted',
+ },
+ POSTGRES_URL_NON_POOLING: {
+ key: 'POSTGRES_URL_NON_POOLING',
+ type: 'encrypted',
+ },
+ POSTGRES_USER: {
+ key: 'POSTGRES_USER',
+ type: 'encrypted',
+ },
+ POSTGRES_HOST: {
+ key: 'POSTGRES_HOST',
+ type: 'encrypted',
+ },
+ POSTGRES_PASSWORD: {
+ key: 'POSTGRES_PASSWORD',
+ type: 'encrypted',
+ },
+ POSTGRES_DATABASE: {
+ key: 'POSTGRES_DATABASE',
+ type: 'encrypted',
+ },
+ SUPABASE_ANON_KEY: {
+ key: 'SUPABASE_ANON_KEY',
+ type: 'encrypted',
+ },
+ SUPABASE_URL: {
+ key: 'SUPABASE_URL',
+ type: 'encrypted',
+ },
+ SUPABASE_SERVICE_ROLE_KEY: {
+ key: 'SUPABASE_SERVICE_ROLE_KEY',
+ type: 'encrypted',
+ },
+ NEXT_PUBLIC_SUPABASE_ANON_KEY: {
+ key: 'NEXT_PUBLIC_SUPABASE_ANON_KEY',
+ type: 'encrypted',
+ },
+ NEXT_PUBLIC_SUPABASE_URL: {
+ key: 'NEXT_PUBLIC_SUPABASE_URL',
+ type: 'encrypted',
+ },
+} as const
+
+export const ENV_VAR_RAW_KEYS = Object.values(ENV_VAR_KEYS).map((x) => x.key)
diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsx
index 81e9ca7e6d2..8b8ac5f5758 100644
--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx
+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx
@@ -1,8 +1,11 @@
-import { databaseIcon, vercelIcon } from 'components/to-be-cleaned/ListIcons'
+import { ENV_VAR_RAW_KEYS } from 'components/interfaces/Integrations/Integrations-Vercel.constants'
+import { Markdown } from 'components/interfaces/Markdown'
+import { vercelIcon } from 'components/to-be-cleaned/ListIcons'
import { useIntegrationConnectionsCreateMutation } from 'data/integrations/integration-connections-create-mutation'
import { VercelProjectsResponse } from 'data/integrations/integrations-vercel-projects-query'
+import { BASE_PATH } from 'lib/constants'
import { useState } from 'react'
-import { Button, IconArrowRight, IconPlus, IconX, Listbox, Select } from 'ui'
+import { Button, IconArrowRight, IconPlus, IconX, Input, Listbox, Select, cn } from 'ui'
interface Project {
id: string
@@ -30,68 +33,26 @@ const ProjectLinker = ({
onCreateConnections: _onCreateConnections,
installedConnections,
}: ProjectLinkerProps) => {
- const [connections, setConnections] = useState(
- installedConnections && installedConnections.length > 0
- ? installedConnections?.map((connection) => {
- return {
- foreign_project_id: connection?.foreign_project_id,
- supabase_project_id: connection?.supabase_project_id,
- integrationId: INTEGRATION_INTERNAL_ID,
- metadata: UNDEFINED_METADATA_VALUE,
- }
- })
- : [
- {
- foreign_project_id: UNDEFINED_SELECT_VALUE,
- supabase_project_id: UNDEFINED_SELECT_VALUE,
- integrationId: INTEGRATION_INTERNAL_ID,
- metadata: UNDEFINED_METADATA_VALUE,
- },
- ]
- )
-
- console.log('installedConnections', installedConnections)
- console.log('connections', connections)
- console.log('foreignProjects', foreignProjects)
- console.log('supabaseProjects', supabaseProjects)
-
- function onSetForeignProjectId(idx: number, id: string) {
- const newConnections = [...connections]
- const projectDetails = foreignProjects.filter((x) => x.id === id)[0]
- newConnections[idx].metadata = { ...projectDetails }
- newConnections[idx].foreign_project_id = id
- newConnections[idx].supabaseConfig = {
- projectEnvVars: {
- write: true,
- },
- }
-
- setConnections(newConnections)
- }
-
- function onSetSupabaseProjectId(idx: number, id: string) {
- const newConnections = [...connections]
- newConnections[idx].supabase_project_id = id
- setConnections(newConnections)
- }
-
- function addConnection() {
- setConnections([
- ...connections,
- {
- foreign_project_id: UNDEFINED_SELECT_VALUE,
- supabase_project_id: UNDEFINED_SELECT_VALUE,
- integrationId: INTEGRATION_INTERNAL_ID,
- metadata: UNDEFINED_METADATA_VALUE,
- },
- ])
- }
-
- function removeConnection(idx: number) {
- const newConnections = [...connections]
- newConnections.splice(idx, 1)
- setConnections(newConnections)
- }
+ const [supabaseProjectId, setSupabaseProjectId] = useState('')
+ const [vercelProjectId, setVercelProjectId] = useState('')
+
+ // function addConnection() {
+ // setConnections([
+ // ...connections,
+ // {
+ // foreign_project_id: UNDEFINED_SELECT_VALUE,
+ // supabase_project_id: UNDEFINED_SELECT_VALUE,
+ // integrationId: INTEGRATION_INTERNAL_ID,
+ // metadata: UNDEFINED_METADATA_VALUE,
+ // },
+ // ])
+ // }
+
+ // function removeConnection(idx: number) {
+ // const newConnections = [...connections]
+ // newConnections.splice(idx, 1)
+ // setConnections(newConnections)
+ // }
const { mutate: createConnections, isLoading } = useIntegrationConnectionsCreateMutation({
onSuccess() {
@@ -100,114 +61,99 @@ const ProjectLinker = ({
})
function onCreateConnections() {
+ const projectDetails = foreignProjects.filter((x) => x.id === vercelProjectId)[0]
+
createConnections({
organizationIntegrationId,
- connections,
+ connections: [
+ {
+ foreign_project_id: vercelProjectId,
+ supabase_project_id: supabaseProjectId,
+ integrationId: INTEGRATION_INTERNAL_ID,
+ metadata: {
+ ...projectDetails,
+ supabaseConfig: {
+ projectEnvVars: {
+ write: true,
+ },
+ },
+ },
+ },
+ ],
})
}
- console.log(connections)
-
- return (
- <div className="flex flex-col gap-4">
- <ul>
- {connections.map((connection, i) => (
- <ProjectLinkerItem
- key={i}
- connections={connections}
- foreignProjects={foreignProjects}
- supabaseProjects={supabaseProjects}
- foreignProjectId={connection.foreign_project_id}
- setForeignProjectId={(id) => onSetForeignProjectId(i, id)}
- supabaseProjectId={connection.supabase_project_id}
- setSupabaseProjectId={(id) => onSetSupabaseProjectId(i, id)}
- removeConnection={() => removeConnection(i)}
- canRemove={connections.length > 1}
- />
- ))}
- </ul>
-
- <Button
- onClick={addConnection}
- type="default"
- icon={<IconPlus strokeWidth={2} />}
- className="self-start"
+ const Panel = ({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
+ return (
+ <div
+ className={cn('bg border rounded shadow px-6 py-5 flex flex-col gap-6 w-full', className)}
+ {...props}
>
- Add Connection
- </Button>
-
- <hr className="h-px bg-scale-500" role="separator" />
-
- <Button
- className="self-end"
- onClick={onCreateConnections}
- loading={isLoading}
- disabled={isLoading}
- >
- Continue
- </Button>
- </div>
- )
-}
-
-export default ProjectLinker
-
-interface ProjectLinkerItemProps {
- foreignProjects: Project[]
- supabaseProjects: Project[]
- foreignProjectId: string
- setForeignProjectId: (id: string) => void
- supabaseProjectId: string
- setSupabaseProjectId: (id: string) => void
- removeConnection: () => void
- canRemove: boolean
- connections: any[]
-}
+ {children}
+ </div>
+ )
+ }
-const ProjectLinkerItem = ({
- foreignProjects,
- supabaseProjects,
- foreignProjectId,
- setForeignProjectId,
- supabaseProjectId,
- setSupabaseProjectId,
- removeConnection,
- canRemove,
-}: ProjectLinkerItemProps) => {
- console.log(supabaseProjectId)
return (
- <li className="py-2">
- <div className="relative flex w-full space-x-2">
- <div className="w-1/2 flex-grow">
- <Select value={supabaseProjectId} onChange={(e) => setSupabaseProjectId(e.target.value)}>
- <Select.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>
- Choose a project
- </Select.Option>
-
+ <div className="flex flex-col gap-4">
+ <div className="flex items-center gap-0 w-full">
+ <Panel>
+ <div className="bg-white shadow border rounded p-1 w-8 h-8 flex justify-center items-center">
+ <img src={`${BASE_PATH}/img/supabase-logo.svg`} alt="Supabase" className="w-4" />
+ </div>
+ <Listbox
+ label="Supabase project"
+ value={supabaseProjectId ?? UNDEFINED_SELECT_VALUE}
+ onChange={(e) => setSupabaseProjectId(e)}
+ >
+ <Listbox.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>
+ Choose a Supabase project
+ </Listbox.Option>
{supabaseProjects.map((project) => (
- <Select.Option
+ <Listbox.Option
key={project.id}
value={project.id}
- // label={project.name}
- // addOnBefore={() => databaseIcon}
+ label={project.name}
+ addOnBefore={() => {
+ return (
+ <>
+ <div className="bg-white shadow border rounded p-1 w-6 h-6 flex justify-center items-center">
+ <img
+ src={`${BASE_PATH}/img/supabase-logo.svg`}
+ alt="Supabase"
+ className="w-4"
+ />
+ </div>
+ </>
+ )
+ }}
>
{project.name}
- </Select.Option>
+ </Listbox.Option>
))}
- </Select>
- </div>
- <div className="flex flex-shrink items-center">
- <IconArrowRight className="text-scale-1000" />
- </div>
- <div className="w-1/2 flex-grow">
+ </Listbox>
+ </Panel>
+ <div className="border h-px w-16 border-dashed"></div>
+ <Panel>
+ <div className="bg-black shadow rounded p-1 w-8 h-8 flex justify-center items-center">
+ {/* <img src="/img/icons/vercel.svg" style={{ height: 21 }} alt="integration icon" /> */}
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ fill="var(--colors-scale12)"
+ viewBox="0 0 512 512"
+ className="w-4"
+ >
+ <path fill-rule="evenodd" d="M256,48,496,464H16Z" />
+ </svg>
+ </div>
<Listbox
- value={foreignProjectId ?? UNDEFINED_SELECT_VALUE}
- onChange={setForeignProjectId}
+ label="Vercel project"
+ value={vercelProjectId ?? UNDEFINED_SELECT_VALUE}
+ onChange={(e) => setVercelProjectId(e)}
>
<Listbox.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>
- Choose a project
+ Choose a Vercel project
</Listbox.Option>
-
{foreignProjects.map((project) => (
<Listbox.Option
key={project.id}
@@ -234,12 +180,35 @@ const ProjectLinkerItem = ({
</Listbox.Option>
))}
</Listbox>
- </div>
-
- {canRemove && (
- <Button type="text" icon={<IconX strokeWidth={2} />} onClick={removeConnection} />
- )}
+ </Panel>
+ </div>
+ <div className="flex w-full justify-end">
+ <Button
+ size="medium"
+ className="self-end"
+ onClick={onCreateConnections}
+ loading={isLoading}
+ disabled={isLoading}
+ >
+ Connect project
+ </Button>
+ </div>
+ <div>
+ <p className="text-scale-900 text-sm mb-3">
+ The following enviroment variables will be added:
+ </p>
+ <p>
+ {ENV_VAR_RAW_KEYS.map((x, idx) => {
+ return (
+ <span key={idx} className="text-scale-1100 text-xs font-mono">
+ {x},{' '}
+ </span>
+ )
+ })}
+ </p>
</div>
- </li>
+ </div>
)
}
+
+export default ProjectLinker
diff --git a/studio/components/interfaces/Integrations/ProjectsLinker.tsx b/studio/components/interfaces/Integrations/ProjectsLinker.tsx
new file mode 100644
index 00000000000..81e9ca7e6d2
--- /dev/null
+++ b/studio/components/interfaces/Integrations/ProjectsLinker.tsx
@@ -0,0 +1,245 @@
+import { databaseIcon, vercelIcon } from 'components/to-be-cleaned/ListIcons'
+import { useIntegrationConnectionsCreateMutation } from 'data/integrations/integration-connections-create-mutation'
+import { VercelProjectsResponse } from 'data/integrations/integrations-vercel-projects-query'
+import { useState } from 'react'
+import { Button, IconArrowRight, IconPlus, IconX, Listbox, Select } from 'ui'
+
+interface Project {
+ id: string
+ name: string
+}
+
+// to do: move this somewhere
+const INTEGRATION_INTERNAL_ID = 1
+
+export interface ProjectLinkerProps {
+ organizationIntegrationId: string
+ foreignProjects: VercelProjectsResponse[]
+ supabaseProjects: Project[]
+ onCreateConnections?: () => void
+ installedConnections?: any[]
+}
+
+const UNDEFINED_SELECT_VALUE = 'undefined'
+const UNDEFINED_METADATA_VALUE = {}
+
+const ProjectLinker = ({
+ organizationIntegrationId,
+ foreignProjects,
+ supabaseProjects,
+ onCreateConnections: _onCreateConnections,
+ installedConnections,
+}: ProjectLinkerProps) => {
+ const [connections, setConnections] = useState(
+ installedConnections && installedConnections.length > 0
+ ? installedConnections?.map((connection) => {
+ return {
+ foreign_project_id: connection?.foreign_project_id,
+ supabase_project_id: connection?.supabase_project_id,
+ integrationId: INTEGRATION_INTERNAL_ID,
+ metadata: UNDEFINED_METADATA_VALUE,
+ }
+ })
+ : [
+ {
+ foreign_project_id: UNDEFINED_SELECT_VALUE,
+ supabase_project_id: UNDEFINED_SELECT_VALUE,
+ integrationId: INTEGRATION_INTERNAL_ID,
+ metadata: UNDEFINED_METADATA_VALUE,
+ },
+ ]
+ )
+
+ console.log('installedConnections', installedConnections)
+ console.log('connections', connections)
+ console.log('foreignProjects', foreignProjects)
+ console.log('supabaseProjects', supabaseProjects)
+
+ function onSetForeignProjectId(idx: number, id: string) {
+ const newConnections = [...connections]
+ const projectDetails = foreignProjects.filter((x) => x.id === id)[0]
+ newConnections[idx].metadata = { ...projectDetails }
+ newConnections[idx].foreign_project_id = id
+ newConnections[idx].supabaseConfig = {
+ projectEnvVars: {
+ write: true,
+ },
+ }
+
+ setConnections(newConnections)
+ }
+
+ function onSetSupabaseProjectId(idx: number, id: string) {
+ const newConnections = [...connections]
+ newConnections[idx].supabase_project_id = id
+ setConnections(newConnections)
+ }
+
+ function addConnection() {
+ setConnections([
+ ...connections,
+ {
+ foreign_project_id: UNDEFINED_SELECT_VALUE,
+ supabase_project_id: UNDEFINED_SELECT_VALUE,
+ integrationId: INTEGRATION_INTERNAL_ID,
+ metadata: UNDEFINED_METADATA_VALUE,
+ },
+ ])
+ }
+
+ function removeConnection(idx: number) {
+ const newConnections = [...connections]
+ newConnections.splice(idx, 1)
+ setConnections(newConnections)
+ }
+
+ const { mutate: createConnections, isLoading } = useIntegrationConnectionsCreateMutation({
+ onSuccess() {
+ _onCreateConnections?.()
+ },
+ })
+
+ function onCreateConnections() {
+ createConnections({
+ organizationIntegrationId,
+ connections,
+ })
+ }
+
+ console.log(connections)
+
+ return (
+ <div className="flex flex-col gap-4">
+ <ul>
+ {connections.map((connection, i) => (
+ <ProjectLinkerItem
+ key={i}
+ connections={connections}
+ foreignProjects={foreignProjects}
+ supabaseProjects={supabaseProjects}
+ foreignProjectId={connection.foreign_project_id}
+ setForeignProjectId={(id) => onSetForeignProjectId(i, id)}
+ supabaseProjectId={connection.supabase_project_id}
+ setSupabaseProjectId={(id) => onSetSupabaseProjectId(i, id)}
+ removeConnection={() => removeConnection(i)}
+ canRemove={connections.length > 1}
+ />
+ ))}
+ </ul>
+
+ <Button
+ onClick={addConnection}
+ type="default"
+ icon={<IconPlus strokeWidth={2} />}
+ className="self-start"
+ >
+ Add Connection
+ </Button>
+
+ <hr className="h-px bg-scale-500" role="separator" />
+
+ <Button
+ className="self-end"
+ onClick={onCreateConnections}
+ loading={isLoading}
+ disabled={isLoading}
+ >
+ Continue
+ </Button>
+ </div>
+ )
+}
+
+export default ProjectLinker
+
+interface ProjectLinkerItemProps {
+ foreignProjects: Project[]
+ supabaseProjects: Project[]
+ foreignProjectId: string
+ setForeignProjectId: (id: string) => void
+ supabaseProjectId: string
+ setSupabaseProjectId: (id: string) => void
+ removeConnection: () => void
+ canRemove: boolean
+ connections: any[]
+}
+
+const ProjectLinkerItem = ({
+ foreignProjects,
+ supabaseProjects,
+ foreignProjectId,
+ setForeignProjectId,
+ supabaseProjectId,
+ setSupabaseProjectId,
+ removeConnection,
+ canRemove,
+}: ProjectLinkerItemProps) => {
+ console.log(supabaseProjectId)
+ return (
+ <li className="py-2">
+ <div className="relative flex w-full space-x-2">
+ <div className="w-1/2 flex-grow">
+ <Select value={supabaseProjectId} onChange={(e) => setSupabaseProjectId(e.target.value)}>
+ <Select.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>
+ Choose a project
+ </Select.Option>
+
+ {supabaseProjects.map((project) => (
+ <Select.Option
+ key={project.id}
+ value={project.id}
+ // label={project.name}
+ // addOnBefore={() => databaseIcon}
+ >
+ {project.name}
+ </Select.Option>
+ ))}
+ </Select>
+ </div>
+ <div className="flex flex-shrink items-center">
+ <IconArrowRight className="text-scale-1000" />
+ </div>
+ <div className="w-1/2 flex-grow">
+ <Listbox
+ value={foreignProjectId ?? UNDEFINED_SELECT_VALUE}
+ onChange={setForeignProjectId}
+ >
+ <Listbox.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>
+ Choose a project
+ </Listbox.Option>
+
+ {foreignProjects.map((project) => (
+ <Listbox.Option
+ key={project.id}
+ value={project.id}
+ label={project.name}
+ addOnBefore={() => {
+ return (
+ <>
+ {!project?.framework ? (
+ vercelIcon
+ ) : (
+ <img
+ src={`/img/icons/frameworks/${project.framework}.svg`}
+ width={21}
+ height={21}
+ alt={`icon`}
+ />
+ )}
+ </>
+ )
+ }}
+ >
+ {project.name}
+ </Listbox.Option>
+ ))}
+ </Listbox>
+ </div>
+
+ {canRemove && (
+ <Button type="text" icon={<IconX strokeWidth={2} />} onClick={removeConnection} />
+ )}
+ </div>
+ </li>
+ )
+}
diff --git a/studio/components/interfaces/Markdown.tsx b/studio/components/interfaces/Markdown.tsx
index db85f97f4f3..1755f86c843 100644
--- a/studio/components/interfaces/Markdown.tsx
+++ b/studio/components/interfaces/Markdown.tsx
@@ -1,6 +1,6 @@
import { ReactMarkdownProps } from 'react-markdown/lib/complex-types'
import { ReactMarkdown } from 'react-markdown/lib/react-markdown'
-import { cn } from 'ui/src/utils/cn'
+import { cn } from 'ui'
interface Props extends Omit<ReactMarkdownProps, 'children' | 'node'> {
className?: string
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 240cce5449c..e535d1f0577 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -20,9 +20,11 @@ const IntegrationSettings = () => {
vercelIntegrations?.map((x) => {
let data: any = { ...x }
- data['metadata']['account'][
- 'avatar'
- ] = `https://vercel.com/api/www/avatar/${data.metadata.account.avatar}?w=48`
+
+ const avatarSrc = data.metadata.account.avatar
+ ? `https://vercel.com/api/www/avatar/${data.metadata.account.avatar}?s=48`
+ : `https://vercel.com/api/www/avatar?teamId=${data.metadata.account.team_id}&s=48`
+ data['metadata']['account']['avatar'] = avatarSrc
return data
})
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
index f5c459773b5..be862353f74 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
@@ -1,5 +1,5 @@
import { useParams } from 'common'
-import ProjectLinker from 'components/interfaces/Integrations/ProjectLinker'
+import ProjectLinker from 'components/interfaces/Integrations/ProjectsLinker'
import { Markdown } from 'components/interfaces/Markdown'
import { useIntegrationsQuery } from 'data/integrations/integrations-query'
import { useStore } from 'hooks'
diff --git a/studio/components/layouts/IntegrationWindowLayout.tsx b/studio/components/layouts/IntegrationWindowLayout.tsx
new file mode 100644
index 00000000000..98adc94be52
--- /dev/null
+++ b/studio/components/layouts/IntegrationWindowLayout.tsx
@@ -0,0 +1,72 @@
+import { FC } from 'react'
+import Link from 'next/link'
+import { IconChevronRight, IconX, cn } from 'ui'
+import { withAuth, useFlag } from 'hooks'
+import { observer } from 'mobx-react-lite'
+import { BASE_PATH } from 'lib/constants'
+import React from 'react'
+import { ScaffoldContainer } from './Scaffold'
+
+const IntegrationWindowLayout: FC<any> = ({ organization, project, children }) => {
+ const ongoingIncident = useFlag('ongoingIncident')
+ const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
+
+ return (
+ <div className="flex w-full flex-col" style={{ height: maxHeight, maxHeight }}>
+ <Header organization={organization} project={project} />
+ {children}
+ </div>
+ )
+}
+
+const INTEGRATION_LAYOUT_MAX_WIDTH = '' // 'max-w-[720px]'
+
+export default withAuth(observer(IntegrationWindowLayout))
+
+export const IntegrationWindowLayoutWithoutAuth = observer(IntegrationWindowLayout)
+
+const Header: FC<any> = ({ organization, project }) => {
+ let stepNumber = organization ? 1 : project ? 2 : 0
+ return (
+ <div className="bg">
+ <ScaffoldContainer className={cn('py-3', INTEGRATION_LAYOUT_MAX_WIDTH)}>
+ <div className="flex items-center gap-6 w-full">
+ <div className="flex gap-2 items-center">
+ <div className="bg-white shadow border rounded p-1 w-8 h-8 flex justify-center items-center">
+ <img src={`${BASE_PATH}/img/supabase-logo.svg`} alt="Supabase" className="w-4" />
+ </div>
+ <IconX className="text-scale-800" strokeWidth={2} size={16} />
+ <div className="bg-black shadow rounded p-1 w-8 h-8 flex justify-center items-center">
+ {/* <img src="/img/icons/vercel.svg" style={{ height: 21 }} alt="integration icon" /> */}
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ fill="var(--colors-scale12)"
+ viewBox="0 0 512 512"
+ className="w-4"
+ >
+ <path fill-rule="evenodd" d="M256,48,496,464H16Z" />
+ </svg>
+ </div>
+ </div>
+ <span className="text-sm" title="Supabase + Vercel Integration Marketplace Connector">
+ Supabase + Vercel Integration Marketplace Connector
+ </span>
+ </div>
+ </ScaffoldContainer>
+ </div>
+ )
+}
+
+const maxWidthClasses = 'mx-auto w-full max-w-[1600px]'
+const paddingClasses = 'px-6 lg:px-14 xl:px-28 2xl:px-32'
+
+const IntegrationScaffoldContainer = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => {
+ return <div ref={ref} {...props} className={cn(maxWidthClasses, paddingClasses, className)} />
+})
+
+IntegrationScaffoldContainer.displayName = 'IntegrationScaffoldContainer'
+
+export { IntegrationScaffoldContainer }
diff --git a/studio/components/layouts/Scaffold.tsx b/studio/components/layouts/Scaffold.tsx
index b3adc0714f7..c0367141f76 100644
--- a/studio/components/layouts/Scaffold.tsx
+++ b/studio/components/layouts/Scaffold.tsx
@@ -1,5 +1,5 @@
import React from 'react'
-import { cn } from 'ui/src/utils/cn'
+import { cn } from 'ui'
const maxWidthClasses = 'mx-auto w-full max-w-[1600px]'
const paddingClasses = 'px-6 lg:px-14 xl:px-28 2xl:px-32'
diff --git a/studio/pages/integrations/vercel.tsx b/studio/pages/integrations/vercel.tsx
index 049ad06a48e..2133b293df6 100644
--- a/studio/pages/integrations/vercel.tsx
+++ b/studio/pages/integrations/vercel.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'
import { useParams } from 'common'
import ProjectLinker from 'components/interfaces/Integrations/ProjectLinker'
-import { WizardLayout } from 'components/layouts'
+
import OrganizationPicker from 'components/ui/OrganizationPicker'
import { useVercelIntegrationCreateMutation } from 'data/integrations/vercel-integration-create-mutation'
import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
@@ -10,7 +10,12 @@ import { useProjectsQuery } from 'data/projects/projects-query'
import { useStore } from 'hooks'
import { EMPTY_ARR } from 'lib/void'
import { NextPageWithLayout, Organization } from 'types'
-import { Button } from 'ui'
+import { Alert, Button, IconBook, IconLifeBuoy, Input, LoadingLine, cn } from 'ui'
+import IntegrationWindowLayout from 'components/layouts/IntegrationWindowLayout'
+import { ScaffoldContainer, ScaffoldDivider, ScaffoldSection } from 'components/layouts/Scaffold'
+import { Markdown } from 'components/interfaces/Markdown'
+import { BASE_PATH } from 'lib/constants'
+import { ENV_VAR_RAW_KEYS } from 'components/interfaces/Integrations/Integrations-Vercel.constants'
const VercelIntegration: NextPageWithLayout = () => {
const { ui } = useStore()
@@ -81,35 +86,95 @@ const VercelIntegration: NextPageWithLayout = () => {
const vercelProjects = useMemo(() => vercelProjectsData ?? EMPTY_ARR, [vercelProjectsData])
return (
- <div className="flex flex-col gap-4">
- <h1>Vercel Integration</h1>
-
- {organizationIntegrationId === null ? (
- <>
- <OrganizationPicker onSelectedOrgChange={setSelectedOrg} />
-
- <Button className="self-end" disabled={isLoading} loading={isLoading} onClick={onInstall}>
- Install
- </Button>
- </>
- ) : (
- <>
- <ProjectLinker
- organizationIntegrationId={organizationIntegrationId}
- foreignProjects={vercelProjects}
- supabaseProjects={supabaseProjects}
- onCreateConnections={() => {
- if (next) {
- window.location.href = next
- }
- }}
- />
- </>
- )}
- </div>
+ <>
+ <main className="overflow-auto flex flex-col h-full">
+ <LoadingLine loading={isLoading} />
+ {organizationIntegrationId === null && (
+ <>
+ <ScaffoldContainer className="max-w-md flex flex-col gap-6 grow py-8">
+ <h1 className="text-xl text-scale-1200">Install Integration</h1>
+ <>
+ <Markdown content={`Choose the Supabase Organization you wish to install to`} />
+ <OrganizationPicker onSelectedOrgChange={setSelectedOrg} />
+ <div className="flex flex-row w-full justify-end">
+ <Button
+ size="medium"
+ className="self-end"
+ disabled={isLoading}
+ loading={isLoading}
+ onClick={onInstall}
+ >
+ Install integration
+ </Button>
+ </div>
+ </>
+ </ScaffoldContainer>
+ <ScaffoldContainer className="flex flex-col gap-6 py-3">
+ <Alert
+ withIcon
+ variant="info"
+ title="You can uninstall this Integration at any time."
+ >
+ <Markdown
+ content={`You can remove this integration at any time either via Vercel or the Supabase dashboard.`}
+ />
+ </Alert>
+ </ScaffoldContainer>
+ </>
+ )}
+
+ {organizationIntegrationId !== null && (
+ <>
+ <ScaffoldContainer className="flex flex-col gap-6 grow py-8">
+ <header>
+ <h1 className="text-xl text-scale-1200">
+ Link a Supabase project to a Vercel project
+ </h1>
+ <Markdown
+ className="text-scale-900"
+ content={`
+This Supabase integration manages your envioemnt variables automatically to provide the latest keys in the unlikely event that you will need to refresh your JWT token.
+`}
+ />
+ </header>
+ {/* <ProjectLinker
+ organizationIntegrationId={organizationIntegrationId}
+ foreignProjects={vercelProjects}
+ supabaseProjects={supabaseProjects}
+ onCreateConnections={() => {
+ if (next) {
+ window.location.href = next
+ }
+ }}
+ /> */}
+
+ <ProjectLinker
+ organizationIntegrationId={organizationIntegrationId}
+ foreignProjects={vercelProjects}
+ supabaseProjects={supabaseProjects}
+ onCreateConnections={() => {
+ if (next) {
+ window.location.href = next
+ }
+ }}
+ />
+ </ScaffoldContainer>
+ </>
+ )}
+ <ScaffoldDivider />
+ </main>
+ <ScaffoldContainer className="bg-body flex flex-row gap-6 py-6 border-t">
+ <div className="flex items-center gap-2 text-xs text-scale-900">
+ <IconBook size={16} /> Docs
+ </div>
+ <div className="flex items-center gap-2 text-xs text-scale-900">
+ <IconLifeBuoy size={16} /> Support
+ </div>
+ </ScaffoldContainer>
+ </>
)
}
-VercelIntegration.getLayout = (page) => <WizardLayout>{page}</WizardLayout>
+VercelIntegration.getLayout = (page) => <IntegrationWindowLayout>{page}</IntegrationWindowLayout>
export default VercelIntegration