Prevent github menu in project list react to be included in SP/CE build (#11951)

GitOrigin-RevId: 58d0378d2307f5c38ea4446b684993aec29fa292
This commit is contained in:
M Fahru 2023-03-01 07:07:53 -07:00 committed by Copybot
parent c40b673613
commit 351ab1979b
2 changed files with 13 additions and 5 deletions

View file

@ -786,6 +786,7 @@ module.exports = {
integrationLinkingWidgets: [],
referenceLinkingWidgets: [],
importProjectFromGithubModalWrapper: [],
importProjectFromGithubMenu: [],
editorLeftMenuSync: [],
},

View file

@ -1,4 +1,4 @@
import { useCallback, useState } from 'react'
import { type JSXElementConstructor, useCallback, useState } from 'react'
import { Dropdown, MenuItem } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { ExposedSettings } from '../../../../../types/exposed-settings'
@ -11,6 +11,7 @@ import NewProjectButtonModal, {
import AddAffiliation, { useAddAffiliation } from './add-affiliation'
import { Nullable } from '../../../../../types/utils'
import { sendMB } from '../../../infrastructure/event-tracking'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
type SendTrackingEvent = {
dropdownMenu: string
@ -138,6 +139,14 @@ function NewProjectButton({
[sendTrackingEvent]
)
const [importProjectFromGithubMenu] = importOverleafModules(
'importProjectFromGithubMenu'
)
const ImportProjectFromGithubMenu: JSXElementConstructor<{
onClick: (e: React.MouseEvent<Record<string, unknown>>) => void
}> = importProjectFromGithubMenu?.import.default
return (
<>
<ControlledDropdown
@ -183,16 +192,14 @@ function NewProjectButton({
>
{t('upload_project')}
</MenuItem>
<MenuItem
<ImportProjectFromGithubMenu
onClick={e =>
handleModalMenuClick(e, {
modalVariant: 'import_from_github',
dropdownMenuEvent: 'import-from-github',
})
}
>
{t('import_from_github')}
</MenuItem>
/>
{portalTemplates?.length > 0 ? (
<>
<MenuItem divider />