The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
adds IntegrationSettings interface
Alaister Young2635932f8f78
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx b/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsxnew file mode 100644index 00000000000..0e746edd52e--- /dev/null+++ b/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx@@ -0,0 +1,117 @@+import dayjs from 'dayjs'+import { pluralize } from 'lib/helpers'+import { EMPTY_ARR } from 'lib/void'+import { Button, IconArrowRight } from 'ui'++export interface OrganizationConnection {+ id: string+ orgName: string+ addedByUser: string+}++export interface ProjectConnection {+ id: string+ createdAt: string+ /** External resource name */+ fromProjectName: string+ /** Supabase project name */+ toProjectName: string+}++export interface IntegrationProps {+ title: string+ description?: string+ note?: string+ organizationConnections?: OrganizationConnection[]+ projectConnections?: ProjectConnection[]+}++const Integration = ({+ title,+ description,+ note,+ organizationConnections = EMPTY_ARR,+ projectConnections = EMPTY_ARR,+}: IntegrationProps) => {+ return (+ <>+ <div>+ <h2 className="text-2xl text-scale-1200">{title}</h2>+ </div>++ <div className="flex flex-col gap-8">+ {description !== undefined && (+ <div className="flex flex-col gap-1">+ <h3>How does the {title} integration work?</h3>+ <p className="text-scale-900 text-sm">{description}</p>+ </div>+ )}++ {organizationConnections.length > 0 && (+ <ul className="flex flex-col gap-2">+ {organizationConnections.map((connection) => (+ <li+ key={connection.id}+ className="flex justify-between items-center px-6 py-4 rounded-lg border border-scale-500 bg-panel-body-light dark:bg-panel-body-dark"+ >+ <div className="flex flex-col gap-1">+ <span className="text-scale-1100 font-medium">+ {title} integration connection | {connection.orgName}+ </span>+ <span className="text-scale-900 text-sm">Added by {connection.addedByUser}</span>+ </div>++ <div>+ <Button type="outline">Manage</Button>+ </div>+ </li>+ ))}+ </ul>+ )}++ <hr className="h-px bg-scale-500" role="separator" />++ {projectConnections.length > 0 && (+ <div className="flex flex-col gap-4">+ <h4>+ {projectConnections.length} project{' '}+ {pluralize(projectConnections.length, 'connection')}+ </h4>++ <ul className="flex flex-col gap-2">+ {projectConnections.map((connection) => (+ <li+ key={connection.id}+ className="flex justify-between items-center px-6 py-4 rounded-lg border border-scale-500 bg-panel-body-light dark:bg-panel-body-dark"+ >+ <div className="flex flex-col gap-1">+ <div className="flex gap-2">+ <span>{connection.fromProjectName}</span>+ <IconArrowRight />+ <span>{connection.toProjectName}</span>+ </div>++ <span className="text-scale-900 text-sm">+ Connected {dayjs(connection.createdAt).fromNow()}+ </span>+ </div>++ <div>+ <Button type="outline">Disconnect</Button>+ </div>+ </li>+ ))}+ </ul>++ <Button type="outline" className="self-start">+ Add new project connection+ </Button>+ {note !== undefined && <p className="text-scale-900 text-sm">{note}</p>}+ </div>+ )}+ </div>+ </>+ )+}++export default Integrationdiff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsxnew file mode 100644index 00000000000..e4564cf6a7e--- /dev/null+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx@@ -0,0 +1,30 @@+import Integration from './Integration'++const IntegrationSettings = () => {+ return (+ <div className="grid grid-cols-2 gap-y-8 mt-8">+ <Integration+ title="Vercel"+ description="Supabase will keep the right environment variables up to date in each of the projects you assign to a Supabase project. You can also link multiple Vercel Projects to the same Supabase project."+ note="Your Vercel connection has access to 7 Vercel Projects. You can change the scope of the access for Supabase by configuring here."+ organizationConnections={[+ {+ id: '1',+ orgName: "Alaister's Org",+ addedByUser: 'Alaister',+ },+ ]}+ projectConnections={[+ {+ id: '1',+ createdAt: '2021-08-12T00:00:00.000Z',+ fromProjectName: 'supabase-vercel',+ toProjectName: 'alaister',+ },+ ]}+ />+ </div>+ )+}++export default IntegrationSettingsdiff --git a/studio/components/interfaces/Organization/index.ts b/studio/components/interfaces/Organization/index.tsindex 08d77572274..48df8a473a6 100644--- a/studio/components/interfaces/Organization/index.ts+++ b/studio/components/interfaces/Organization/index.ts@@ -2,5 +2,6 @@ import GeneralSettings from './GeneralSettings/GeneralSettings'import TeamSettings from './TeamSettings/TeamSettings'import BillingSettings from './BillingSettings/BillingSettings'import InvoicesSettings from './InvoicesSettings/InvoicesSettings'+import IntegrationSettings from './IntegrationSettings/IntegrationSettings'-export { GeneralSettings, TeamSettings, BillingSettings, InvoicesSettings }+export { GeneralSettings, TeamSettings, BillingSettings, InvoicesSettings, IntegrationSettings }diff --git a/studio/components/layouts/OrganizationLayout.tsx b/studio/components/layouts/OrganizationLayout.tsxindex 0dadc3f8ae0..7eac56171f3 100644--- a/studio/components/layouts/OrganizationLayout.tsx+++ b/studio/components/layouts/OrganizationLayout.tsx@@ -17,11 +17,12 @@ const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {title={ui.selectedOrganization?.name ?? 'Supabase'}breadcrumbs={[{ key: `org-settings`, label: 'Settings' }]}>- <div className="p-4 pt-0">+ <div className="mx-auto flex flex-col px-5 pt-6 pb-14 lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32"><div className="space-y-3"><section className="mt-4"><h1 className="text-3xl">{ui.selectedOrganization?.name ?? 'Organization'} settings</h1></section>+<nav><Tabssize="small"diff --git a/studio/lib/helpers.ts b/studio/lib/helpers.tsindex 66d97b5b366..e83b178ff72 100644--- a/studio/lib/helpers.ts+++ b/studio/lib/helpers.ts@@ -248,3 +248,10 @@ export const detectOS = () => {return undefined}}++/**+ * Pluralize a word based on a count+ */+export function pluralize(count: number, singular: string, plural?: string) {+ return count === 1 ? singular : plural || singular + 's'+}diff --git a/studio/lib/void.ts b/studio/lib/void.tsnew file mode 100644index 00000000000..edd1d1fe647--- /dev/null+++ b/studio/lib/void.ts@@ -0,0 +1,7 @@+// Because {} !== {} in JS, we need a shared object instances for comparison++export const EMPTY_OBJ = {}++export const EMPTY_ARR = []++export function noop() {}diff --git a/studio/pages/org/[slug]/integrations.tsx b/studio/pages/org/[slug]/integrations.tsxindex 6a9c54bedfc..0e54ef2778c 100644--- a/studio/pages/org/[slug]/integrations.tsx+++ b/studio/pages/org/[slug]/integrations.tsx@@ -1,12 +1,9 @@import { NextPageWithLayout } from 'types'import { OrganizationLayout } from 'components/layouts'-// import { IntegrationSettings } from 'components/interfaces/Organization'+import { IntegrationSettings } from 'components/interfaces/Organization'const OrgIntegrationSettings: NextPageWithLayout = () => {- return (- <div>howdy</div>- // <IntegrationSettings />- )+ return <IntegrationSettings />}OrgIntegrationSettings.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>