mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
- add new [OrgSelector](https://github.com/supabase/supabase/pull/43238/changes#diff-214b339101a9c06864ea2755ac7246eb4c971ce74c5d3169b1385a28ee1d4227) and [ProjectBranchSelector](https://github.com/supabase/supabase/pull/43238/changes#diff-82d25c128c306b61bea7481026f58f670a229874f23ca3a1a1d78ddeabde21e0) components to the mobile navigation, replacing the previous which took up a lot of horizontal space - org/project/branch dropdowns now open up in the bottom MobileSheetNav for a better mobile ux - desktop nav remains unchanged
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { ParsedUrlQuery } from 'querystring'
|
|
import { Check } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { Badge, cn } from 'ui'
|
|
|
|
import { sanitizeRoute } from './ProjectDropdown.utils'
|
|
|
|
export interface ProjectRowLinkProps {
|
|
project: { ref: string; name: string; status?: string }
|
|
selectedRef: string | undefined
|
|
route: string
|
|
routerQueries: ParsedUrlQuery
|
|
}
|
|
|
|
export function ProjectRowLink({
|
|
project,
|
|
selectedRef,
|
|
route,
|
|
routerQueries,
|
|
}: ProjectRowLinkProps) {
|
|
const sanitizedRoute = sanitizeRoute(route, routerQueries)
|
|
const href = sanitizedRoute?.replace('[ref]', project.ref) ?? `/project/${project.ref}`
|
|
const isSelected = project.ref === selectedRef
|
|
const isPaused = project.status === 'INACTIVE'
|
|
|
|
return (
|
|
<Link
|
|
href={href}
|
|
className="w-full flex items-center justify-between p-0.5 md:p-0 text-sm md:text-xs"
|
|
>
|
|
<span className={cn('truncate', isSelected ? 'md:max-w-60' : 'md:max-w-64')}>
|
|
{project.name}
|
|
{isPaused && <Badge className="ml-2">Paused</Badge>}
|
|
</span>
|
|
{isSelected && <Check size={16} />}
|
|
</Link>
|
|
)
|
|
}
|