The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Convert app header dropdown buttons to include names
Joshen Lim42838e32b1b7
diff --git a/studio/components/layouts/AppLayout/AppHeader.tsx b/studio/components/layouts/AppLayout/AppHeader.tsxindex e6bcbe9bca9..8ce2088b4ad 100644--- a/studio/components/layouts/AppLayout/AppHeader.tsx+++ b/studio/components/layouts/AppLayout/AppHeader.tsx@@ -20,9 +20,9 @@ const AppHeader = () => {return (<div className="flex items-center justify-between px-4 py-1 bg-scale-200 border-b">- <div className="flex items-center space-x-4">+ <div className="flex items-center space-x-1"><Link href={organization !== undefined ? `/org/${organization?.slug}` : '/'}>- <a className="block">+ <a className="block mr-3"><imgsrc={`${router.basePath}/img/supabase-logo.svg`}alt="Supabase"diff --git a/studio/components/layouts/AppLayout/OrganizationDropdown.tsx b/studio/components/layouts/AppLayout/OrganizationDropdown.tsxindex 79fe2d975e5..8c1dff2eccd 100644--- a/studio/components/layouts/AppLayout/OrganizationDropdown.tsx+++ b/studio/components/layouts/AppLayout/OrganizationDropdown.tsx@@ -1,6 +1,6 @@import Link from 'next/link'import { useRouter } from 'next/router'-import { useRef, useState } from 'react'+import { useState } from 'react'import {Badge,Button,@@ -26,7 +26,6 @@ import { useFlag, useSelectedOrganization } from 'hooks'const OrganizationDropdown = () => {const router = useRouter()const orgCreationV2 = useFlag('orgcreationv2')- const orgNameRef = useRef<HTMLAnchorElement>(null)const selectedOrganization = useSelectedOrganization()const { data: organizations, isLoading: isLoadingOrganizations } = useOrganizationsQuery()@@ -39,35 +38,30 @@ const OrganizationDropdown = () => {)const [open, setOpen] = useState(false)- const popoverOffset = (orgNameRef.current?.offsetWidth ?? 0) + 12if (isLoadingOrganizations) {return <ShimmeringLoader className="w-[90px]" />}return (- <div className="flex items-center space-x-2 px-2">- <Link passHref href={slug ? `/org/${slug}` : '/'}>- <a ref={orgNameRef} className="flex items-center space-x-2">- <p className="text-sm">{orgName}</p>- {isSuccess && <Badge color="scale">{subscription?.plan.name}</Badge>}- </a>- </Link>-+ <div className="flex items-center px-2"><Popover_Shadcn_ open={open} onOpenChange={setOpen} modal={false}><PopoverTrigger_Shadcn_ asChild>- <Button- type="text"- className="px-1"- icon={<IconCode className="text-scale-1100 rotate-90" strokeWidth={2} size={12} />}- />+ <div className="flex items-center space-x-2 cursor-pointer">+ <Button+ type="text"+ iconRight={+ <IconCode className="text-scale-1100 rotate-90" strokeWidth={2} size={12} />+ }+ >+ <div className="flex items-center space-x-2">+ <p className="text-sm">{orgName}</p>+ {isSuccess && <Badge color="scale">{subscription?.plan.name}</Badge>}+ </div>+ </Button>+ </div></PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_- className="p-0"- side="bottom"- align="start"- style={{ marginLeft: `-${popoverOffset}px` }}- >+ <PopoverContent_Shadcn_ className="p-0" side="bottom" align="start"><Command_Shadcn_><CommandInput_Shadcn_ placeholder="Find organization..." /><CommandList_Shadcn_>diff --git a/studio/components/layouts/AppLayout/ProjectDropdown.tsx b/studio/components/layouts/AppLayout/ProjectDropdown.tsxindex f7a8689a690..fb92601b41b 100644--- a/studio/components/layouts/AppLayout/ProjectDropdown.tsx+++ b/studio/components/layouts/AppLayout/ProjectDropdown.tsx@@ -1,7 +1,7 @@import Link from 'next/link'import { useRouter } from 'next/router'import { ParsedUrlQuery } from 'querystring'-import { useRef, useState } from 'react'+import { useState } from 'react'import {Badge,Button,@@ -19,13 +19,13 @@ import {Popover_Shadcn_,} from 'ui'+import { useParams } from 'common'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useProjectsQuery } from 'data/projects/projects-query'import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'import { useSelectedOrganization, useSelectedProject } from 'hooks'-import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'+import { IS_PLATFORM } from 'lib/constants'import { Organization, Project } from 'types'-import { useParams } from 'common'// [Fran] the idea is to let users change projects without losing the current page,// but at the same time we need to redirect correctly between urls that might be@@ -103,7 +103,6 @@ const ProjectDropdown = () => {const { ref } = useParams()const projectDetails = useSelectedProject()const selectedOrganization = useSelectedOrganization()- const projectNameRef = useRef<HTMLAnchorElement>(null)const { data: allProjects, isLoading: isLoadingProjects } = useProjectsQuery()const isBranch = projectDetails?.parent_project_ref !== undefined@@ -124,35 +123,26 @@ const ProjectDropdown = () => {: projectDetails || projects?.find((project) => project.ref === ref)const [open, setOpen] = useState(false)- const popoverOffset = (projectNameRef.current?.offsetWidth ?? 0) + 12if (isLoadingProjects) {return <ShimmeringLoader className="w-[90px]" />}return IS_PLATFORM ? (- <div className="flex items-center space-x-2 px-2">- <Link href={`/project/${ref}`}>- <a ref={projectNameRef} className="flex items-center space-x-2">- <p className="text-sm">{selectedProject?.name}</p>- {isSuccess && !isOrgBilling && <Badge color="slate">{subscription?.plan.name}</Badge>}- </a>- </Link>-+ <div className="flex items-center px-2"><Popover_Shadcn_ open={open} onOpenChange={setOpen} modal={false}><PopoverTrigger_Shadcn_ asChild><Buttontype="text"- className="px-1"- icon={<IconCode className="text-scale-1100 rotate-90" strokeWidth={2} size={12} />}- />+ iconRight={<IconCode className="text-scale-1100 rotate-90" strokeWidth={2} size={12} />}+ >+ <div className="flex items-center space-x-2">+ <p className="text-sm">{selectedProject?.name}</p>+ {isSuccess && !isOrgBilling && <Badge color="slate">{subscription?.plan.name}</Badge>}+ </div>+ </Button></PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_- className="p-0"- side="bottom"- align="start"- style={{ marginLeft: `-${popoverOffset}px` }}- >+ <PopoverContent_Shadcn_ className="p-0" side="bottom" align="start"><Command_Shadcn_><CommandInput_Shadcn_ placeholder="Find project..." /><CommandList_Shadcn_>