Skip to content

Commit

Permalink
Check tier enum
Browse files Browse the repository at this point in the history
  • Loading branch information
ackernaut committed Jul 24, 2024
1 parent 2d4513a commit ff294be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/client/components/DashNavList/DashNavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import graphql from 'babel-plugin-relay/macro'
import React from 'react'
import {useFragment} from 'react-relay'
import {DashNavList_organization$key} from '../../__generated__/DashNavList_organization.graphql'
import {TierEnum} from '../../__generated__/OrganizationSubscription.graphql'
import {Tooltip} from '../../ui/Tooltip/Tooltip'
import {TooltipContent} from '../../ui/Tooltip/TooltipContent'
import {TooltipTrigger} from '../../ui/Tooltip/TooltipTrigger'
Expand Down Expand Up @@ -43,11 +44,11 @@ const DashNavList = (props: Props) => {
organizationsRef
)

const tiers = ['enterprise', 'team', 'starter']
const TierEnumValues: TierEnum[] = ['enterprise', 'team', 'starter']

const sortedOrgs = organizations.toSorted((a, b) => {
const aTier = tiers.indexOf(a.tier)
const bTier = tiers.indexOf(b.tier)
const aTier = TierEnumValues.indexOf(a.tier)
const bTier = TierEnumValues.indexOf(b.tier)
return aTier < bTier ? -1 : aTier > bTier ? 1 : a.name.localeCompare(b.name)
})

Expand Down

0 comments on commit ff294be

Please sign in to comment.