2022-11-05 07:35:05 -04:00
|
|
|
import { ElementType } from 'react'
|
2022-10-21 18:12:06 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
|
|
|
import getMeta from '../../../utils/meta'
|
|
|
|
|
2022-11-05 07:35:05 -04:00
|
|
|
const components = importOverleafModules('editorLeftMenuSync') as {
|
|
|
|
import: { default: ElementType }
|
|
|
|
path: string
|
|
|
|
}[]
|
|
|
|
|
2022-10-21 18:12:06 -04:00
|
|
|
export default function SyncMenu() {
|
|
|
|
const { t } = useTranslation()
|
2024-06-18 06:01:37 -04:00
|
|
|
const anonymous = getMeta('ol-anonymous')
|
|
|
|
const gitBridgeEnabled = getMeta('ol-gitBridgeEnabled')
|
2022-10-21 18:12:06 -04:00
|
|
|
|
2024-06-18 06:01:37 -04:00
|
|
|
if (anonymous) {
|
2022-10-21 18:12:06 -04:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2022-11-05 07:35:05 -04:00
|
|
|
if (components.length === 0) {
|
2022-10-21 18:12:06 -04:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2023-11-07 06:54:03 -05:00
|
|
|
// This flag can only be false in CE and Server Pro. In this case we skip rendering the
|
|
|
|
// entire sync section, since Dropbox and GitHub are never available in SP
|
|
|
|
if (!gitBridgeEnabled) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2022-10-21 18:12:06 -04:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<h4>{t('sync')}</h4>
|
|
|
|
<ul className="list-unstyled nav">
|
2022-11-05 07:35:05 -04:00
|
|
|
{components.map(({ import: { default: Component }, path }) => (
|
|
|
|
<li key={path}>
|
|
|
|
<Component />
|
2022-10-21 18:12:06 -04:00
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|