The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: project sidebar menu urls while project is building up
phamhieu34d4a2feee07
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsxindex 20943f281c2..335b31fd207 100644--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx@@ -16,10 +16,11 @@ const NavigationBar: FC<Props> = ({}) => {const router = useRouter()const { ui } = useStore()const projectRef = ui.selectedProjectRef as string+ const projectBaseInfo = ui.selectedProjectBaseInfoconst activeRoute = router.pathname.split('/')[3]- const productRoutes = generateProductRoutes(projectRef)- const otherRoutes = generateOtherRoutes(projectRef)+ const productRoutes = generateProductRoutes(projectRef, projectBaseInfo)+ const otherRoutes = generateOtherRoutes(projectRef, projectBaseInfo)return (<divdiff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsxindex 83c21273b9f..16ceb4efdc9 100644--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx@@ -10,13 +10,16 @@ import {} from '@supabase/ui'import SVG from 'react-inlinesvg'-import { IS_PLATFORM } from 'lib/constants'+import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'import { Route } from 'components/ui/ui.types'import { useFlag } from 'hooks'+import { ProjectBase } from 'types'-export const generateProductRoutes = (ref: string): Route[] => {+export const generateProductRoutes = (ref: string, project?: ProjectBase): Route[] => {const functionsUi = useFlag('functionsUi')+ const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY+ const buildingUrl = `/project/${ref}/building`return [{@@ -29,13 +32,13 @@ export const generateProductRoutes = (ref: string): Route[] => {preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}/>),- link: `/project/${ref}/editor`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/editor`,},{key: 'auth',label: 'Authentication',icon: <IconUsers size={18} strokeWidth={2} />,- link: `/project/${ref}/auth/users`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/auth/users`,},...(IS_PLATFORM? [@@ -43,7 +46,7 @@ export const generateProductRoutes = (ref: string): Route[] => {key: 'storage',label: 'Storage',icon: <IconArchive size={18} strokeWidth={2} />,- link: `/project/${ref}/storage/buckets`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`,},]: []),@@ -57,13 +60,13 @@ export const generateProductRoutes = (ref: string): Route[] => {preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}/>),- link: `/project/${ref}/sql`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/sql`,},{key: 'database',label: 'Database',icon: <IconDatabase size={18} strokeWidth={2} />,- link: `/project/${ref}/database/tables`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/database/tables`,},...(IS_PLATFORM && functionsUi? [@@ -71,15 +74,18 @@ export const generateProductRoutes = (ref: string): Route[] => {key: 'functions',label: 'Functions',icon: <IconCode size={18} strokeWidth={2} />,- link: `/project/${ref}/functions`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/functions`,},]: []),]}-export const generateOtherRoutes = (ref: string) => {+export const generateOtherRoutes = (ref: string, project?: ProjectBase) => {const logsExplorer = useFlag('logsExplorer')+ const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY+ const buildingUrl = `/project/${ref}/building`+return [...(IS_PLATFORM && logsExplorer? [@@ -87,7 +93,7 @@ export const generateOtherRoutes = (ref: string) => {key: 'logsExplorer',label: 'Logs Explorer',icon: <IconList size={18} strokeWidth={2} />,- link: `/project/${ref}/logs-explorer`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/logs-explorer`,},]: []),@@ -97,7 +103,7 @@ export const generateOtherRoutes = (ref: string) => {key: 'reports',label: 'Reports',icon: <IconBarChart size={18} strokeWidth={2} />,- link: `/project/${ref}/reports`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/reports`,},]: []),@@ -105,7 +111,7 @@ export const generateOtherRoutes = (ref: string) => {key: 'api',label: 'API',icon: <IconFileText size={18} strokeWidth={2} />,- link: `/project/${ref}/api`,+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/api`,},...(IS_PLATFORM? [diff --git a/studio/stores/UiStore.ts b/studio/stores/UiStore.tsindex 354eb335714..630acc952c9 100644--- a/studio/stores/UiStore.ts+++ b/studio/stores/UiStore.ts@@ -1,6 +1,6 @@import { uuidv4 } from 'lib/helpers'import { action, makeAutoObservable } from 'mobx'-import { Project, Notification, User, Organization } from 'types'+import { Project, Notification, User, Organization, ProjectBase } from 'types'import { IRootStore } from './RootStore'import Telemetry from 'lib/telemetry'@@ -12,6 +12,7 @@ export interface IUiStore {selectedProjectRef?: stringisDarkTheme: booleanselectedProject?: Project+ selectedProjectBaseInfo?: ProjectBaseselectedOrganization?: Organizationnotification?: Notificationprofile?: User@@ -60,6 +61,18 @@ export default class UiStore implements IUiStore {return undefined}+ /**+ * Get selected project base info.+ *+ * @return ProjectBase or undefined+ */+ get selectedProjectBaseInfo(): ProjectBase | undefined {+ if (this.selectedProjectRef) {+ return this.rootStore.app.projects.find((x: Project) => x.ref == this.selectedProjectRef)+ }+ return undefined+ }+get selectedOrganization() {if (this.selectedOrganizationSlug) {const found = this.rootStore.app.organizations.find(diff --git a/studio/types/base.ts b/studio/types/base.tsindex 552c545d1fe..138490aecb1 100644--- a/studio/types/base.ts+++ b/studio/types/base.ts@@ -12,7 +12,7 @@ export interface Organization {total_paid_projects?: number}-export interface Project {+export interface ProjectBase {id: numberref: stringname: string@@ -22,7 +22,9 @@ export interface Project {region: stringinserted_at: stringsubscription_id: string+}+export interface Project extends ProjectBase {// only available after projects.fetchDetailkpsVersion?: stringconnectionString?: string