mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
This PR fixes some prettier issues: - Bump and unify all prettier versions to 3.7.3 across teh whole repo - Bump the SQL prettier plugin - When running `test:prettier`, check `mdx` files also - Run the new prettier format on all files --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { Branch } from 'data/branches/branches-query'
|
|
import type { Organization } from 'types'
|
|
|
|
export interface ProjectBranchSelectorState {
|
|
selectedBranch: Branch | undefined
|
|
isMainBranch: boolean
|
|
branchDisplayName: string
|
|
selectedOrgInitial: string
|
|
organizationHref: string
|
|
}
|
|
|
|
export function getProjectBranchSelectorState(params: {
|
|
selectedBranch: Branch | undefined
|
|
isBranchingEnabled: boolean
|
|
selectedOrganization: Organization | undefined
|
|
}): ProjectBranchSelectorState {
|
|
const { selectedBranch, isBranchingEnabled, selectedOrganization } = params
|
|
|
|
const isMainBranch = !isBranchingEnabled || selectedBranch?.is_default === true
|
|
const branchDisplayName = isBranchingEnabled ? (selectedBranch?.name ?? 'main') : 'main'
|
|
const selectedOrgInitial = selectedOrganization?.name?.trim().charAt(0).toUpperCase() ?? 'O'
|
|
const organizationHref = selectedOrganization?.slug
|
|
? `/org/${selectedOrganization.slug}`
|
|
: '/organizations'
|
|
|
|
return {
|
|
selectedBranch,
|
|
isMainBranch,
|
|
branchDisplayName,
|
|
selectedOrgInitial,
|
|
organizationHref,
|
|
}
|
|
}
|