overleaf/services/web/frontend/js/features/subscription/components/dashboard/group-settings-button.tsx
Jessica Lawshe d5639794c2 Merge pull request #17166 from overleaf/ab-fix-group-settings-label
[web] Cleanup managed users env var and fix group settings label

GitOrigin-RevId: 817ed86a6c94c03adb41e8c10115d6404180142e
2024-02-20 09:05:54 +00:00

42 lines
1.4 KiB
TypeScript

import { RowLink } from '@/features/subscription/components/dashboard/row-link'
import getMeta from '@/utils/meta'
import { useTranslation } from 'react-i18next'
import { ExposedSettings } from '../../../../../../types/exposed-settings'
import { ManagedGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
export default function GroupSettingsButton({
subscription,
}: {
subscription: ManagedGroupSubscription
}) {
const { t } = useTranslation()
const { groupSSOEnabled } = getMeta(
'ol-ExposedSettings',
{}
) as ExposedSettings
const subscriptionHasManagedUsers =
subscription.features?.managedUsers !== false
const subscriptionHasGroupSSO =
subscription.features?.groupSSO === true ||
(groupSSOEnabled && subscription.features?.groupSSO === null)
let groupSettingRowSubText = ''
if (subscriptionHasGroupSSO && subscriptionHasManagedUsers) {
groupSettingRowSubText = t('manage_group_settings_subtext')
} else if (subscriptionHasGroupSSO) {
groupSettingRowSubText = t('manage_group_settings_subtext_group_sso')
} else if (subscriptionHasManagedUsers) {
groupSettingRowSubText = t('manage_group_settings_subtext_managed_users')
}
return (
<RowLink
href={`/manage/groups/${subscription._id}/settings`}
heading={t('manage_group_settings')}
subtext={groupSettingRowSubText}
icon="settings"
/>
)
}