The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Refactor org invoices page
Joshen Lim90599f3e9d9b
diff --git a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsxindex 4bf0b1ede75..a7b6931b604 100644--- a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx+++ b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx@@ -1,4 +1,4 @@-import { FC, useState, useEffect } from 'react'+import { useState, useEffect } from 'react'import { Button, Loading, IconFileText, IconDownload, IconChevronLeft, IconChevronRight } from 'ui'import { PermissionAction } from '@supabase/shared-types/out/constants'@@ -10,15 +10,9 @@ import NoPermission from 'components/ui/NoPermission'const PAGE_LIMIT = 10-/**- * Eventually deprecate this - as we move on to show invoices by project on the organization billing page- */+// Refactor: Split invoices by projects so it's easier for users to identify-interface Props {- organization: any-}--const InvoicesSettings: FC<Props> = ({ organization }) => {+const InvoicesSettings = () => {const { ui } = useStore()const [loading, setLoading] = useState<any>(false)@@ -26,7 +20,7 @@ const InvoicesSettings: FC<Props> = ({ organization }) => {const [count, setCount] = useState(0)const [invoices, setInvoices] = useState<any>([])- const { stripe_customer_id } = organization+ const { stripe_customer_id } = ui.selectedOrganization ?? {}const offset = (page - 1) * PAGE_LIMITconst canReadInvoices = checkPermissions(PermissionAction.READ, 'invoices')diff --git a/studio/pages/org/[slug]/invoices.tsx b/studio/pages/org/[slug]/invoices.tsxindex d0d6cc21b11..3615a7e0f43 100644--- a/studio/pages/org/[slug]/invoices.tsx+++ b/studio/pages/org/[slug]/invoices.tsx@@ -6,7 +6,7 @@ import { Tabs } from 'ui'import { useParams, useStore } from 'hooks'import Loading from 'components/ui/Loading'import { AccountLayout } from 'components/layouts'-import { GeneralSettings } from 'components/interfaces/Organization'+import { InvoicesSettings } from 'components/interfaces/Organization'const OrgInvoices: NextPage = () => {const { ui } = useStore()@@ -23,7 +23,7 @@ const OrgInvoices: NextPage = () => {},]}>- {ui.selectedOrganization === undefined ? (+ {ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (<Loading />) : (<div className="p-4 pt-0">@@ -51,7 +51,7 @@ const OrgInvoices: NextPage = () => {</div><div className="mb-8">- <GeneralSettings />+ <InvoicesSettings /></div></div>)}diff --git a/studio/pages/org/[slug]/settings.tsx b/studio/pages/org/[slug]/settings.tsxindex 0cd174fd337..27b62ec1dcb 100644--- a/studio/pages/org/[slug]/settings.tsx+++ b/studio/pages/org/[slug]/settings.tsx@@ -177,7 +177,7 @@ const OrganizationSettings: NextPageWithLayout = () => {) : selectedTab == 'BILLING' ? (<div />) : selectedTab == 'INVOICES' ? (- <InvoicesSettings organization={organization} />+ <div />) : null}</div></div>