overleaf/services/web/frontend/js/features/editor-left-menu/components/actions-menu.tsx
M Fahru 5ae698ec6c Migrate "Manage Template" in editor left menu to react (#10609)
This feature is only available on server pro

GitOrigin-RevId: 7fc508c8039c2e3afd1a5fca469fce411e9d913a
2023-03-21 09:05:29 +00:00

39 lines
1 KiB
TypeScript

import { ElementType } from 'react'
import { useTranslation } from 'react-i18next'
import getMeta from '../../../utils/meta'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
import ActionsCopyProject from './actions-copy-project'
import ActionsWordCount from './actions-word-count'
const components = importOverleafModules('editorLeftMenuManageTemplate') as {
import: { default: ElementType }
path: string
}[]
export default function ActionsMenu() {
const { t } = useTranslation()
const anonymous = getMeta('ol-anonymous') as boolean | undefined
if (anonymous === true || anonymous === undefined) {
return null
}
return (
<>
<h4>{t('actions')}</h4>
<ul className="list-unstyled nav">
<li>
<ActionsCopyProject />
</li>
{components.map(({ import: { default: Component }, path }) => (
<li key={path}>
<Component />
</li>
))}
<li>
<ActionsWordCount />
</li>
</ul>
</>
)
}