Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add isProjectPaused check

Terry Sutton6f692f883a8e
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index c3c16aac263..bda1690a721 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -46,12 +46,17 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[]
preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}
/>
),
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/sql`),
+ link:
+ ref &&
+ (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/sql`),
},
]
}
export const generateProductRoutes = (ref?: string, project?: ProjectBase): Route[] => {
const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY
+ const isProjectPaused = project?.status === PROJECT_STATUS.INACTIVE
+
+ const homeUrl = `/project/${ref}`
const buildingUrl = `/project/${ref}/building`
return [
@@ -59,13 +64,21 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Rout
key: 'database',
label: 'Database',
icon: <IconDatabase size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/database/tables`),
+ link:
+ ref &&
+ (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/editor`),
},
{
key: 'auth',
label: 'Authentication',
icon: <IconUsers size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/auth/users`),
+ link:
+ ref &&
+ (isProjectPaused
+ ? homeUrl
+ : isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/auth/users`),
},
...(IS_PLATFORM
? [
@@ -73,7 +86,13 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Rout
key: 'storage',
label: 'Storage',
icon: <IconArchive size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`),
+ link:
+ ref &&
+ (isProjectPaused
+ ? homeUrl
+ : isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/storage/buckets`),
},
]
: []),
@@ -84,7 +103,13 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Rout
key: 'functions',
label: 'Edge Functions',
icon: <IconCode size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/functions`),
+ link:
+ ref &&
+ (isProjectPaused
+ ? homeUrl
+ : isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/functions`),
},
]
: []),
@@ -92,7 +117,10 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Rout
}
export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[] => {
- const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY
+ const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
+ const isProjectPaused = project?.status === PROJECT_STATUS.INACTIVE
+
+ const homeUrl = `/project/${ref}`
const buildingUrl = `/project/${ref}/building`
return [
@@ -102,7 +130,13 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[
key: 'reports',
label: 'Reports',
icon: <IconBarChart size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/reports`),
+ link:
+ ref &&
+ (isProjectPaused
+ ? homeUrl
+ : isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/reports`),
},
]
: []),
@@ -112,7 +146,13 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[
key: 'explorer',
label: 'Logs',
icon: <IconList size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/logs/explorer`),
+ link:
+ ref &&
+ (isProjectPaused
+ ? homeUrl
+ : isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/logs/explorer`),
},
]
: []),
@@ -120,7 +160,9 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[
key: 'api',
label: 'API Docs',
icon: <IconFileText size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/api`),
+ link:
+ ref &&
+ (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/api`),
},
...(IS_PLATFORM
? [