The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Small UI fixes + fix switching projects while on a bucket, doesnt direct to the buckets page
Joshen Lima8893cb834c2
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/ProjectDropdown.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/ProjectDropdown.tsxindex 1f685d4ca6f..6de692d35f7 100644--- a/studio/components/layouts/ProjectLayout/LayoutHeader/ProjectDropdown.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/ProjectDropdown.tsx@@ -14,16 +14,16 @@ import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'// is a unique project id/marker so we'll redirect the user to the// highest common route with just projectRef in the router queries.-const sanitizeRoute = (route: string, routerQueries: ParsedUrlQuery) => {+export const sanitizeRoute = (route: string, routerQueries: ParsedUrlQuery) => {const queryArray = Object.entries(routerQueries)if (queryArray.length > 1) {- // account for query string, if exists (example: /logs/explorer?q=select...)- const hasQueryString = queryArray.some(([key]) => key === 'q')-+ // [Joshen] Ideally we shouldn't use hard coded numbers, but temp workaround+ // for storage bucket route since its longer+ const isStorageBucketRoute = 'bucketId' in routerQueriesreturn route.split('/')- .slice(0, hasQueryString ? 5 : 4)+ .slice(0, isStorageBucketRoute ? 5 : 4).join('/')} else {return routediff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsxindex fa2f9c3e883..9f7494094c3 100644--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx@@ -16,7 +16,11 @@ const NavigationIconButton: FC<Props> = ({ route, isActive = false }) => {<Tooltip.Trigger><ConditionalWrapcondition={route.link !== undefined}- wrap={(children) => <Link href={route.link!}>{children}</Link>}+ wrap={(children) => (+ <Link href={route.link!}>+ <a>{children}</a>+ </Link>+ )}><spanclassName={[diff --git a/studio/components/layouts/StorageLayout/StorageMenu.tsx b/studio/components/layouts/StorageLayout/StorageMenu.tsxindex afd1454f03a..1d85c34ee92 100644--- a/studio/components/layouts/StorageLayout/StorageMenu.tsx+++ b/studio/components/layouts/StorageLayout/StorageMenu.tsx@@ -31,8 +31,8 @@ const StorageMenu = () => {| 'logs'const storageExplorerStore = useStorageStore()- const { data } = useBucketsQuery({ projectRef: ref })- const { loaded, openDeleteBucketModal } = storageExplorerStore || {}+ const { data, isLoading } = useBucketsQuery({ projectRef: ref })+ const { openDeleteBucketModal } = storageExplorerStore || {}const buckets = data ?? []@@ -80,11 +80,11 @@ const StorageMenu = () => {<div className=""><div><Menu.Group title="All buckets" />- {!loaded ? (- <div className="space-y-2">+ {isLoading ? (+ <div className="space-y-2 mx-2">+ <ShimmeringLoader className="!py-2.5" />+ <ShimmeringLoader className="!py-2.5" /><ShimmeringLoader className="!py-2.5" />- <ShimmeringLoader className="!py-2.5 w-3/4" />- <ShimmeringLoader className="!py-2.5 w-1/2" /></div>) : (<>@@ -126,10 +126,7 @@ const StorageMenu = () => {<CreateBucketModalvisible={showCreateBucketModal}- onClose={() => {- console.log('onClose')- setShowCreateBucketModal(false)- }}+ onClose={() => setShowCreateBucketModal(false)}/><EditBucketModaldiff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.jsindex 0793f877423..3bf029e8f5f 100644--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js@@ -184,7 +184,7 @@ const FileExplorerColumn = ({<divclassName={`${fullWidth ? 'w-full' : 'w-64 border-r border-gray-500'}- px-2 py-1 my-1 flex flex-shrink-0 flex-col space-y-1 overflow-auto+ px-2 py-1 my-1 flex flex-shrink-0 flex-col space-y-2 overflow-auto`}><ShimmeringLoader />diff --git a/studio/tests/components/ProjectDropdown.test.ts b/studio/tests/components/ProjectDropdown.test.tsnew file mode 100644index 00000000000..36142b2e1e7--- /dev/null+++ b/studio/tests/components/ProjectDropdown.test.ts@@ -0,0 +1,22 @@+import { sanitizeRoute } from 'components/layouts/ProjectLayout/LayoutHeader/ProjectDropdown'++test('Should sanitize project routes correctly when switching projects by removing project specific parameters', () => {+ expect(sanitizeRoute('/project/[ref]', { ref: 'abc' })).toBe('/project/[ref]')+ expect(sanitizeRoute('/project/[ref]/editor', { ref: 'abc' })).toBe('/project/[ref]/editor')+ expect(sanitizeRoute('/project/[ref]/storage/buckets', { ref: 'abc' })).toBe(+ '/project/[ref]/storage/buckets'+ )+ expect(sanitizeRoute('/project/[ref]/settings/billing/subscription', { ref: 'abc' })).toBe(+ '/project/[ref]/settings/billing/subscription'+ )++ expect(sanitizeRoute('/project/[ref]/editor/[tableId]', { ref: 'abc', tableId: '10' })).toBe(+ '/project/[ref]/editor'+ )+ expect(+ sanitizeRoute('/project/[ref]/storage/buckets/[bucketId]', { ref: 'abc', bucketId: 'bucket-1' })+ ).toBe('/project/[ref]/storage/buckets')+ expect(sanitizeRoute('/project/[ref]/logs/explorer?q=select', { ref: 'abc' })).toBe(+ '/project/[ref]/logs/explorer?q=select'+ )+})