diff --git a/services/web/frontend/js/features/editor-left-menu/components/editor-left-menu.tsx b/services/web/frontend/js/features/editor-left-menu/components/editor-left-menu.tsx index afa0cb484b..f64676445c 100644 --- a/services/web/frontend/js/features/editor-left-menu/components/editor-left-menu.tsx +++ b/services/web/frontend/js/features/editor-left-menu/components/editor-left-menu.tsx @@ -3,6 +3,7 @@ import ActionsMenu from './actions-menu' import HelpMenu from './help-menu' import { useLayoutContext } from '../../../shared/context/layout-context' import classNames from 'classnames' +import SyncMenu from './sync-menu' export default function EditorLeftMenu() { const { leftMenuShown, setLeftMenuShown } = useLayoutContext() @@ -15,6 +16,7 @@ export default function EditorLeftMenu() { > + {leftMenuShown ? ( diff --git a/services/web/frontend/js/features/editor-left-menu/components/sync-menu.tsx b/services/web/frontend/js/features/editor-left-menu/components/sync-menu.tsx new file mode 100644 index 0000000000..0716cd25f4 --- /dev/null +++ b/services/web/frontend/js/features/editor-left-menu/components/sync-menu.tsx @@ -0,0 +1,43 @@ +import { useState } from 'react' +import { useTranslation } from 'react-i18next' +import importOverleafModules from '../../../../macros/import-overleaf-module.macro' +import getMeta from '../../../utils/meta' + +export default function SyncMenu() { + const { t } = useTranslation() + const anonymous = getMeta('ol-anonymous') as boolean | undefined + const [editorLeftMenuSync] = useState( + () => + getMeta('editorLeftMenuSync') || + importOverleafModules('editorLeftMenuSync') + ) + + if (anonymous === true || anonymous === undefined) { + return null + } + + if (editorLeftMenuSync.length === 0) { + return null + } + + return ( + <> +

{t('sync')}

+
    + {editorLeftMenuSync.map(({ import: importObject }) => ( +
  • + +
  • + ))} +
+ + ) +} + +type ModuleComponentProps = { + Component: any +} + +function ModuleComponent({ Component }: ModuleComponentProps) { + return +}