The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add overages banner to billing and usage page, and refactor a couple of components
Joshen Lim454721cc10fa
diff --git a/studio/components/interfaces/Home/OveragesBanner.tsx b/studio/components/interfaces/Home/OveragesBanner.tsxdeleted file mode 100644index 6eaf13113ef..00000000000--- a/studio/components/interfaces/Home/OveragesBanner.tsx+++ /dev/null@@ -1,83 +0,0 @@-import Link from 'next/link'-import { FC } from 'react'-import { Alert } from '@supabase/ui'--import { useStore } from 'hooks'-import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'--interface Props {- tier: string- usageStatus: any-}--const OveragesBanner: FC<Props> = ({ tier, usageStatus }) => {- const { ui } = useStore()- const ref = ui.selectedProject?.ref-- // [Joshen TODO] After API is ready, to do up proper logic here- // Left off here - to do the banner on the billing page etc as well- const isApproachingUsageLimits = false- const isOverUsageLimits = false-- if (tier === PRICING_TIER_PRODUCT_IDS.ENTERPRISE) return <></>-- const tierName =- tier === PRICING_TIER_PRODUCT_IDS.FREE- ? 'free'- : tier === PRICING_TIER_PRODUCT_IDS.PRO- ? 'pro'- : tier === PRICING_TIER_PRODUCT_IDS.PAYG- ? 'pro'- : ''-- // [Joshen TODO] Rors mentioned to keep the language here positive if possible- const description =- tier === PRICING_TIER_PRODUCT_IDS.FREE ? (- <>- You can check your project's usage details or upgrade to the pro tier{' '}- <Link href={`/project/${ref}/settings/billing`}>- <a>- <span className="cursor-pointer underline">here</span>- </a>- </Link>{' '}- to support the growth of your project.- </>- ) : tier === PRICING_TIER_PRODUCT_IDS.PRO ? (- <>- You can check your project's usage details or consider disabling spend cap{' '}- <Link href={`/project/${ref}/settings/billing`}>- <a>- <span className="cursor-pointer underline">here</span>- </a>- </Link>{' '}- to support the growth of your project.- </>- ) : tier === PRICING_TIER_PRODUCT_IDS.PAYG ? (- <>- As you have disabled spend cap, additional resources will be charged on a per-usage basis.- You can check your project's usage details{' '}- <Link href={`/project/${ref}/settings/billing`}>- <a>- <span className="cursor-pointer underline">here</span>- </a>- </Link>{' '}- for more information.- </>- ) : (- ''- )-- return (- <div className="max-w-7xl mx-6">- <Alert- withIcon- variant={tier === PRICING_TIER_PRODUCT_IDS.PAYG ? 'neutral' : 'warning'}- title={`Your project is approaching it's usage limits for the ${tierName} tier.`}- >- {description}- </Alert>- </div>- )-}--export default OveragesBannerdiff --git a/studio/components/interfaces/Home/index.ts b/studio/components/interfaces/Home/index.tsindex d4ea93b957c..e62885bb727 100644--- a/studio/components/interfaces/Home/index.ts+++ b/studio/components/interfaces/Home/index.ts@@ -2,6 +2,5 @@ import ClientLibrary from './ClientLibrary'import ExampleProject from './ExampleProject'import ProjectUsage from './ProjectUsage'import NewProjectPanel from './NewProjectPanel/NewProjectPanel'-import OveragesBanner from './OveragesBanner'-export { ClientLibrary, ExampleProject, ProjectUsage, NewProjectPanel, OveragesBanner }+export { ClientLibrary, ExampleProject, ProjectUsage, NewProjectPanel }diff --git a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.constants.tsx b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.constants.tsxnew file mode 100644index 00000000000..1782958259c--- /dev/null+++ b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.constants.tsx@@ -0,0 +1,127 @@+import SparkBar from 'components/ui/SparkBar'+import { UsageStats } from './ProjectUsageBars.types'++// [Joshen TODO] These figures are technically wrong, GB and MB are in multiple increments of 1024+const GB = 1000000000+const MB = 1000000++export const usageLimits = {+ database: {+ title: 'Database',+ icon_src: '/img/database.svg',+ features: [+ {+ title: 'API requests',+ tiers: {+ free: {+ description: () => 'Unlimited',+ render: null,+ },+ pro: {+ description: () => 'Unlimited',+ render: null,+ },+ },+ },+ {+ title: 'Database space',+ tiers: {+ free: {+ description: (stats: UsageStats) =>+ `${((stats.dbSize / (500 * MB)) * 100).toFixed(2)} %`,+ render: (stats: UsageStats) => {+ const bytes: number = stats.dbSize+ const usage = {+ gb: bytes / GB,+ mb: bytes / MB,+ }+ return (+ <SparkBar+ value={usage.mb}+ max={500}+ type={'horizontal'}+ barClass={'bg-brand-900'}+ labelBottom={`${usage.mb.toFixed(2).toLocaleString()} MB`}+ labelTop={`500 MB`}+ />+ )+ },+ },+ pro: {+ description: (stats: UsageStats) =>+ `${((stats.dbSize / (8000 * MB)) * 100).toFixed(2)} %`,+ render: (stats: UsageStats) => {+ const bytes: number = stats.dbSize+ const usage = {+ gb: bytes / GB,+ mb: bytes / MB,+ }+ return (+ <SparkBar+ value={usage.mb}+ max={8000}+ type={'horizontal'}+ barClass={'bg-brand-900'}+ labelBottom={`${usage.mb.toFixed(2).toLocaleString()} MB`}+ labelTop={`8 GB`}+ />+ )+ },+ },+ },+ },+ ],+ },+ storage: {+ title: 'File storage',+ icon_src: '/img/archive.svg',+ features: [+ {+ title: 'Storage space',+ tiers: {+ free: {+ description: (stats: UsageStats) =>+ `${((stats.bucketSize / (1 * GB)) * 100).toFixed(2)}%`,+ render: (stats: UsageStats) => (+ <SparkBar+ value={stats.bucketSize / (1024 * 1024) || 0}+ max={1 * 1024}+ type={'horizontal'}+ barClass={'bg-brand-900'}+ labelBottom={`${(stats.bucketSize / (1024 * 1024)).toLocaleString()} MB`}+ labelTop={`${(1 * 1024).toLocaleString()} MB`}+ />+ ),+ },+ pro: {+ description: (stats: UsageStats) =>+ `${((stats.bucketSize / (100 * GB)) * 100).toFixed(2)}%`,+ render: (stats: UsageStats) => (+ <SparkBar+ value={stats.bucketSize / (1024 * 1024) || 0}+ max={100 * 1024}+ type={'horizontal'}+ barClass={'bg-brand-900'}+ labelBottom={`${(stats.bucketSize / (1024 * 1024)).toLocaleString()} MB`}+ labelTop={`${Number(100).toLocaleString()} GB`}+ />+ ),+ },+ },+ },+ {+ title: 'Transfer limits',+ tiers: {+ free: {+ description: () => `${Number(2).toLocaleString()} GB`,+ render: () => {},+ },+ pro: {+ description: () => `${Number(200).toLocaleString()} GB`,+ render: () => {},+ },+ },+ },+ ],+ },+}diff --git a/studio/components/ui/Usage.tsx b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsxsimilarity index 57%rename from studio/components/ui/Usage.tsxrename to studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsxindex 0d5970162b2..7c5aac9c8c5 100644--- a/studio/components/ui/Usage.tsx+++ b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx@@ -1,156 +1,20 @@-import React, { FC, useEffect } from 'react'import useSWR from 'swr'+import React, { FC, useEffect } from 'react'import { Loading, Typography } from '@supabase/ui'import { useProjectSubscription, useStore } from 'hooks'import { API_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'import { get } from 'lib/common/fetch'-import SparkBar from 'components/ui/SparkBar'-import ShimmeringLoader from './ShimmeringLoader'--interface ApiUsageStats {- authUsers: string | null- bucketSize: string | null- dbSize: string | null- dbTables: string | null-}-interface UsageStats {- authUsers: number- bucketSize: number- dbSize: number- dbTables: number-}+import ShimmeringLoader from 'components/ui/ShimmeringLoader'+import { usageLimits } from './ProjectUsageBars.constants'+import { UsageStats, ApiUsageStats } from './ProjectUsageBars.types'-const GB = 1000000000-const MB = 1000000--const usageLimits = {- database: {- title: 'Database',- icon_src: '/img/database.svg',- features: [- {- title: 'API requests',- tiers: {- free: {- description: () => 'Unlimited',- render: null,- },- pro: {- description: () => 'Unlimited',- render: null,- },- },- },- {- title: 'Database space',- tiers: {- free: {- description: (stats: UsageStats) =>- `${((stats.dbSize / (500 * MB)) * 100).toFixed(2)} %`,- render: (stats: UsageStats) => {- const bytes: number = stats.dbSize- const usage = {- gb: bytes / GB,- mb: bytes / MB,- }- return (- <SparkBar- value={usage.mb}- max={500}- type={'horizontal'}- barClass={'bg-brand-900'}- labelBottom={`${usage.mb.toFixed(2).toLocaleString()} MB`}- labelTop={`500 MB`}- />- )- },- },- pro: {- description: (stats: UsageStats) =>- `${((stats.dbSize / (8000 * MB)) * 100).toFixed(2)} %`,- render: (stats: UsageStats) => {- const bytes: number = stats.dbSize- const usage = {- gb: bytes / GB,- mb: bytes / MB,- }- return (- <SparkBar- value={usage.mb}- max={8000}- type={'horizontal'}- barClass={'bg-brand-900'}- labelBottom={`${usage.mb.toFixed(2).toLocaleString()} MB`}- labelTop={`8 GB`}- />- )- },- },- },- },- ],- },- storage: {- title: 'File storage',- icon_src: '/img/archive.svg',- features: [- {- title: 'Storage space',- tiers: {- free: {- description: (stats: UsageStats) =>- `${((stats.bucketSize / (1 * GB)) * 100).toFixed(2)}%`,- render: (stats: UsageStats) => (- <SparkBar- value={stats.bucketSize / (1024 * 1024) || 0}- max={1 * 1024}- type={'horizontal'}- barClass={'bg-brand-900'}- labelBottom={`${(stats.bucketSize / (1024 * 1024)).toLocaleString()} MB`}- labelTop={`${(1 * 1024).toLocaleString()} MB`}- />- ),- },- pro: {- description: (stats: UsageStats) =>- `${((stats.bucketSize / (100 * GB)) * 100).toFixed(2)}%`,- render: (stats: UsageStats) => (- <SparkBar- value={stats.bucketSize / (1024 * 1024) || 0}- max={100 * 1024}- type={'horizontal'}- barClass={'bg-brand-900'}- labelBottom={`${(stats.bucketSize / (1024 * 1024)).toLocaleString()} MB`}- labelTop={`${Number(100).toLocaleString()} GB`}- />- ),- },- },- },- {- title: 'Transfer limits',- tiers: {- free: {- description: () => `${Number(2).toLocaleString()} GB`,- render: () => {},- },- pro: {- description: () => `${Number(200).toLocaleString()} GB`,- render: () => {},- },- },- },- ],- },-}--interface ProjectUsageProps {+interface Props {projectRef?: stringsubscription_id?: string}-const ProjectUsage: FC<ProjectUsageProps> = ({ projectRef, subscription_id }) => {+const ProjectUsage: FC<Props> = ({ projectRef, subscription_id }) => {const { ui } = useStore()const { data: stats, error: usageError } = useSWR(`${API_URL}/projects/${projectRef}/usage`, get)const { subscription, isLoading: loading, error } = useProjectSubscription(projectRef)@@ -164,6 +28,9 @@ const ProjectUsage: FC<ProjectUsageProps> = ({ projectRef, subscription_id }) =>}}, [error])+ // [Joshen TODO] After API is ready need to update to include dbEgress, storageEgress+ // And also to highlight in this chart which components are "approaching" and "over"+const tier =subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.PRO ? 'pro' : 'free'@@ -234,7 +101,7 @@ const ProjectUsage: FC<ProjectUsageProps> = ({ projectRef, subscription_id }) =>export default ProjectUsage-interface ProjectUsageMinimalProps extends ProjectUsageProps {+interface ProjectUsageMinimalProps extends Props {filter: string}diff --git a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.types.ts b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.types.tsnew file mode 100644index 00000000000..674423c6d9d--- /dev/null+++ b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.types.ts@@ -0,0 +1,13 @@+export interface UsageStats {+ authUsers: number+ bucketSize: number+ dbSize: number+ dbTables: number+}++export interface ApiUsageStats {+ authUsers: string | null+ bucketSize: string | null+ dbSize: string | null+ dbTables: string | null+}diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsxindex 7dd514c1d54..4cad2143457 100644--- a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx@@ -1,19 +1,36 @@-import { observer } from 'mobx-react-lite'import Link from 'next/link'+import { observer } from 'mobx-react-lite'+import { useRouter } from 'next/router'import { IS_PLATFORM } from 'lib/constants'-import { useStore } from 'hooks'+import { useStore, useProjectUsageStatus } from 'hooks'import BreadcrumbsView from './BreadcrumbsView'import OrgDropdown from './OrgDropdown'import ProjectDropdown from './ProjectDropdown'import FeedbackDropdown from './FeedbackDropdown'import HelpPopover from './HelpPopover'import NotificationsPopover from './NotificationsPopover'+import { Badge } from '@supabase/ui'+import { getResourcesExceededLimits } from 'components/ui/OveragesBanner/OveragesBanner.utils'const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder = true }: any) => {const { ui } = useStore()const { selectedOrganization, selectedProject } = ui+ const router = useRouter()+ const { ref } = router.query+ // const { usageStatus } = useProjectUsageStatus(ref as string)++ // [Joshen TODO] After API is ready, to do up proper logic here+ const usage: any = {+ dbSize: { value: 10773283, limit: 524288000 },+ dbEgress: { value: 400000000, limit: 524288000 },+ storageSize: { value: 624288000, limit: 524288000 },+ storageEgress: { value: 0, limit: 524288000 },+ }+ const resourcesExceededLimits = getResourcesExceededLimits(usage)+ const isOverUsageLimits = resourcesExceededLimits.length > 0+return (<divclassName={`flex h-12 max-h-12 items-center justify-between py-2 px-5 ${@@ -47,6 +64,15 @@ const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder =</span>{/* Project Dropdown */}<ProjectDropdown />+ {isOverUsageLimits && (+ <div className="ml-2">+ <Link href={`/project/${ref}/settings/billing`}>+ <a>+ <Badge color="red">Project has exceeded usage limits </Badge>+ </a>+ </Link>+ </div>+ )}</>)}</>@@ -69,8 +95,6 @@ const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder ={IS_PLATFORM && <NotificationsPopover />}</div></div>- // </div>- // </div>)}export default observer(LayoutHeader)diff --git a/studio/components/ui/OveragesBanner/OveragesBanner.tsx b/studio/components/ui/OveragesBanner/OveragesBanner.tsxnew file mode 100644index 00000000000..194b9410cb5--- /dev/null+++ b/studio/components/ui/OveragesBanner/OveragesBanner.tsx@@ -0,0 +1,130 @@+import Link from 'next/link'+import { FC } from 'react'+import { Alert, Button } from '@supabase/ui'++import { useStore, useProjectUsageStatus } from 'hooks'+import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'+import { getResourcesApproachingLimits, getResourcesExceededLimits } from './OveragesBanner.utils'++interface Props {+ tier: string+ minimal?: boolean+}++const OveragesBanner: FC<Props> = ({ tier, minimal }) => {+ const { ui } = useStore()+ const ref = ui.selectedProject?.ref++ // [Joshen TODO] After API is ready, to do up proper logic here+ // const { usageStatus } = useProjectUsageStatus(ui.selectedProject?.ref)+ const usage: any = {+ dbSize: { value: 10773283, limit: 524288000 },+ dbEgress: { value: 400000000, limit: 524288000 },+ storageSize: { value: 624288000, limit: 524288000 },+ storageEgress: { value: 0, limit: 524288000 },+ }++ const resourcesApproachingLimits = getResourcesApproachingLimits(usage)+ const isApproachingUsageLimits = resourcesApproachingLimits.length > 0++ const resourcesExceededLimits = getResourcesExceededLimits(usage)+ const isOverUsageLimits = resourcesExceededLimits.length > 0++ if (+ (!isApproachingUsageLimits && !isOverUsageLimits) ||+ tier === PRICING_TIER_PRODUCT_IDS.ENTERPRISE+ ) {+ return <></>+ }++ const tierName =+ tier === PRICING_TIER_PRODUCT_IDS.FREE+ ? 'free'+ : tier === PRICING_TIER_PRODUCT_IDS.PRO+ ? 'pro'+ : tier === PRICING_TIER_PRODUCT_IDS.PAYG+ ? 'pro'+ : ''++ const minimalDescription =+ tier === PRICING_TIER_PRODUCT_IDS.FREE ? (+ <>+ You can check your project's usage details or upgrade to the pro tier{' '}+ <Link href={`/project/${ref}/settings/billing`}>+ <a>+ <span className="cursor-pointer underline">here</span>+ </a>+ </Link>{' '}+ to support the growth of your project.+ </>+ ) : tier === PRICING_TIER_PRODUCT_IDS.PRO ? (+ <>+ You can check your project's usage details or consider disabling spend cap{' '}+ <Link href={`/project/${ref}/settings/billing`}>+ <a>+ <span className="cursor-pointer underline">here</span>+ </a>+ </Link>{' '}+ to support the growth of your project.+ </>+ ) : tier === PRICING_TIER_PRODUCT_IDS.PAYG ? (+ <>+ As you have disabled spend cap, additional resources will be charged on a per-usage basis.+ You can check your project's usage details{' '}+ <Link href={`/project/${ref}/settings/billing`}>+ <a>+ <span className="cursor-pointer underline">here</span>+ </a>+ </Link>{' '}+ for more information.+ </>+ ) : (+ ''+ )++ const description =+ tier === PRICING_TIER_PRODUCT_IDS.FREE+ ? 'Upgrade to the pro tier to support the growth of your project.'+ : tier === PRICING_TIER_PRODUCT_IDS.PRO+ ? ''+ : tier === PRICING_TIER_PRODUCT_IDS.PAYG+ ? ''+ : ''++ return (+ <div className="max-w-7xl">+ <Alert+ withIcon+ variant={+ tier === PRICING_TIER_PRODUCT_IDS.PAYG+ ? 'neutral'+ : isOverUsageLimits+ ? 'danger'+ : isApproachingUsageLimits+ ? 'warning'+ : 'neutral'+ }+ title={+ isOverUsageLimits+ ? `Your project has exceeded it's usage limits for the ${tierName} tier.`+ : isApproachingUsageLimits+ ? `Your project is approaching it's usage limits for the ${tierName} tier.`+ : ''+ }+ actions={+ minimal ? (+ <div className="h-full flex items-center">+ <Button type="default">Explore usage details</Button>+ </div>+ ) : (+ <></>+ )+ }+ >+ {minimal ? minimalDescription : description}+ </Alert>+ </div>+ )+}++export default OveragesBannerdiff --git a/studio/components/ui/OveragesBanner/OveragesBanner.utils.ts b/studio/components/ui/OveragesBanner/OveragesBanner.utils.tsnew file mode 100644index 00000000000..71489c99995--- /dev/null+++ b/studio/components/ui/OveragesBanner/OveragesBanner.utils.ts@@ -0,0 +1,20 @@+import { compact } from 'lodash'+import { USAGE_APPROACHING_THRESHOLD } from 'lib/constants'++export const getResourcesApproachingLimits = (usage: any) => {+ return compact(+ Object.keys(usage).map((resourceName) => {+ const resource = usage[resourceName]+ if (resource.value / resource.limit >= USAGE_APPROACHING_THRESHOLD) return resourceName+ })+ )+}++export const getResourcesExceededLimits = (usage: any) => {+ return compact(+ Object.keys(usage).map((resourceName) => {+ const resource = usage[resourceName]+ if (resource.value / resource.limit >= 1) return resourceName+ })+ )+}diff --git a/studio/lib/constants/index.ts b/studio/lib/constants/index.tsindex 9f0d81a638b..3f039bbaf21 100644--- a/studio/lib/constants/index.ts+++ b/studio/lib/constants/index.ts@@ -81,3 +81,5 @@ export const GOTRUE_ERRORS = {export const STRIPE_PUBLIC_KEY =process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY || 'pk_test_XVwg5IZH3I9Gti98hZw6KRzd00v5858heG'++export const USAGE_APPROACHING_THRESHOLD = 0.75\ No newline at end of filediff --git a/studio/package-lock.json b/studio/package-lock.jsonindex 94a4a8704c0..cb282a314f3 100644--- a/studio/package-lock.json+++ b/studio/package-lock.json@@ -22,7 +22,7 @@"@supabase/react-data-grid": "^7.1.0-beta.7","@supabase/shared-types": "^0.1.24","@supabase/supabase-js": "^1.36.0-next.9",- "@supabase/ui": "0.37.0-alpha.76",+ "@supabase/ui": "0.37.0-alpha.79","ajv": "^8.6.3","analytics-node": "^3.5.0","awesome-debounce-promise": "^2.1.0",@@ -8402,9 +8402,9 @@}},"node_modules/@supabase/ui": {- "version": "0.37.0-alpha.76",- "resolved": "https://registry.npmjs.org/@supabase/ui/-/ui-0.37.0-alpha.76.tgz",- "integrity": "sha512-K1mzTG/2nnBd0SrC+BpMb0qHFSIIF+WtqR0oG/mZXEgvNJhxZADBrDtIr2hjSSx86ZrsOdgjxiqtzisAEg+65Q==",+ "version": "0.37.0-alpha.79",+ "resolved": "https://registry.npmjs.org/@supabase/ui/-/ui-0.37.0-alpha.79.tgz",+ "integrity": "sha512-orN+4rO8iUMhPXSr1x2FbrOCuh4HLA3K+jmg5rJElFMSHUgANL+G2UPANKU+PId/ewSDlH3lnrKvga0Se3XC1Q==","dependencies": {"@headlessui/react": "^1.0.0","@mertasan/tailwindcss-variables": "^2.0.1",@@ -36133,9 +36133,9 @@}},"@supabase/ui": {- "version": "0.37.0-alpha.76",- "resolved": "https://registry.npmjs.org/@supabase/ui/-/ui-0.37.0-alpha.76.tgz",- "integrity": "sha512-K1mzTG/2nnBd0SrC+BpMb0qHFSIIF+WtqR0oG/mZXEgvNJhxZADBrDtIr2hjSSx86ZrsOdgjxiqtzisAEg+65Q==",+ "version": "0.37.0-alpha.79",+ "resolved": "https://registry.npmjs.org/@supabase/ui/-/ui-0.37.0-alpha.79.tgz",+ "integrity": "sha512-orN+4rO8iUMhPXSr1x2FbrOCuh4HLA3K+jmg5rJElFMSHUgANL+G2UPANKU+PId/ewSDlH3lnrKvga0Se3XC1Q==","requires": {"@headlessui/react": "^1.0.0","@mertasan/tailwindcss-variables": "^2.0.1",diff --git a/studio/package.json b/studio/package.jsonindex aefa7e187d6..abaa77fe6d9 100644--- a/studio/package.json+++ b/studio/package.json@@ -28,7 +28,7 @@"@supabase/react-data-grid": "^7.1.0-beta.7","@supabase/shared-types": "^0.1.24","@supabase/supabase-js": "^1.36.0-next.9",- "@supabase/ui": "0.37.0-alpha.76",+ "@supabase/ui": "0.37.0-alpha.79","ajv": "^8.6.3","analytics-node": "^3.5.0","awesome-debounce-promise": "^2.1.0",diff --git a/studio/pages/project/[ref]/index.tsx b/studio/pages/project/[ref]/index.tsxindex d996ff6bf87..c51564e3599 100644--- a/studio/pages/project/[ref]/index.tsx+++ b/studio/pages/project/[ref]/index.tsx@@ -9,14 +9,13 @@ import { ExampleProject, ClientLibrary } from 'components/interfaces/Home'import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants'import ProjectUsageSection from 'components/interfaces/Home/ProjectUsageSection'import ProjectPausedState from 'components/layouts/ProjectLayout/ProjectPausedState'-import { OveragesBanner } from '../../../components/interfaces/Home'+import OveragesBanner from 'components/ui/OveragesBanner/OveragesBanner'const Home: NextPageWithLayout = () => {const { ui } = useStore()const project = ui.selectedProjectconst projectTier = ui.selectedProject?.subscription_tier- const { usageStatus } = useProjectUsageStatus(project?.ref)const projectName =project?.ref !== 'default' && project?.name !== undefined@@ -29,10 +28,12 @@ const Home: NextPageWithLayout = () => {<h1 className="text-3xl">{projectName}</h1></div>- {/* [Joshen TODO] pass projectTier into tier and just keep one */}- {projectTier !== undefined && <OveragesBanner tier={'tier_free'} usageStatus={usageStatus} />}- {projectTier !== undefined && <OveragesBanner tier={'tier_pro'} usageStatus={usageStatus} />}- {projectTier !== undefined && <OveragesBanner tier={'tier_payg'} usageStatus={usageStatus} />}+ {/* [Joshen TODO] After API is ready pass projectTier into tier and just keep one */}+ <div className="mx-6 space-y-2">+ {projectTier !== undefined && <OveragesBanner minimal tier={'tier_free'} />}+ {projectTier !== undefined && <OveragesBanner minimal tier={'tier_pro'} />}+ {projectTier !== undefined && <OveragesBanner minimal tier={'tier_payg'} />}+ </div>{project?.status === PROJECT_STATUS.INACTIVE && <ProjectPausedState project={project} />}@@ -62,6 +63,12 @@ const Home: NextPageWithLayout = () => {)}-Home.getLayout = (page) => <ProjectLayoutWithAuth>{page}</ProjectLayoutWithAuth>+Home.getLayout = (page) => (+ <ProjectLayoutWithAuth>+ <main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">+ {page}+ </main>+ </ProjectLayoutWithAuth>+)export default observer(Home)diff --git a/studio/pages/project/[ref]/settings/billing/index.tsx b/studio/pages/project/[ref]/settings/billing/index.tsxindex af343ba0a7c..356b63d43e6 100644--- a/studio/pages/project/[ref]/settings/billing/index.tsx+++ b/studio/pages/project/[ref]/settings/billing/index.tsx@@ -4,14 +4,20 @@ import { observer } from 'mobx-react-lite'import { Typography, Loading, IconArrowRight } from '@supabase/ui'import { Project, NextPageWithLayout } from 'types'-import { useProjectPaygStatistics, useProjectSubscription, useStore } from 'hooks'+import {+ useProjectPaygStatistics,+ useProjectSubscription,+ useStore,+ useProjectUsageStatus,+} from 'hooks'import { STRIPE_PRODUCT_IDS, TIME_PERIODS_REPORTS, TIME_PERIODS_BILLING } from 'lib/constants'import { SettingsLayout } from 'components/layouts'-import ProjectUsage from 'components/ui/Usage'import LoadingUI from 'components/ui/Loading'-import { PAYGUsage, Subscription, Invoices } from 'components/interfaces/Billing'+import OveragesBanner from 'components/ui/OveragesBanner/OveragesBanner'import DateRangePicker from 'components/to-be-cleaned/DateRangePicker'+import { PAYGUsage, Subscription, Invoices } from 'components/interfaces/Billing'import { PaygStats } from 'components/interfaces/Billing/PAYGUsage/PAYGUsage.types'+import ProjectUsage from 'components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars'const ProjectBilling: NextPageWithLayout = () => {const { ui } = useStore()@@ -39,6 +45,8 @@ interface SettingsProps {const Settings: FC<SettingsProps> = ({ project }) => {const { ui } = useStore()+ const [dateRange, setDateRange] = useState<any>()+const {subscription,isLoading: loading,@@ -50,8 +58,6 @@ const Settings: FC<SettingsProps> = ({ project }) => {subscription?.tier?.supabase_prod_id)- const [dateRange, setDateRange] = useState<any>()-useEffect(() => {if (error) {ui.setNotification({@@ -67,6 +73,8 @@ const Settings: FC<SettingsProps> = ({ project }) => {return (<div className="container max-w-4xl space-y-8 p-4">+ {/* [Joshen TODO] After API is ready */}+ <OveragesBanner tier={'tier_free'} /><Subscriptionloading={loading}project={project}diff --git a/studio/pages/project/[ref]/settings/database.tsx b/studio/pages/project/[ref]/settings/database.tsxindex a44b572a97a..b5c137f9cd1 100644--- a/studio/pages/project/[ref]/settings/database.tsx+++ b/studio/pages/project/[ref]/settings/database.tsx@@ -1,5 +1,6 @@import dayjs from 'dayjs'import useSWR from 'swr'+import { NextPageWithLayout } from 'types'import { FC, useState, useRef, useEffect } from 'react'import { toJS } from 'mobx'import { observer } from 'mobx-react-lite'@@ -16,11 +17,10 @@ import { API_URL, DEFAULT_MINIMUM_PASSWORD_STRENGTH, TIME_PERIODS_INFRA } from 'import { SettingsLayout } from 'components/layouts'import PasswordStrengthBar from 'components/ui/PasswordStrengthBar'import Panel from 'components/ui/Panel'-import { ProjectUsageMinimal } from 'components/ui/Usage'import DateRangePicker from 'components/to-be-cleaned/DateRangePicker'import ChartHandler from 'components/to-be-cleaned/Charts/ChartHandler'import ConnectionPooling from 'components/interfaces/Database/Pooling/ConnectionPooling'-import { NextPageWithLayout } from 'types'+import { ProjectUsageMinimal } from 'components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars'const ProjectSettings: NextPageWithLayout = () => {const router = useRouter()