group-settings-button.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { RowLink } from '@/features/subscription/components/dashboard/row-link'
  2. import { useTranslation } from 'react-i18next'
  3. import { ManagedGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
  4. export default function GroupSettingsButton({
  5. subscription,
  6. }: {
  7. subscription: ManagedGroupSubscription
  8. }) {
  9. const { t } = useTranslation()
  10. const subscriptionHasManagedUsers =
  11. subscription.features?.managedUsers === true
  12. const subscriptionHasGroupSSO = subscription.features?.groupSSO === true
  13. let groupSettingRowSubText = ''
  14. if (subscriptionHasGroupSSO && subscriptionHasManagedUsers) {
  15. groupSettingRowSubText = t('manage_group_settings_subtext')
  16. } else if (subscriptionHasGroupSSO) {
  17. groupSettingRowSubText = t('manage_group_settings_subtext_group_sso')
  18. } else if (subscriptionHasManagedUsers) {
  19. groupSettingRowSubText = t('manage_group_settings_subtext_managed_users')
  20. }
  21. return (
  22. <RowLink
  23. href={`/manage/groups/${subscription._id}/settings`}
  24. heading={t('manage_group_settings')}
  25. subtext={groupSettingRowSubText}
  26. icon="settings"
  27. />
  28. )
  29. }