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