Skip to content

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

Minor clean ups (#37653)

Joshen Limeeaf7e3c38de
diff --git a/apps/studio/components/interfaces/Storage/BucketRow.tsx b/apps/studio/components/interfaces/Storage/BucketRow.tsx
index f272a89c53d..78ef08e09c0 100644
--- a/apps/studio/components/interfaces/Storage/BucketRow.tsx
+++ b/apps/studio/components/interfaces/Storage/BucketRow.tsx
@@ -1,6 +1,6 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { noop } from 'lodash'
-import { ChevronDown, Columns3, Edit2, Trash, XCircle } from 'lucide-react'
+import { Columns3, Edit2, MoreVertical, Trash, XCircle } from 'lucide-react'
import Link from 'next/link'
import type { Bucket } from 'data/storage/buckets-query'
@@ -76,7 +76,7 @@ const BucketRow = ({
{canUpdateBuckets && isSelected ? (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button type="text" icon={<ChevronDown />} className="mr-1 p-1.5 w-7" />
+ <Button type="text" icon={<MoreVertical />} className="mr-1 h-6 w-6" />
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="start">
{bucket.type !== 'ANALYTICS' && (
diff --git a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
index e9b1ab5ef55..002d48acbd8 100644
--- a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
+++ b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
@@ -1,46 +1,21 @@
-import Link from 'next/link'
import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
import { useParams } from 'common'
-import { useIsColumnLevelPrivilegesEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { ProductMenu } from 'components/ui/ProductMenu'
import { useAuthConfigPrefetch } from 'data/auth/auth-config-query'
import { withAuth } from 'hooks/misc/withAuth'
-import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
import { generateAuthMenu } from './AuthLayout.utils'
const AuthProductMenu = () => {
const router = useRouter()
const { ref: projectRef = 'default' } = useParams()
- const columnLevelPrivileges = useIsColumnLevelPrivilegesEnabled()
useAuthConfigPrefetch({ projectRef })
const page = router.pathname.split('/')[4]
- return (
- <>
- <ProductMenu page={page} menu={generateAuthMenu(projectRef)} />
- {columnLevelPrivileges && (
- <div className="px-3">
- <Alert_Shadcn_>
- <AlertTitle_Shadcn_ className="text-sm">
- Column Privileges has been shifted
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_ className="text-xs">
- <p className="mb-2">It can now be found in the menu under the database section.</p>
- <Button asChild type="default" size="tiny">
- <Link href={`/project/${projectRef}/database/column-privileges`}>
- Head over to Database
- </Link>
- </Button>
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- </div>
- )}
- </>
- )
+ return <ProductMenu page={page} menu={generateAuthMenu(projectRef)} />
}
const AuthLayout = ({ children }: PropsWithChildren<{}>) => {
diff --git a/apps/studio/components/layouts/ProjectLayout/ProductMenuBar.tsx b/apps/studio/components/layouts/ProjectLayout/ProductMenuBar.tsx
index b579a00c078..3895c1115a4 100644
--- a/apps/studio/components/layouts/ProjectLayout/ProductMenuBar.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/ProductMenuBar.tsx
@@ -1,21 +1,22 @@
import { PropsWithChildren } from 'react'
+import { cn } from 'ui'
interface ProductMenuBarProps {
title: string
+ className?: string
}
-const ProductMenuBar = ({ title, children }: PropsWithChildren<ProductMenuBarProps>) => {
+const ProductMenuBar = ({ title, children, className }: PropsWithChildren<ProductMenuBarProps>) => {
return (
<div
/**
* id used in playwright-tests/tests/snapshot/spec/table-editor.spec.ts
* */
id="spec-click-target"
- className={[
- 'hide-scrollbar flex flex-col w-full h-full', // Layout
- 'bg-dash-sidebar',
- 'border-default ',
- ].join(' ')}
+ className={cn(
+ 'flex flex-col w-full h-full', // Layout
+ 'hide-scrollbar bg-dash-sidebar border-default'
+ )}
>
<div
className="border-default flex max-h-12 items-center border-b px-6"
@@ -23,7 +24,7 @@ const ProductMenuBar = ({ title, children }: PropsWithChildren<ProductMenuBarPro
>
<h4 className="text-lg">{title}</h4>
</div>
- <div className="flex-grow overflow-y-auto">{children}</div>
+ <div className={cn('flex-grow overflow-y-auto', className)}>{children}</div>
</div>
)
}
diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
index 1e2a94dc719..f183b8a9bb5 100644
--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
@@ -10,8 +10,8 @@ import { AIAssistant } from 'components/ui/AIAssistantPanel/AIAssistant'
import { EditorPanel } from 'components/ui/EditorPanel/EditorPanel'
import { Loading } from 'components/ui/Loading'
import { ResourceExhaustionWarningBanner } from 'components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner'
-import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
-import { useSelectedProject } from 'hooks/misc/useSelectedProject'
+import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
+import { useSelectedProject, useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
import { PROJECT_STATUS } from 'lib/constants'
import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'
@@ -66,6 +66,7 @@ export interface ProjectLayoutProps {
productMenu?: ReactNode
selectedTable?: string
resizableSidebar?: boolean
+ productMenuClassName?: string
}
const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayoutProps>>(
@@ -79,13 +80,14 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
children,
selectedTable,
resizableSidebar = false,
+ productMenuClassName,
},
ref
) => {
const router = useRouter()
const [isClient, setIsClient] = useState(false)
- const selectedOrganization = useSelectedOrganization()
- const selectedProject = useSelectedProject()
+ const { data: selectedOrganization } = useSelectedOrganizationQuery()
+ const { data: selectedProject } = useSelectedProjectQuery()
const {
editorPanel,
@@ -190,7 +192,9 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
isBlocking={isBlocking}
productMenu={productMenu}
>
- <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>
+ <ProductMenuBar title={product} className={productMenuClassName}>
+ {productMenu}
+ </ProductMenuBar>
</MenuBarWrapper>
</motion.div>
</AnimatePresence>
diff --git a/apps/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx b/apps/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx
index f13ca0793be..c9b6b7a342f 100644
--- a/apps/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx
+++ b/apps/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx
@@ -1,7 +1,8 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { PropsWithChildren } from 'react'
+
import NoPermission from 'components/ui/NoPermission'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
-import { PropsWithChildren } from 'react'
import { ProjectLayoutWithAuth } from '../ProjectLayout/ProjectLayout'
const TableEditorLayout = ({ children }: PropsWithChildren<{}>) => {
@@ -16,7 +17,7 @@ const TableEditorLayout = ({ children }: PropsWithChildren<{}>) => {
)
}
- return <>{children}</>
+ return children
}
export default TableEditorLayout
diff --git a/apps/studio/components/layouts/editors/EditorBaseLayout.tsx b/apps/studio/components/layouts/editors/EditorBaseLayout.tsx
index 9f0da404d7f..27c4b4a41be 100644
--- a/apps/studio/components/layouts/editors/EditorBaseLayout.tsx
+++ b/apps/studio/components/layouts/editors/EditorBaseLayout.tsx
@@ -11,12 +11,18 @@ import { useEditorType } from './EditorsLayout.hooks'
export interface ExplorerLayoutProps extends ComponentProps<typeof ProjectLayoutWithAuth> {
children: ReactNode
- hideTabs?: boolean
title?: string
product?: string
+ productMenuClassName?: string
}
-export const EditorBaseLayout = ({ children, title, product, ...props }: ExplorerLayoutProps) => {
+export const EditorBaseLayout = ({
+ children,
+ title,
+ product,
+ productMenuClassName,
+ productMenu,
+}: ExplorerLayoutProps) => {
const { ref } = useParams()
const pathname = usePathname()
const editor = useEditorType()
@@ -28,7 +34,13 @@ export const EditorBaseLayout = ({ children, title, product, ...props }: Explore
pathname === `/project/${ref}/editor` || pathname === `/project/${ref}/sql` || hasNoOpenTabs
return (
- <ProjectLayoutWithAuth resizableSidebar title={title} product={product} {...props}>
+ <ProjectLayoutWithAuth
+ resizableSidebar
+ title={title}
+ product={product}
+ productMenuClassName={productMenuClassName}
+ productMenu={productMenu}
+ >
<div className="flex flex-col h-full">
<div
className={cn(
diff --git a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx
index cd853d9d143..945b8544a0d 100644
--- a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx
+++ b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx
@@ -411,7 +411,7 @@ export const AIAssistant = ({ className }: AIAssistantProps) => {
className="w-fit mt-4"
onClick={() => setIsConfirmOptInModalOpen(true)}
>
- Update AI settings
+ Permission settings
</Button>
)}
</Admonition>
diff --git a/apps/studio/components/ui/ProductMenu/ProductMenu.tsx b/apps/studio/components/ui/ProductMenu/ProductMenu.tsx
index 67cc2c49e39..d55a15a053b 100644
--- a/apps/studio/components/ui/ProductMenu/ProductMenu.tsx
+++ b/apps/studio/components/ui/ProductMenu/ProductMenu.tsx
@@ -10,7 +10,7 @@ interface ProductMenuProps {
const ProductMenu = ({ page, menu }: ProductMenuProps) => {
return (
- <div className="flex flex-col space-y-8 overflow-y-auto">
+ <div className="flex flex-col space-y-8">
<Menu type="pills">
{menu.map((group, idx) => (
<div key={group.key || group.title}>
diff --git a/apps/studio/pages/project/[ref]/editor/[id].tsx b/apps/studio/pages/project/[ref]/editor/[id].tsx
index 3a1f9c8697a..6f11123aa8f 100644
--- a/apps/studio/pages/project/[ref]/editor/[id].tsx
+++ b/apps/studio/pages/project/[ref]/editor/[id].tsx
@@ -56,7 +56,11 @@ const TableEditorPage: NextPageWithLayout = () => {
TableEditorPage.getLayout = (page) => (
<DefaultLayout>
- <EditorBaseLayout productMenu={<TableEditorMenu />} product="Table Editor">
+ <EditorBaseLayout
+ productMenu={<TableEditorMenu />}
+ product="Table Editor"
+ productMenuClassName="overflow-y-hidden"
+ >
<TableEditorLayout>{page}</TableEditorLayout>
</EditorBaseLayout>
</DefaultLayout>
diff --git a/apps/studio/pages/project/[ref]/editor/index.tsx b/apps/studio/pages/project/[ref]/editor/index.tsx
index 71e4686868b..6ba1073515f 100644
--- a/apps/studio/pages/project/[ref]/editor/index.tsx
+++ b/apps/studio/pages/project/[ref]/editor/index.tsx
@@ -47,7 +47,11 @@ const TableEditorPage: NextPageWithLayout = () => {
TableEditorPage.getLayout = (page) => (
<DefaultLayout>
- <EditorBaseLayout productMenu={<TableEditorMenu />} product="Table Editor">
+ <EditorBaseLayout
+ productMenu={<TableEditorMenu />}
+ product="Table Editor"
+ productMenuClassName="overflow-y-hidden"
+ >
<TableEditorLayout>{page}</TableEditorLayout>
</EditorBaseLayout>
</DefaultLayout>
diff --git a/apps/studio/pages/project/[ref]/editor/new.tsx b/apps/studio/pages/project/[ref]/editor/new.tsx
index 48546300b92..ec76bdc6a49 100644
--- a/apps/studio/pages/project/[ref]/editor/new.tsx
+++ b/apps/studio/pages/project/[ref]/editor/new.tsx
@@ -27,7 +27,11 @@ const EditorNewPage: NextPageWithLayout = () => {
EditorNewPage.getLayout = (page) => (
<DefaultLayout>
- <EditorBaseLayout productMenu={<TableEditorMenu />} product="Table Editor">
+ <EditorBaseLayout
+ productMenu={<TableEditorMenu />}
+ product="Table Editor"
+ productMenuClassName="overflow-y-hidden"
+ >
<TableEditorLayout>{page}</TableEditorLayout>
</EditorBaseLayout>
</DefaultLayout>
diff --git a/apps/studio/styles/main.scss b/apps/studio/styles/main.scss
index 1fab429887c..9a0898e8eac 100644
--- a/apps/studio/styles/main.scss
+++ b/apps/studio/styles/main.scss
@@ -2,7 +2,6 @@
@tailwind components;
@tailwind utilities;
-@import './../../../packages/ui/build/css/source/global.css';
@import './../../../packages/ui/build/css/source/global.css';
@import './../../../packages/ui/build/css/themes/dark.css';
@import './../../../packages/ui/build/css/themes/light.css';