Files
supabase/apps/studio/components/layouts/editors/EditorBaseLayout.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

82 lines
2.6 KiB
TypeScript

import { useParams } from 'common'
import { usePathname } from 'next/navigation'
import { ComponentProps, ReactNode } from 'react'
import { cn } from 'ui'
import { ProjectLayoutWithAuth } from '../ProjectLayout'
import { CollapseButton } from '../Tabs/CollapseButton'
import { EditorTabs } from '../Tabs/Tabs'
import { useEditorType } from './EditorsLayout.hooks'
import { useTabsStateSnapshot } from '@/state/tabs'
export interface ExplorerLayoutProps extends ComponentProps<typeof ProjectLayoutWithAuth> {
children: ReactNode
title?: string
product?: string
productMenuClassName?: string
}
export const EditorBaseLayout = ({
children,
title,
product,
productMenuClassName,
productMenu,
browserTitle,
}: ExplorerLayoutProps) => {
const { ref } = useParams()
const pathname = usePathname()
const editor = useEditorType()
const tabs = useTabsStateSnapshot()
const hasNoOpenTabs =
editor === 'table' ? tabs.openTabs.filter((x) => !x.startsWith('sql')).length === 0 : false
const hideTabs =
pathname === `/project/${ref}/editor` || pathname === `/project/${ref}/sql` || hasNoOpenTabs
const activeEditorTab = tabs.activeTab ? tabs.tabsMap[tabs.activeTab] : undefined
// Prefer the live tab label so browser titles update immediately after a rename,
// even when persisted tab metadata is still catching up.
const activeEditorTabLabel = activeEditorTab?.label ?? activeEditorTab?.metadata?.name
const activeEditorTabEntity =
activeEditorTab === undefined
? undefined
: editor === 'sql'
? activeEditorTab.type === 'sql'
? activeEditorTabLabel
: undefined
: editor === 'table'
? activeEditorTab.type !== 'sql'
? activeEditorTabLabel
: undefined
: undefined
const mergedBrowserTitle = {
...browserTitle,
section: title ?? browserTitle?.section,
entity: browserTitle?.entity ?? activeEditorTabEntity,
}
return (
<ProjectLayoutWithAuth
resizableSidebar
product={product}
browserTitle={mergedBrowserTitle}
productMenuClassName={productMenuClassName}
productMenu={productMenu}
>
<div className="flex flex-col h-full">
<div
className={cn(
'h-10 md:min-h-(--header-height) flex items-center',
!hideTabs ? 'bg-surface-200 dark:bg-alternative' : 'bg-surface-100'
)}
>
{hideTabs ? <CollapseButton hideTabs={hideTabs} /> : <EditorTabs />}
</div>
<div className="h-full">{children}</div>
</div>
</ProjectLayoutWithAuth>
)
}