mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 16:19:02 +02:00
860f77a06c
* [web] Remove new editor elements for CE/SP Makes rendering of elements conditional or completely removes them from CE/SP: - Subscription link is removed from settings modal - Documentation link is present on `proxyLearn === true` - Contact us link is present when `support` module is available (not the case for CE/SP) * Using hidden instead of conditional rendering in settings GitOrigin-RevId: 562563d0bc4d0ca919e336f0c13cf6b476c6cf31
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import getMeta from '@/utils/meta'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
|
import { useCallback } from 'react'
|
|
import {
|
|
DropdownDivider,
|
|
DropdownItem,
|
|
DropdownMenu,
|
|
} from '@/shared/components/dropdown/dropdown-menu'
|
|
|
|
export default function RailHelpDropdown() {
|
|
const showSupport = getMeta('ol-showSupport')
|
|
const showDocumentation = getMeta('ol-wikiEnabled')
|
|
const { t } = useTranslation()
|
|
const { setActiveModal } = useRailContext()
|
|
const openKeyboardShortcutsModal = useCallback(() => {
|
|
setActiveModal('keyboard-shortcuts')
|
|
}, [setActiveModal])
|
|
const openContactUsModal = useCallback(() => {
|
|
setActiveModal('contact-us')
|
|
}, [setActiveModal])
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownItem onClick={openKeyboardShortcutsModal}>
|
|
{t('keyboard_shortcuts')}
|
|
</DropdownItem>
|
|
{showDocumentation && (
|
|
<DropdownItem
|
|
href="/learn"
|
|
role="menuitem"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
{t('documentation')}
|
|
</DropdownItem>
|
|
)}
|
|
{showSupport && (
|
|
<>
|
|
<DropdownDivider />
|
|
<DropdownItem onClick={openContactUsModal}>
|
|
{t('contact_us')}
|
|
</DropdownItem>
|
|
</>
|
|
)}
|
|
</DropdownMenu>
|
|
)
|
|
}
|