mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 00:19:08 +00:00
## Context
Just some housekeeping here while going through the repo, realised that
there's dead code in `ProjectBranchSwitcher`
## Changes involved:
- `ProjectBranchSelector` is only rendered by `MobileNavigationBar`,
which `DefaultLayout` only mounts when `useBreakpoint('md')` is true.
The selector's own `isMobile` check used the same breakpoint, so its
desktop `Popover` branch could never run.
- The name `ProjectBranchSelector` is also misleading since the sheet
switches more than just the project's branch + it's mobile-only, so
opting to rename it to `MobileProjectSwitcher` instead
- Also fix org rows in the sheet being tighter than project rows.
`compactPadding` was inverted, so the embedded list got `p-0.5` on the
item and lost the default `px-2 py-1.5`
- Align buttons in `ProjectBranchSelector` across all tabs + use outline
variant for secondary action
| Previous | Updated |
|---|---|
| <img width="352" height="174" alt="image"
src="https://github.com/user-attachments/assets/24cb2985-b568-4bc1-8f53-ab3914ef0804"
/> | <img width="351" height="161" alt="image"
src="https://github.com/user-attachments/assets/e6e9b0e9-c075-4235-93ca-80c5d070c287"
/> |
| <img width="336" height="248" alt="image"
src="https://github.com/user-attachments/assets/4071b73f-f741-4598-ba01-8dc7bb6ba57a"
/> | <img width="335" height="313" alt="image"
src="https://github.com/user-attachments/assets/2bea398d-ebe9-4641-9bfe-c4a7b6b10c51"
/> |
If you meant a different table, tell me what the two columns should be.
For example, file and change, or before and after behaviour.
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { CheckIcon } from 'lucide-react'
|
|
|
|
import { CommandItemLink } from '@/components/ui/CommandItemLink'
|
|
import PartnerIcon from '@/components/ui/PartnerIcon'
|
|
import type { Organization } from '@/types'
|
|
|
|
export interface OrgCommandItemProps {
|
|
org: Organization
|
|
selectedSlug: string | undefined
|
|
routePathname: string
|
|
hasRouteSlug: boolean
|
|
onClose: () => void
|
|
}
|
|
|
|
export function OrgCommandItem({
|
|
org,
|
|
selectedSlug,
|
|
routePathname,
|
|
hasRouteSlug,
|
|
onClose,
|
|
}: OrgCommandItemProps) {
|
|
const href = hasRouteSlug ? routePathname.replace('[slug]', org.slug) : `/org/${org.slug}`
|
|
|
|
return (
|
|
<CommandItemLink
|
|
key={org.slug}
|
|
href={href}
|
|
value={`${org.name.replaceAll('"', '')} - ${org.slug}`}
|
|
className="cursor-pointer w-full"
|
|
onSelect={onClose}
|
|
>
|
|
<div className="w-full flex items-center justify-between p-0.5 md:p-0 text-sm md:text-xs">
|
|
<div className="flex items-center gap-2">
|
|
<span>{org.name}</span>
|
|
<PartnerIcon organization={org} />
|
|
</div>
|
|
{org.slug === selectedSlug && <CheckIcon size={16} />}
|
|
</div>
|
|
</CommandItemLink>
|
|
)
|
|
}
|