mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
7e5ccecc7c
GitOrigin-RevId: 591cda98d0a34c777cc8a41b2ec64119a1226dfb
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
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<any[]>(
|
|
() =>
|
|
getMeta('editorLeftMenuSync') ||
|
|
importOverleafModules('editorLeftMenuSync')
|
|
)
|
|
|
|
if (anonymous === true || anonymous === undefined) {
|
|
return null
|
|
}
|
|
|
|
if (editorLeftMenuSync.length === 0) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<h4>{t('sync')}</h4>
|
|
<ul className="list-unstyled nav">
|
|
{editorLeftMenuSync.map(({ import: importObject }, index) => (
|
|
<li key={`editor-left-menu-sync-${index}`}>
|
|
<ModuleComponent Component={Object.values(importObject)[0]} />
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</>
|
|
)
|
|
}
|
|
|
|
type ModuleComponentProps = {
|
|
Component: any
|
|
}
|
|
|
|
function ModuleComponent({ Component }: ModuleComponentProps) {
|
|
return <Component />
|
|
}
|