Explorar el Código

Merge pull request #7711 from overleaf/ta-misc-section

[SettingsPage] Add Misc Section

GitOrigin-RevId: a4a00c6b2bb920a0c0c6665f30a9657a6e89bc8f
Timothée Alby hace 4 años
padre
commit
0c2c3bff8b

+ 8 - 0
services/web/frontend/extracted-translations.json

@@ -16,6 +16,8 @@
   "autocomplete": "",
   "autocomplete_references": "",
   "back_to_your_projects": "",
+  "beta_program_already_participating": "",
+  "beta_program_benefits": "",
   "blocked_filename": "",
   "can_edit": "",
   "cancel": "",
@@ -231,7 +233,10 @@
   "make_email_primary_description": "",
   "make_primary": "",
   "make_private": "",
+  "manage_beta_program_membership": "",
   "manage_files_from_your_dropbox_folder": "",
+  "manage_newsletter": "",
+  "manage_sessions": "",
   "math_display": "",
   "math_inline": "",
   "maximum_files_uploaded_together": "",
@@ -254,6 +259,7 @@
   "new_folder": "",
   "new_name": "",
   "new_password": "",
+  "newsletter": "",
   "no_existing_password": "",
   "no_messages": "",
   "no_new_commits_in_github": "",
@@ -374,9 +380,11 @@
   "server_error": "",
   "session_error": "",
   "session_expired_redirecting_to_login": "",
+  "sessions": "",
   "share": "",
   "share_project": "",
   "share_with_your_collabs": "",
+  "sharelatex_beta_program": "",
   "show_in_code": "",
   "show_in_pdf": "",
   "show_outline": "",

+ 27 - 0
services/web/frontend/js/features/settings/components/misc-section.tsx

@@ -0,0 +1,27 @@
+import { useTranslation } from 'react-i18next'
+import { useUserContext } from '../../../shared/context/user-context'
+
+function MiscSection() {
+  const { t } = useTranslation()
+  const { betaProgram } = useUserContext()
+
+  return (
+    <>
+      <h3>{t('sharelatex_beta_program')}</h3>
+      <p>
+        {betaProgram
+          ? t('beta_program_already_participating')
+          : t('beta_program_benefits')}
+      </p>
+      <a href="/beta/participate">{t('manage_beta_program_membership')}</a>
+      <hr />
+      <h3>{t('sessions')}</h3>
+      <a href="/user/sessions">{t('manage_sessions')}</a>
+      <hr />
+      <h3>{t('newsletter')}</h3>
+      <a href="/user/email-preferences">{t('manage_newsletter')}</a>
+    </>
+  )
+}
+
+export default MiscSection

+ 3 - 0
services/web/frontend/js/features/settings/components/root.tsx

@@ -7,6 +7,7 @@ import AccountInfoSection from './account-info-section'
 import PasswordSection from './password-section'
 import IntegrationLinkingSection from './integration-linking-section'
 import SSOLinkingSection from './sso-linking-section'
+import MiscSection from './misc-section'
 import LeaveSection from './leave-section'
 import * as eventTracking from '../../../infrastructure/event-tracking'
 import { UserProvider } from '../../../shared/context/user-context'
@@ -48,6 +49,8 @@ function SettingsPageRoot() {
                 <hr />
                 <SSOLinkingSection />
                 <hr />
+                <MiscSection />
+                <hr />
                 <LeaveSection />
               </div>
             </div>

+ 17 - 0
services/web/frontend/stories/settings/misc.stories.js

@@ -0,0 +1,17 @@
+import MiscSection from '../../js/features/settings/components/misc-section'
+import { UserProvider } from '../../js/shared/context/user-context'
+
+export const Section = args => {
+  window.metaAttributesCache.set('ol-user', { betaProgram: true })
+
+  return (
+    <UserProvider>
+      <MiscSection {...args} />
+    </UserProvider>
+  )
+}
+
+export default {
+  title: 'Account Settings / Misc / Section',
+  component: MiscSection,
+}

+ 2 - 0
services/web/locales/en.json

@@ -915,6 +915,8 @@
   "account_is_linked": "Account is linked",
   "unlink_dropbox": "Unlink Dropbox",
   "link_to_dropbox": "Link to Dropbox",
+  "newsletter": "Newsletter",
+  "manage_newsletter": "Manage Your Newsletter Preferences",
   "newsletter_info_and_unsubscribe": "Every few months we send a newsletter out summarizing the new features available. If you would prefer not to receive this email then you can unsubscribe at any time:",
   "unsubscribed": "Unsubscribed",
   "unsubscribing": "Unsubscribing",