mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-15 14:30:56 -05:00
f8efc3e2ae
[web] Implement the editor's left menu in Offcanvas GitOrigin-RevId: 999e995d664b1dc958f56643f05e95b8aa2d6290
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { useState, useCallback } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import * as eventTracking from '../../../infrastructure/event-tracking'
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
import HotkeysModal from '../../hotkeys-modal/components/hotkeys-modal'
|
|
import LeftMenuButton from './left-menu-button'
|
|
import { bsVersionIcon } from '@/features/utils/bootstrap-5'
|
|
|
|
export default function HelpShowHotkeys() {
|
|
const [showModal, setShowModal] = useState(false)
|
|
const { t } = useTranslation()
|
|
const { features } = useProjectContext()
|
|
const isMac = /Mac/.test(window.navigator?.platform)
|
|
|
|
const showModalWithAnalytics = useCallback(() => {
|
|
eventTracking.sendMB('left-menu-hotkeys')
|
|
setShowModal(true)
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
<LeftMenuButton
|
|
onClick={showModalWithAnalytics}
|
|
icon={bsVersionIcon({
|
|
bs5: { type: 'keyboard' },
|
|
bs3: { type: 'keyboard-o', fw: true },
|
|
})}
|
|
>
|
|
{t('show_hotkeys')}
|
|
</LeftMenuButton>
|
|
<HotkeysModal
|
|
show={showModal}
|
|
handleHide={() => setShowModal(false)}
|
|
isMac={isMac}
|
|
trackChangesVisible={features?.trackChangesVisible}
|
|
/>
|
|
</>
|
|
)
|
|
}
|