Files
overleaf-cep/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx
T
Davinder Singh 34173eda46 Change subscription page title to "Your subscriptions" (#29377)
* adding plural translations for the languages that were easy to test with the help of AI

* adding remaining translations

* adding your_subscriptions

* running make sort_locales

* fixing nl.json to make it formal You

GitOrigin-RevId: 7510e2f8eee87fd2a256ece434cc59e6877893e6
2025-11-11 09:05:44 +00:00

96 lines
3.5 KiB
TypeScript

import { Trans, useTranslation } from 'react-i18next'
import ContactSupport from './contact-support-for-custom-subscription'
import GroupSubscriptionMemberships from './group-subscription-memberships'
import InstitutionMemberships from './institution-memberships'
import FreePlan from './free-plan'
import ManagedPublishers from './managed-publishers'
import PersonalSubscription from './personal-subscription'
import ManagedGroupSubscriptions from './managed-group-subscriptions'
import ManagedInstitutions from './managed-institutions'
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
import getMeta from '../../../../utils/meta'
import PremiumFeaturesLink from './premium-features-link'
import OLPageContentCard from '@/shared/components/ol/ol-page-content-card'
import OLRow from '@/shared/components/ol/ol-row'
import OLCol from '@/shared/components/ol/ol-col'
import OLNotification from '@/shared/components/ol/ol-notification'
import WritefullManagedBundleAddOn from './states/active/change-plan/modals/writefull-bundle-management-modal'
import RedirectAlerts from './redirect-alerts'
function SubscriptionDashboard() {
const { t } = useTranslation()
const {
hasDisplayedSubscription,
hasSubscription,
hasValidActiveSubscription,
personalSubscription,
} = useSubscriptionDashboardContext()
const hasAiAssistViaWritefull = getMeta('ol-hasAiAssistViaWritefull')
const fromPlansPage = getMeta('ol-fromPlansPage')
const hasRedirectedPaymentError = Boolean(
getMeta('ol-subscriptionPaymentErrorCode')
)
return (
<div className="container">
<OLRow>
<OLCol lg={{ span: 8, offset: 2 }}>
{fromPlansPage && (
<OLNotification
className="mb-4"
aria-live="polite"
content={t('you_already_have_a_subscription')}
type="warning"
/>
)}
{hasRedirectedPaymentError && (
<OLNotification
className="mb-4"
aria-live="polite"
content={
<Trans
i18nKey="payment_error_generic"
components={[
/* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
<a href="/contact" target="_blank" />,
]}
/>
}
type="error"
/>
)}
<RedirectAlerts />
<OLPageContentCard>
<div className="page-header">
<h1>{t('your_subscriptions')}</h1>
</div>
<div>
<PersonalSubscription />
<ManagedGroupSubscriptions />
<ManagedInstitutions />
<ManagedPublishers />
<GroupSubscriptionMemberships />
<InstitutionMemberships />
{!personalSubscription && hasAiAssistViaWritefull && (
<div className="mb-4">
<h2 className="h3 fw-bold">{t('add_ons')}</h2>
<WritefullManagedBundleAddOn />
</div>
)}
{hasValidActiveSubscription && (
<PremiumFeaturesLink subscription={personalSubscription} />
)}
{!hasDisplayedSubscription &&
(hasSubscription ? <ContactSupport /> : <FreePlan />)}
</div>
</OLPageContentCard>
</OLCol>
</OLRow>
</div>
)
}
export default SubscriptionDashboard