diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx index 3e1105e23b6..49e793ec9eb 100644 --- a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx +++ b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx @@ -1,4 +1,4 @@ -import Router from 'next/router' +import { BASE_PATH } from 'lib/constants' import { FC, useState } from 'react' import ReactMarkdown from 'react-markdown' import { Button, Input, InputNumber, Toggle, Listbox, IconEye, IconEyeOff } from 'ui' @@ -125,7 +125,7 @@ const FormField: FC = ({ name, properties, formValues, disabled = false } label={option.label} value={option.value} addOnBefore={() => ( - + )} > {option.label} diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx index c845340e38c..f2909a7f4de 100644 --- a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx +++ b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx @@ -1,11 +1,11 @@ import { FC, useState } from 'react' -import Router from 'next/router' import ReactMarkdown from 'react-markdown' import * as Tooltip from '@radix-ui/react-tooltip' import { PermissionAction } from '@supabase/shared-types/out/constants' import { Alert, Button, Collapsible, Form, IconCheck, IconChevronUp, Input } from 'ui' import { useStore, checkPermissions } from 'hooks' +import { BASE_PATH } from 'lib/constants' import { Provider } from './AuthProvidersForm.types' import { ProviderCollapsibleClasses } from './AuthProvidersForm.constants' import FormField from './FormField' @@ -79,7 +79,7 @@ const ProviderForm: FC = ({ provider }) => { width={14} /> {`${provider.title} diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx index 27a0d43b710..f45b945ca9d 100644 --- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx +++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx @@ -5,7 +5,7 @@ import { Listbox, IconLoader, Button, IconPlus, IconAlertCircle, IconCreditCard import { PermissionAction } from '@supabase/shared-types/out/constants' import { checkPermissions, useStore } from 'hooks' -import { PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants' +import { BASE_PATH, PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants' import { SubscriptionPreview } from '../Billing.types' import { getProductPrice, validateSubscriptionUpdatePayload } from '../Billing.utils' import PaymentTotal from './PaymentTotal' @@ -401,7 +401,7 @@ const PaymentSummaryPanel: FC = ({ addOnBefore={() => { return ( = observer(
{/*
*/} { const { ui } = useStore() @@ -74,7 +74,7 @@ const TableSelection: FC = observer(({}) => { addOnBefore={() => (
code.replace(/svg/, 'svg class="m-auto text-color-inherit"') diff --git a/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx b/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx index 506f899d38a..335f05f6021 100644 --- a/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx +++ b/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx @@ -14,13 +14,14 @@ import { Button, } from 'ui' import { Dictionary } from 'components/grid' -import Router, { useRouter } from 'next/router' +import { useRouter } from 'next/router' import SVG from 'react-inlinesvg' import ChooseFunctionForm from './ChooseFunctionForm' import FormEmptyBox from 'components/ui/FormBoxEmpty' import NoTableState from 'components/ui/States/NoTableState' import { useStore } from 'hooks' +import { BASE_PATH } from 'lib/constants' class CreateTriggerFormState { id: number | undefined @@ -545,7 +546,7 @@ const ListboxTable: FC = observer(({}) => { addOnBefore={() => (
code.replace(/svg/, 'svg class="m-auto text-color-inherit"') diff --git a/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts b/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts index a00161aecda..fe05d8bb3ab 100644 --- a/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts +++ b/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts @@ -1,4 +1,4 @@ -import Router from 'next/router' +import { BASE_PATH } from 'lib/constants' import { WrapperMeta } from './Wrappers.types' export const WRAPPERS: WrapperMeta[] = [ @@ -6,7 +6,7 @@ export const WRAPPERS: WrapperMeta[] = [ name: 'stripe_wrapper', handlerName: 'stripe_fdw_handler', validatorName: 'stripe_fdw_validator', - icon: `${Router.basePath}/img/icons/stripe-icon.svg`, + icon: `${BASE_PATH}/img/icons/stripe-icon.svg`, extensionName: 'StripeFdw', label: 'Stripe', docsUrl: 'https://supabase.com/docs/guides/database/wrappers/stripe', @@ -410,7 +410,7 @@ export const WRAPPERS: WrapperMeta[] = [ name: 'firebase_wrapper', handlerName: 'firebase_fdw_handler', validatorName: 'firebase_fdw_validator', - icon: `${Router.basePath}/img/icons/firebase-icon.svg`, + icon: `${BASE_PATH}/img/icons/firebase-icon.svg`, extensionName: 'FirebaseFdw', label: 'Firebase', docsUrl: 'https://supabase.com/docs/guides/database/wrappers/firebase', diff --git a/studio/components/interfaces/Database/Wrappers/WrappersDisabledState.tsx b/studio/components/interfaces/Database/Wrappers/WrappersDisabledState.tsx index c715c7db2e8..d80ab7d57c5 100644 --- a/studio/components/interfaces/Database/Wrappers/WrappersDisabledState.tsx +++ b/studio/components/interfaces/Database/Wrappers/WrappersDisabledState.tsx @@ -1,5 +1,4 @@ import Link from 'next/link' -import Router from 'next/router' import { useState } from 'react' import { Button, IconExternalLink } from 'ui' import { observer } from 'mobx-react-lite' @@ -7,6 +6,7 @@ import * as Tooltip from '@radix-ui/react-tooltip' import { PermissionAction } from '@supabase/shared-types/out/constants' import { checkPermissions, useParams, useStore } from 'hooks' +import { BASE_PATH } from 'lib/constants' const WrappersDisabledState = () => { const { ui, meta } = useStore() @@ -66,8 +66,8 @@ const WrappersDisabledState = () => { backgroundSize: '45%', backgroundPosition: '105% 40%', backgroundImage: ui.isDarkTheme - ? `url("${Router.basePath}/img/wrappers-dark.png")` - : `url("${Router.basePath}/img/wrappers-light.png")`, + ? `url("${BASE_PATH}/img/wrappers-dark.png")` + : `url("${BASE_PATH}/img/wrappers-light.png")`, }} >
diff --git a/studio/components/interfaces/Home/ClientLibrary.tsx b/studio/components/interfaces/Home/ClientLibrary.tsx index dbcbd7f53b8..59f1d0b4d5f 100644 --- a/studio/components/interfaces/Home/ClientLibrary.tsx +++ b/studio/components/interfaces/Home/ClientLibrary.tsx @@ -1,6 +1,6 @@ import { FC } from 'react' -import Router from 'next/router' import { IconBookOpen, IconGitHub, Button, Badge } from 'ui' +import { BASE_PATH } from 'lib/constants' interface Props { language: string @@ -14,7 +14,7 @@ const ClientLibrary: FC = ({ language, releaseState, officialSupport, doc return (
{`${language} diff --git a/studio/components/interfaces/Home/ExampleProject.tsx b/studio/components/interfaces/Home/ExampleProject.tsx index 990f8d19018..32f76b8bfaf 100644 --- a/studio/components/interfaces/Home/ExampleProject.tsx +++ b/studio/components/interfaces/Home/ExampleProject.tsx @@ -1,8 +1,8 @@ import { FC } from 'react' -import Router from 'next/router' import { IconChevronRight } from 'ui' import { useStore } from 'hooks' import Link from 'next/link' +import { BASE_PATH } from 'lib/constants' interface Props { framework: string @@ -30,7 +30,7 @@ const ExampleProject: FC = ({ framework, title, description, url }) => {
= ({
= () => { backgroundSize: isNotAvailable ? '50%' : '40%', backgroundPosition: '100% 24%', backgroundImage: ui.isDarkTheme - ? `url("${Router.basePath}/img/vault-dark.png")` - : `url("${Router.basePath}/img/vault-light.png")`, + ? `url("${BASE_PATH}/img/vault-dark.png")` + : `url("${BASE_PATH}/img/vault-light.png")`, }} >
diff --git a/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx b/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx index d5262f54cff..9ac8f17a505 100644 --- a/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx +++ b/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx @@ -1,7 +1,7 @@ -import Router from 'next/router' import SVG from 'react-inlinesvg' import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types' import { IconBook, IconBookOpen } from 'ui' +import { BASE_PATH } from 'lib/constants' export const generateDocsMenu = ( ref: string, @@ -72,7 +72,7 @@ export const generateDocsMenu = ( url: `/project/${ref}/api/graphiql`, icon: ( diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx index 478cb2bb431..15c465e3fa5 100644 --- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx +++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx @@ -9,11 +9,10 @@ import { IconUsers, } from 'ui' import SVG from 'react-inlinesvg' -import Router from 'next/router' import { ProjectBase } from 'types' import { Route } from 'components/ui/ui.types' -import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants' +import { BASE_PATH, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants' export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] => { const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP @@ -28,7 +27,7 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] label: 'Table Editor', icon: ( code.replace(/svg/, 'svg class="m-auto text-color-inherit"')} /> @@ -42,7 +41,7 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] label: 'SQL Editor', icon: ( code.replace(/svg/, 'svg class="m-auto text-color-inherit"')} /> diff --git a/studio/components/layouts/SignInLayout/ForgotPasswordLayout.tsx b/studio/components/layouts/SignInLayout/ForgotPasswordLayout.tsx index f77e48c1c7a..7de8e7cfaf3 100644 --- a/studio/components/layouts/SignInLayout/ForgotPasswordLayout.tsx +++ b/studio/components/layouts/SignInLayout/ForgotPasswordLayout.tsx @@ -1,9 +1,9 @@ -import { useStore } from 'hooks' import { observer } from 'mobx-react-lite' import Image from 'next/image' import Link from 'next/link' -import Router from 'next/router' import { PropsWithChildren } from 'react' +import { useStore } from 'hooks' +import { BASE_PATH } from 'lib/constants' type ForgotPasswordLayoutProps = { heading: string @@ -34,8 +34,8 @@ const ForgotPasswordLayout = ({ = ({ children }) => { Supabase
diff --git a/studio/components/layouts/WizardLayout.tsx b/studio/components/layouts/WizardLayout.tsx index 0c9afd5fa5a..9429f38802a 100644 --- a/studio/components/layouts/WizardLayout.tsx +++ b/studio/components/layouts/WizardLayout.tsx @@ -1,9 +1,9 @@ import { FC } from 'react' import Link from 'next/link' -import Router from 'next/router' import { IconChevronRight } from 'ui' import { withAuth, useFlag } from 'hooks' import { observer } from 'mobx-react-lite' +import { BASE_PATH } from 'lib/constants' const WizardLayout: FC = ({ organization, project, children }) => { const ongoingIncident = useFlag('ongoingIncident') @@ -36,7 +36,7 @@ const Header: FC = ({ organization, project }) => { Supabase { return (
code.replace(/svg/, 'svg className="mb-2 w-16 h-16 text-color-inherit"') } diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js index 6cf5ce73e07..8d5d4ac1150 100644 --- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js +++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js @@ -1,5 +1,4 @@ import { useState, useRef, useEffect } from 'react' -import Router from 'next/router' import { get, sum } from 'lodash' import { Checkbox, IconUpload } from 'ui' import { Transition } from '@headlessui/react' @@ -15,6 +14,7 @@ import { CONTEXT_MENU_KEYS, } from '../Storage.constants' import { formatBytes } from 'lib/helpers' +import { BASE_PATH } from 'lib/constants' const DragOverOverlay = ({ isOpen, onDragLeave, onDrop, folderIsEmpty }) => { return ( @@ -223,7 +223,7 @@ const FileExplorerColumn = ({ {column.items.length === 0 && column.status !== STORAGE_ROW_STATUS.LOADING && (

Drop your files here

diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.tsx b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.tsx index 9979a78e99a..2b80cbabb77 100644 --- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.tsx +++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.tsx @@ -1,5 +1,4 @@ import { FC, useState, useRef, useEffect } from 'react' -import Router from 'next/router' import { find, has, isEmpty, isEqual } from 'lodash' import { Checkbox, @@ -32,6 +31,7 @@ import { URL_EXPIRY_DURATION, } from '../Storage.constants' import { formatBytes } from 'lib/helpers' +import { BASE_PATH } from 'lib/constants' import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore' const RowIcon = ({ view, status, fileType, mimeType }: any) => { @@ -42,10 +42,10 @@ const RowIcon = ({ view, status, fileType, mimeType }: any) => { if (fileType === STORAGE_ROW_TYPES.BUCKET || fileType === STORAGE_ROW_TYPES.FOLDER) { const iconSrc = fileType === STORAGE_ROW_TYPES.BUCKET - ? `${Router.basePath}/img/bucket-filled.svg` + ? `${BASE_PATH}/img/bucket-filled.svg` : fileType === STORAGE_ROW_TYPES.FOLDER - ? `${Router.basePath}/img/folder-filled.svg` - : `${Router.basePath}/img/file-filled.svg` + ? `${BASE_PATH}/img/folder-filled.svg` + : `${BASE_PATH}/img/file-filled.svg` return ( code.replace(/svg/, 'svg class="mx-auto w-32 h-32 text-color-inherit opacity-75"') } @@ -43,7 +43,7 @@ const PreviewFile = ({ mimeType, previewUrl }: { mimeType: string; previewUrl: s return (
code.replace(/svg/, 'svg class="mx-auto w-32 h-32 text-color-inherit opacity-75"') } @@ -86,7 +86,7 @@ const PreviewFile = ({ mimeType, previewUrl }: { mimeType: string; previewUrl: s } return ( code.replace(/svg/, 'svg class="mx-auto w-32 h-32 text-color-inherit opacity-75"') } diff --git a/studio/lib/constants/index.ts b/studio/lib/constants/index.ts index dfcbaed0ef6..24743c4904f 100644 --- a/studio/lib/constants/index.ts +++ b/studio/lib/constants/index.ts @@ -7,6 +7,7 @@ export const API_ADMIN_URL = IS_PLATFORM ? process.env.NEXT_PUBLIC_API_ADMIN_URL export const PG_META_URL = IS_PLATFORM ? process.env.PLATFORM_PG_META_URL : process.env.STUDIO_PG_META_URL +export const BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH ?? '' export const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ' diff --git a/studio/pages/404.tsx b/studio/pages/404.tsx index ea67c7812f9..853a48bda64 100644 --- a/studio/pages/404.tsx +++ b/studio/pages/404.tsx @@ -1,11 +1,11 @@ import { NextPage } from 'next' import Image from 'next/image' -import Router from 'next/router' import Link from 'next/link' import { useEffect, useState } from 'react' import { Button } from 'ui' import { useStore } from 'hooks' +import { BASE_PATH } from 'lib/constants' const Error404: NextPage = ({}) => { const { ui } = useStore() @@ -29,8 +29,8 @@ const Error404: NextPage = ({}) => { { Supabase = () => { Supabase {
- +

Supabase support