The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: deduplicate out supabase client
Alaister Young45d6867ef72a
diff --git a/www/lib/supabase.ts b/www/lib/supabase.tsnew file mode 100644index 00000000000..304c3890488--- /dev/null+++ b/www/lib/supabase.ts@@ -0,0 +1,9 @@+import { createClient } from '@supabase/supabase-js'++const SUPABASE_URL = 'https://obuldanrptloktxcffvn.supabase.co'+const SUPABASE_ANON_KEY =+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzNzY1NjAxNSwiZXhwIjoxOTUzMjMyMDE1fQ.0sfp_Njf7l4g-nOCF5a1TQE11rPqtz8Y10uctIetkBA'++const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)++export default supabasediff --git a/www/pages/partners/[slug].tsx b/www/pages/partners/[slug].tsxindex bbf2ee30b4a..aed590557d2 100644--- a/www/pages/partners/[slug].tsx+++ b/www/pages/partners/[slug].tsx@@ -1,21 +1,16 @@-import { createClient } from '@supabase/supabase-js'import { IconChevronLeft, IconExternalLink } from '@supabase/ui'import { marked } from 'marked'import { GetStaticPaths, GetStaticProps } from 'next'import { NextSeo } from 'next-seo'+import Image from 'next/image'import Link from 'next/link'import { Swiper, SwiperSlide } from 'swiper/react'import 'swiper/swiper.min.css'import DefaultLayout from '~/components/Layouts/Default'import SectionContainer from '~/components/Layouts/SectionContainer'+import supabase from '~/lib/supabase'import { Partner } from '~/types/partners'import Error404 from '../404'-import Image from 'next/image'--const supabase = createClient(- 'https://obuldanrptloktxcffvn.supabase.co',- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzNzY1NjAxNSwiZXhwIjoxOTUzMjMyMDE1fQ.0sfp_Njf7l4g-nOCF5a1TQE11rPqtz8Y10uctIetkBA'-)function Partner({ partner }: { partner: Partner }) {if (!partner) return <Error404 />@@ -93,7 +88,7 @@ function Partner({ partner }: { partner: Partner }) {{partner.images.map((image: any, i: number) => {return (<SwiperSlide key={i}>- <div className="relative block ml-3 mr-3 cursor-move overflow-hidden rounded-md">+ <div className="relative block ml-3 mr-3 overflow-hidden rounded-md cursor-move"><Imagelayout="responsive"objectFit="contain"@@ -109,7 +104,7 @@ function Partner({ partner }: { partner: Partner }) {</Swiper></div>- <div className="grid gap-3 lg:grid-cols-4 space-y-16 lg:space-y-0">+ <div className="grid gap-3 space-y-16 lg:grid-cols-4 lg:space-y-0"><div className="lg:col-span-3"><h2className="text-scale-1200"diff --git a/www/pages/partners/experts/index.tsx b/www/pages/partners/experts/index.tsxindex 3d5e9543507..1643998f400 100644--- a/www/pages/partners/experts/index.tsx+++ b/www/pages/partners/experts/index.tsx@@ -1,20 +1,13 @@-import { createClient } from '@supabase/supabase-js'-import { IconArrowRight, IconSearch, Input, Select } from '@supabase/ui'import { NextSeo } from 'next-seo'-import Link from 'next/link'import { useRouter } from 'next/router'import DefaultLayout from '~/components/Layouts/Default'import SectionContainer from '~/components/Layouts/SectionContainer'import BecomeAPartner from '~/components/Partners/BecomeAPartners'import PartnerLinkBox from '~/components/Partners/PartnerLinkBox'+import supabase from '~/lib/supabase'import { Partner } from '~/types/partners'import TileGrid from '../../../components/Partners/TileGrid'-const supabase = createClient(- 'https://obuldanrptloktxcffvn.supabase.co',- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzNzY1NjAxNSwiZXhwIjoxOTUzMjMyMDE1fQ.0sfp_Njf7l4g-nOCF5a1TQE11rPqtz8Y10uctIetkBA'-)-export async function getStaticProps() {const { data: partners } = await supabase.from<Partner>('partners')@@ -75,7 +68,7 @@ function ExpertPartnersPage(props: Props) {<div className="space-y-6">{/* Search Bar */}<div className="space-y-4">- <div className="text-sm text-scale-900 mb-2">Explore more</div>+ <div className="mb-2 text-sm text-scale-900">Explore more</div><PartnerLinkBoxtitle="Integrations"color="blue"@@ -84,7 +77,7 @@ function ExpertPartnersPage(props: Props) {icon={<svgxmlns="http://www.w3.org/2000/svg"- className="h-6 w-6"+ className="w-6 h-6"fill="none"viewBox="0 0 24 24"stroke="currentColor"@@ -106,7 +99,7 @@ function ExpertPartnersPage(props: Props) {icon={<svgxmlns="http://www.w3.org/2000/svg"- className="h-5 w-5"+ className="w-5 h-5"fill="none"viewBox="0 0 24 24"stroke="currentColor"diff --git a/www/pages/partners/integrations/index.tsx b/www/pages/partners/integrations/index.tsxindex c48ba0027e7..0b9517396f3 100644--- a/www/pages/partners/integrations/index.tsx+++ b/www/pages/partners/integrations/index.tsx@@ -1,7 +1,5 @@-import { createClient } from '@supabase/supabase-js'-import { IconArrowRight, IconLoader, IconSearch, Input, Select } from '@supabase/ui'+import { IconLoader, IconSearch, Input } from '@supabase/ui'import { NextSeo } from 'next-seo'-import Link from 'next/link'import { useRouter } from 'next/router'import React, { useEffect, useState } from 'react'import { useDebounce } from 'use-debounce'@@ -9,14 +7,10 @@ import DefaultLayout from '~/components/Layouts/Default'import SectionContainer from '~/components/Layouts/SectionContainer'import BecomeAPartner from '~/components/Partners/BecomeAPartners'import PartnerLinkBox from '~/components/Partners/PartnerLinkBox'+import supabase from '~/lib/supabase'import { Partner } from '~/types/partners'import TileGrid from '../../../components/Partners/TileGrid'-const supabase = createClient(- 'https://obuldanrptloktxcffvn.supabase.co',- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzNzY1NjAxNSwiZXhwIjoxOTUzMjMyMDE1fQ.0sfp_Njf7l4g-nOCF5a1TQE11rPqtz8Y10uctIetkBA'-)-export async function getStaticProps() {const { data: partners } = await supabase.from<Partner>('partners')@@ -121,7 +115,7 @@ function IntegrationPartnersPage(props: Props) {<h2 className="text-xl text-scale-900">{meta_description}</h2></div>{/* Title */}- <div className="grid lg:grid-cols-12 space-y-12 lg:space-y-0 md:gap-8 lg:gap-16 xl:gap-16">+ <div className="grid space-y-12 lg:grid-cols-12 lg:space-y-0 md:gap-8 lg:gap-16 xl:gap-16"><div className="lg:col-span-4 xl:col-span-3">{/* Horizontal link menu */}<div className="space-y-6">@@ -144,7 +138,7 @@ function IntegrationPartnersPage(props: Props) {}/><div className="hidden lg:block">- <div className="text-sm text-scale-900 mb-2">Categories</div>+ <div className="mb-2 text-sm text-scale-900">Categories</div><div className="space-y-1">{allCategories.map((category) => (<button@@ -158,7 +152,7 @@ function IntegrationPartnersPage(props: Props) {</div></div><div className="space-y-4">- <div className="text-sm text-scale-900 mb-2">Explore more</div>+ <div className="mb-2 text-sm text-scale-900">Explore more</div><div className="grid grid-cols-2 gap-8 lg:grid-cols-1"><PartnerLinkBoxtitle="Experts"@@ -168,7 +162,7 @@ function IntegrationPartnersPage(props: Props) {icon={<svgxmlns="http://www.w3.org/2000/svg"- className="h-6 w-6"+ className="w-6 h-6"fill="none"viewBox="0 0 24 24"stroke="currentColor"@@ -191,7 +185,7 @@ function IntegrationPartnersPage(props: Props) {icon={<svgxmlns="http://www.w3.org/2000/svg"- className="h-5 w-5"+ className="w-5 h-5"fill="none"viewBox="0 0 24 24"stroke="currentColor"