From 381cdf34ce01e3d5a96fc31a9cefb2042c4a7d29 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Sat, 5 Nov 2022 11:35:05 +0000 Subject: [PATCH] Use imported components directly GitOrigin-RevId: 4533d7eb59ed543a301d99a9dce4ff54af6cfe6c --- .../editor-left-menu/components/sync-menu.tsx | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) 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 index 90e208b934..7a2c47abd5 100644 --- 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 @@ -1,22 +1,22 @@ -import { useState } from 'react' +import { ElementType } from 'react' import { useTranslation } from 'react-i18next' import importOverleafModules from '../../../../macros/import-overleaf-module.macro' import getMeta from '../../../utils/meta' +const components = importOverleafModules('editorLeftMenuSync') as { + import: { default: ElementType } + path: string +}[] + 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) { + if (components.length === 0) { return null } @@ -24,20 +24,12 @@ export default function SyncMenu() { <>

{t('sync')}

) } - -type ModuleComponentProps = { - Component: any -} - -function ModuleComponent({ Component }: ModuleComponentProps) { - return -}