mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
d751b88e6b
* Remove icons folder * Create folders for badge, button, and dropdown components * Remove Bootstrap 5 from test * Rename `getBootstrap5Breakpoint` to `getBootstrapBreakpoint` * Cleanup and update BS 5 comments * Move components to the shared folder * Rename `tooltips-bs5` to `tooltip` * Remove `-bs5` suffix * Fix path * Delete BS3 version file * Rename `_form_marketing-bootstrap-5` to `_form_marketing` * Delete BS3 version file * Rename `_contact_general_modal-marketing-bootstrap-5` to `_contact_general_modal-marketing` * Delete BS3 version file * Rename `_contact_modal-marketing-bootstrap-5` to `_contact_modal-marketing` * Delete BS3 version file * Rename `thin-footer-bootstrap-5` to `thin-footer` * Delete BS3 version file * Rename `language-picker-bootstrap-5` to `language-picker` * Rename `fat-footer-react-bootstrap-5` to `fat-footer-react` * Delete BS3 version file * Rename `navbar-marketing-bootstrap-5` to `navbar-marketing` * Rename `navbar-marketing-react-bootstrap-5` to `navbar-marketing-react` * Delete BS3 version file * Rename `layout-website-redesign-cms-bootstrap-5` to `layout-website-redesign-cms` * Source format * Fix path GitOrigin-RevId: cf0f5db7c84cf545c69213dcc271d9ff17fe5db7
97 lines
2.9 KiB
TypeScript
97 lines
2.9 KiB
TypeScript
import { RowLink } from '@/features/subscription/components/dashboard/row-link'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useLocation } from '@/shared/hooks/use-location'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import OLTag from '@/shared/components/ol/ol-tag'
|
|
import { ManagedGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
|
|
import { sendMB } from '../../../../infrastructure/event-tracking'
|
|
import starIcon from '../../images/star-gradient.svg'
|
|
|
|
function AvailableWithGroupProfessionalBadge() {
|
|
const { t } = useTranslation()
|
|
const location = useLocation()
|
|
|
|
const handleUpgradeClick = () => {
|
|
sendMB('flex-upgrade', {
|
|
location: 'ad-badge',
|
|
})
|
|
location.assign('/user/subscription/group/upgrade-subscription')
|
|
}
|
|
|
|
return (
|
|
<OLTag
|
|
prepend={<img aria-hidden="true" src={starIcon} alt="" />}
|
|
contentProps={{
|
|
className: 'mw-100',
|
|
onClick: handleUpgradeClick,
|
|
}}
|
|
>
|
|
<strong>{t('available_with_group_professional')}</strong>
|
|
</OLTag>
|
|
)
|
|
}
|
|
|
|
function useGroupSettingsButton(subscription: ManagedGroupSubscription) {
|
|
const { t } = useTranslation()
|
|
const subscriptionHasManagedUsers =
|
|
subscription.features?.managedUsers === true
|
|
const subscriptionHasGroupSSO = subscription.features?.groupSSO === true
|
|
const heading = t('group_settings')
|
|
|
|
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 {
|
|
heading,
|
|
groupSettingRowSubText,
|
|
}
|
|
}
|
|
|
|
export function GroupSettingsButton({
|
|
subscription,
|
|
}: {
|
|
subscription: ManagedGroupSubscription
|
|
}) {
|
|
const { heading, groupSettingRowSubText } =
|
|
useGroupSettingsButton(subscription)
|
|
|
|
return (
|
|
<RowLink
|
|
href={`/manage/groups/${subscription._id}/settings`}
|
|
heading={heading}
|
|
subtext={groupSettingRowSubText}
|
|
icon="settings"
|
|
/>
|
|
)
|
|
}
|
|
|
|
export function GroupSettingsButtonWithAdBadge({
|
|
subscription,
|
|
}: {
|
|
subscription: ManagedGroupSubscription
|
|
}) {
|
|
const { heading, groupSettingRowSubText } =
|
|
useGroupSettingsButton(subscription)
|
|
|
|
return (
|
|
<li className="list-group-item row-link">
|
|
<div className="row-link-inner">
|
|
<MaterialIcon type="settings" className="p-2 p-md-3 text-muted" />
|
|
<div className="flex-grow-1 text-truncate text-muted">
|
|
<strong>{heading}</strong>
|
|
<div className="text-truncate">{groupSettingRowSubText}</div>
|
|
</div>
|
|
<span className="p-2 p-md-3">
|
|
<AvailableWithGroupProfessionalBadge />
|
|
</span>
|
|
</div>
|
|
</li>
|
|
)
|
|
}
|